Skip to main content

IUser

@webda/core


Interface: IUser

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

Reference to a user model

Extends​

  • Model

Properties​

[WEBDA_EVENTS]?​

optional [WEBDA_EVENTS]?: ModelEvents<IUser>

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

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:176

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:169

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@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:123

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

Inherited from​

Model.constructor

Methods​

canAct()​

canAct(_context, _action): CanActResult

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

Check if the caller can do action on this object, asked by the static Model.canAct

Nothing is allowed by default: override it to grant access. Declaring it on the base class types every override, so an override with its parameters swapped (canAct(action, context)) does not compile.

Parameters​

_context​

CanActContext

the caller context

_action​

string

the action name ("get", "create", "update", "delete", an action name, "attribute.action")

Returns​

CanActResult

true when allowed, otherwise a refusal (a reason string or false)

Inherited from​

Model.canAct


delete()​

delete(): Promise<void>

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

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:258

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:58

Get the user email

Returns​

string


getPrimaryKey()​

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

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

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:209

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:190

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@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:138

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:286

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@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:144

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:281

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:297

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@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:150

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:195

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:247

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:252

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:202

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:242

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

canAct​

canAct: object

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:232

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@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:129

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

Returns​

string

Inherited from​

Model.toLocaleString


toProxy()​

toProxy(): this

Defined in: packages/models/lib/repositories/hooks.d.ts:79

Convert to proxy

Returns​

this

Inherited from​

Model.toProxy


toString()​

toString(): string

Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:126

Returns a string representation of an object.

Returns​

string

Inherited from​

Model.toString


valueOf()​

valueOf(): Object

Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:132

Returns the primitive value of the specified object.

Returns​

Object

Inherited from​

Model.valueOf