Class: RoomInvite
Defined in: models/room_invite.ts:22
RoomInvite class is made for creating room invitations for users. RoomInvites are stored
in cosmos with the id invite.
Extends
Constructors
Constructor
new RoomInvite(
props):RoomInvite
Defined in: models/room_invite.ts:26
Parameters
props
Returns
RoomInvite
Overrides
Properties
attributes
attributes:
RoomInviteProps={}
Defined in: models/model.ts:34
Inherited from
uid?
optionaluid:string
Defined in: models/room_invite.ts:24
uuid
uuid:
string
Defined in: models/model.ts:35
Inherited from
id
staticid:string='invite'
Defined in: models/room_invite.ts:23
Overrides
Accessors
id
Get Signature
get id():
string
Defined in: models/model.ts:249
Gets the ID
Returns
string
The ID property. Options include: "room" | "user" | "userRoom" | "invite" | "otp"
Inherited from
isNew
Get Signature
get isNew():
boolean
Defined in: models/model.ts:258
Checks if model is new
Returns
boolean
Returns boolean if uuid is missing from record
Inherited from
Methods
delete()
delete():
Promise<boolean>
Defined in: models/model.ts:78
Deletes a record
Returns
Promise<boolean>
a boolean: true if the record was deleted, false if it was not deleted
Inherited from
deleteInvite()
deleteInvite():
Promise<boolean>
Defined in: models/room_invite.ts:37
Deletes an invite record
Returns
Promise<boolean>
A boolean indicating whether it was successful. true means that the invite was deleted.
get()
get(
name):any
Defined in: models/model.ts:267
Gets an attribute's value
Parameters
name
Name of the attribute that is being retrieved
string | number
Returns
any
The attribute value being retrieved
Inherited from
save()
save():
Promise<boolean>
Defined in: models/model.ts:206
Save a record in DB
Returns
Promise<boolean>
true if the record was saved in the DB
Inherited from
serialize()
serialize():
IKeyValue
Defined in: models/room_invite.ts:104
Serializes the data's attributes to return to the user.
Returns
IKeyValue
A serialized version of the attributes, with the exception of the uuid.
Overrides
set()
set(
name,value):void
Defined in: models/model.ts:276
Sets an attribute value
Parameters
name
Key of the attribute's value being set
string | number
value
any
Value of the attribute being set
Returns
void
Inherited from
update()
update(
attrs):Promise<boolean>
Defined in: models/model.ts:231
Parameters
attrs
The attributes provided to update the record.
Returns
Promise<boolean>
a boolean: True if successfully updated | False if not updated
Inherited from
create()
staticcreate(attrs):Promise<any>
Defined in: models/model.ts:58
Creates a new model & save the record
Parameters
attrs
The attributes passing to the model.
Returns
Promise<any>
either the saved model or null, if the model could not be saved.
Inherited from
find()
staticfind(uuid):Promise<any>
Defined in: models/model.ts:88
Finds a record
Parameters
uuid
string
The unique ID of the record being found
Returns
Promise<any>
a new instance of the found record
Inherited from
findAll()
staticfindAll():Promise<any[]>
Defined in: models/model.ts:134
Load all records by type
Returns
Promise<any[]>
A list of all records that match a particular model id
Inherited from
findAllBy()
staticfindAllBy(params):Promise<any>
Defined in: models/model.ts:125
Alias for query
Parameters
params
The query properties used to filter & find a record
Returns
Promise<any>
A list of found records that match the params, may be an empty []
Inherited from
findBy()
staticfindBy(params):Promise<any>
Defined in: models/model.ts:107
Finds a single record based on props (essentially limits query to a single result)
Parameters
params
The query properties used to filter & find a record
Returns
Promise<any>
null if no record found, or a new instance of the record
Inherited from
findInvite()
staticfindInvite(props):Promise<RoomInvite>
Defined in: models/room_invite.ts:70
Finds one invitation
Parameters
props
IKeyValue
The properties used to query cosmos for one room invitation.
Returns
Promise<RoomInvite>
If an invitation is found, a RoomInvite is returned, else null
findInvites()
staticfindInvites(props):Promise<RoomInvite[]>
Defined in: models/room_invite.ts:48
Finds a list of invitations, returns an array of RoomInvites
Parameters
props
IKeyValue
The properties used to query cosmos for multiple room invitation.
Returns
Promise<RoomInvite[]>
A list of new invites if records were found, or null if no record.
findOrCreate()
staticfindOrCreate(attrs):Promise<any>
Defined in: models/model.ts:154
Finds a record by given UUID, if it doesn't exist, creates a new record instead
Parameters
attrs
The attributes provided to query the record. Only UUID will be used
Returns
Promise<any>
Either the existing record or newly created one
Inherited from
findOrCreateBy()
staticfindOrCreateBy(attrs):Promise<any>
Defined in: models/model.ts:171
Finds a record by a query, if it doesn't exist, creates a new record instead
Parameters
attrs
IKeyValue
The attributes provided to query the record.
Returns
Promise<any>
Either the existing record or newly created one
Inherited from
findOrCreateInvite()
staticfindOrCreateInvite(props):Promise<any>
Defined in: models/room_invite.ts:88
First, this method looks for an invitation. If no invitation is found, a new invite will be created & added to the DB.
Parameters
props
IKeyValue
The properties used to query cosmos for a room invitation and/or create a new invite.
Returns
Promise<any>
An invitation is returned or a new invitation is returned
query()
staticquery(params):Promise<any[]>
Defined in: models/model.ts:190
Query for resources using an object of properties/filters
Parameters
params
IKeyValue
The attributes provided to query the record.
Returns
Promise<any[]>
An array of the found records (created as new instances of model)