Skip to main content

IUser

@webda/core


Interface: IUser

Defined in: packages/core/src/models/types.ts:55

Reference to a user model

Extends​

  • Model

Properties​

[WEBDA_EVENTS]?​

optional [WEBDA_EVENTS]?: ModelEvents<IUser>

Defined in: packages/models/lib/model.model.d.ts:154

Model events

Inherited from​

Model.[WEBDA_EVENTS]


[WEBDA_PRIMARY_KEY]​

abstract [WEBDA_PRIMARY_KEY]: readonly keyof IUser[]

Defined in: packages/models/lib/model.model.d.ts:166

Non-abstract class need to define their PrimaryKey

Inherited from​

Model.[WEBDA_PRIMARY_KEY]


[WEBDA_STORAGE]​

protected [WEBDA_STORAGE]: Record<string, any>

Defined in: packages/models/lib/model.model.d.ts:159

Internal backing store for morpher-generated accessor properties. Populated automatically when getter/setter pairs are generated at build time.

Inherited from​

Model.[WEBDA_STORAGE]


constructor​

constructor: Function

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:125

The initial value of Object.prototype.constructor is the standard built-in Object constructor.

Inherited from​

Model.constructor

Methods​

delete()​

delete(): Promise<void>

Defined in: packages/models/lib/model.model.d.ts:281

Delete a model

Returns​

Promise<void>

a promise resolving when deleted (void)

Inherited from​

Model.delete


emit()​

protected emit<T>(event, payload): Promise<void>

Defined in: packages/models/lib/model.model.d.ts:248

Helper to emit events from the class

Type Parameters​

T​

T extends keyof ModelEvents<IUser>

Parameters​

event​

T

the event name to emit

payload​

ModelEvents<IUser>[T]

the event data

Returns​

Promise<void>

Inherited from​

Model.emit


getEmail()​

getEmail(): string

Defined in: packages/core/src/models/types.ts:59

Get the user email

Returns​

string


getPrimaryKey()​

getPrimaryKey<K>(this): PrimaryKeyType<IUser>

Defined in: packages/models/lib/model.model.d.ts:172

K is inferred as the literal tuple type of this.keyFields, so K[number] is the exact union of keys you wrote.

Type Parameters​

K​

K extends readonly keyof IUser[]

Parameters​

this​

IUser & object

Returns​

PrimaryKeyType<IUser>

the primary key value

Inherited from​

Model.getPrimaryKey


getRepository()​

getRepository(): Repository<ModelClass<IUser>>

Defined in: packages/models/lib/model.model.d.ts:199

Get the repository associated with this model class

Returns​

Repository<ModelClass<IUser>>

the repository

Inherited from​

Model.getRepository


getUUID()​

getUUID(): string

Defined in: packages/models/lib/model.model.d.ts:180

Return the string representation of the primary key

Returns​

string

the string UID

Inherited from​

Model.getUUID


hasOwnProperty()​

hasOwnProperty(v): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:140

Determines whether an object has a property with the specified name.

Parameters​

v​

PropertyKey

A property name.

Returns​

boolean

Inherited from​

Model.hasOwnProperty


isDeleted()​

isDeleted(): any

Defined in: packages/models/lib/model.model.d.ts:276

Check whether this model instance has been soft-deleted

Returns​

any

true if soft-deleted

Inherited from​

Model.isDeleted


isPrototypeOf()​

isPrototypeOf(v): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:146

Determines whether an object exists in another object's prototype chain.

Parameters​

v​

Object

Another object whose prototype chain is to be checked.

Returns​

boolean

Inherited from​

Model.isPrototypeOf


load()​

load(params): this

Defined in: packages/models/lib/model.model.d.ts:271

Allow to load from Storage, Dto and helper formats

Parameters​

params​

LoadParameters<this>

the data to load

Returns​

this

the model instance

Inherited from​

Model.load


patch()​

patch(data): Promise<IUser>

Defined in: packages/models/lib/model.model.d.ts:287

Patch the object

Parameters​

data​

Partial<SelfJSONed<this>>

the partial data to patch with

Returns​

Promise<IUser>

the patched model instance

Inherited from​

Model.patch


propertyIsEnumerable()​

propertyIsEnumerable(v): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:152

Determines whether a specified property is enumerable.

Parameters​

v​

PropertyKey

A property name.

Returns​

boolean

Inherited from​

Model.propertyIsEnumerable


ref()​

ref(): ModelRef<IUser>

Defined in: packages/models/lib/model.model.d.ts:185

Get a reference to this model instance in its repository

Returns​

ModelRef<IUser>

a model reference

Inherited from​

Model.ref


refresh()​

refresh(): Promise<IUser>

Defined in: packages/models/lib/model.model.d.ts:237

Reload the model from the repository, updating all properties in-place

Returns​

Promise<IUser>

the refreshed model instance

Inherited from​

Model.refresh


save()​

save(): Promise<IUser>

Defined in: packages/models/lib/model.model.d.ts:242

Save the model to the repository

Returns​

Promise<IUser>

the saved model instance

Inherited from​

Model.save


setPrimaryKey()​

setPrimaryKey<K>(this, value): this

Defined in: packages/models/lib/model.model.d.ts:192

Set the primary key of the model

Type Parameters​

K​

K extends readonly keyof IUser[]

Parameters​

this​

IUser & object

the model instance

value​

PK<IUser, K[number]>

the primary key value to set

Returns​

this

the model instance

Inherited from​

Model.setPrimaryKey


toDTO()​

toDTO(): object

Defined in: packages/models/lib/model.model.d.ts:232

Public representation of the model: its JSON form without __-prefixed (server-only) keys, at any depth. Dates are serialized as strings.

Implemented as a JSON.parse(JSON.stringify(this)) round-trip, so circular references throw, BigInt throws and Buffers become { type: "Buffer", data }. A model with such fields must override toDTO.

Returns​

the DTO

constructor​

constructor: object

The initial value of Object.prototype.constructor is the standard built-in Object constructor.

constructor.apply​

apply: object

constructor.arguments​

arguments: any

constructor.bind​

bind: object

constructor.call​

call: object

constructor.caller​

caller: { toString: {}; apply: {}; call: {}; bind: {}; prototype: any; arguments: any; caller: ...; }

constructor.prototype​

prototype: any

constructor.toString​

toString: object

delete​

delete: object

getEmail​

getEmail: object

getPrimaryKey​

getPrimaryKey: object

getRepository​

getRepository: object

getUUID​

getUUID: object

hasOwnProperty​

hasOwnProperty: object

isDeleted​

isDeleted: object

isPrototypeOf​

isPrototypeOf: object

load​

load: object

patch​

patch: object

propertyIsEnumerable​

propertyIsEnumerable: object

ref​

ref: object

refresh​

refresh: object

save​

save: object

setPrimaryKey​

setPrimaryKey: object

toDTO​

toDTO: object

toJSON​

toJSON: object

toLocaleString​

toLocaleString: object

toProxy​

toProxy: object

toString​

toString: object

valueOf​

valueOf: object

Inherited from​

Model.toDTO


toJSON()​

toJSON(): this

Defined in: packages/models/lib/model.model.d.ts:222

Serialize the model to JSON.

Uses for...in to include both own enumerable properties (regular class fields) and inherited enumerable prototype getters generated by the morpher for coercible fields (e.g. Date). Symbol-keyed internals and methods are excluded automatically.

Returns​

this

the model instance

Inherited from​

Model.toJSON


toLocaleString()​

toLocaleString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:131

Returns a date converted to a string using the current locale.

Returns​

string

Inherited from​

Model.toLocaleString


toProxy()​

toProxy(): any

Defined in: packages/models/lib/model.model.d.ts:115

Returns​

any

Inherited from​

Model.toProxy


toString()​

toString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:128

Returns a string representation of an object.

Returns​

string

Inherited from​

Model.toString


valueOf()​

valueOf(): Object

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:134

Returns the primitive value of the specified object.

Returns​

Object

Inherited from​

Model.valueOf