refactor(model): 🏷️ force type casting for toRef method

This commit is contained in:
Julien Oculi 2024-06-18 11:49:28 +02:00
parent aefdacbf59
commit 1fb1f1ce15
5 changed files with 21 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import type { Base64String, ToJson, UUID } from '@/types.ts' import type { Base64String, ToJson, UUID } from '@/types.ts'
import { Ressource } from '@models/ressource.ts' import { Ressource } from '@models/ressource.ts'
import type { Ref } from '@models'
export class Credential<T extends CredentialCategory> extends Ressource { export class Credential<T extends CredentialCategory> extends Ressource {
static fromJSON<T extends CredentialCategory>( static fromJSON<T extends CredentialCategory>(
@ -69,6 +70,10 @@ export class Credential<T extends CredentialCategory> extends Ressource {
toString(): string { toString(): string {
return `Credential (${JSON.stringify(this)})` return `Credential (${JSON.stringify(this)})`
} }
toRef(): Ref<Credential<T>> {
return super.toRef() as Ref<Credential<T>>
}
} }
export interface Credential<T extends CredentialCategory> extends Ressource { export interface Credential<T extends CredentialCategory> extends Ressource {

View file

@ -106,6 +106,10 @@ export class Group extends Ressource {
toString(): string { toString(): string {
return `Group (${JSON.stringify(this)})` return `Group (${JSON.stringify(this)})`
} }
toRef(): Ref<Group> {
return super.toRef() as Ref<Group>
}
} }
export interface Group extends Ressource { export interface Group extends Ressource {

View file

@ -93,6 +93,10 @@ export class Machine extends Ressource {
toString(): string { toString(): string {
return `Machine (${JSON.stringify(this)})` return `Machine (${JSON.stringify(this)})`
} }
toRef(): Ref<Machine> {
return super.toRef() as Ref<Machine>
}
} }
export interface Machine extends Ressource { export interface Machine extends Ressource {

View file

@ -119,6 +119,10 @@ export class Service extends Ressource {
toString(): string { toString(): string {
return `Service (${JSON.stringify(this)})` return `Service (${JSON.stringify(this)})`
} }
toRef(): Ref<Service> {
return super.toRef() as Ref<Service>
}
} }
export interface Service extends Ressource { export interface Service extends Ressource {

View file

@ -168,6 +168,10 @@ export class User extends Ressource {
toString(): string { toString(): string {
return `User (${JSON.stringify(this)})` return `User (${JSON.stringify(this)})`
} }
toRef(): Ref<User> {
return super.toRef() as Ref<User>
}
} }
export interface User extends Ressource { export interface User extends Ressource {