Skip to main content

Class: BaseAliasRouteMongo

Defined in: src/routes/mongo/BaseAliasRouteMongo.ts:11

Extends

Constructors

Constructor

new BaseAliasRouteMongo(): BaseAliasRouteMongo

Returns

BaseAliasRouteMongo

Inherited from

BaseAliasRoute.constructor

Properties

_objectFactory?

protected optional _objectFactory?: ObjectFactory

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:101

Inherited from

BaseAliasRoute._objectFactory


aclUtils?

protected optional aclUtils?: ACLUtils

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:102

Inherited from

BaseAliasRoute.aclUtils


config?

protected optional config?: any

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:104

The global application configuration.

Inherited from

BaseAliasRoute.config


defaultACLUid

protected defaultACLUid: string

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:106

The unique identifier of the default ACL for the model type.

Inherited from

BaseAliasRoute.defaultACLUid


logger

protected logger: any

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:107

Inherited from

BaseAliasRoute.logger


messagingUtils?

protected optional messagingUtils?: MessagingUtils

Defined in: src/routes/BaseAliasRoute.ts:35

Inherited from

BaseAliasRoute.messagingUtils


notificationUtils?

protected optional notificationUtils?: NotificationUtils

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:108

Inherited from

BaseAliasRoute.notificationUtils


profileClass

protected profileClass: any = ProfileMongo

Defined in: src/routes/mongo/BaseAliasRouteMongo.ts:12

The concrete Profile model class for this datastore — set by the SQL/Mongo binding subclass.

Overrides

BaseAliasRoute.profileClass


profileRepo?

protected optional profileRepo?: RepoUtils<Profile>

Defined in: src/routes/BaseAliasRoute.ts:32

Inherited from

BaseAliasRoute.profileRepo


rateLimiter?

protected optional rateLimiter?: RateLimiter

Defined in: src/routes/BaseAliasRoute.ts:38

Inherited from

BaseAliasRoute.rateLimiter


repoUtils?

protected optional repoUtils?: RepoUtils<AliasMongo>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:112

The repository utility class to use for common operations.

Inherited from

BaseAliasRoute.repoUtils


repoUtilsClass

protected readonly repoUtilsClass: any

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:33

The class of the RepoUtils to use when instantiating the utility.

Inherited from

BaseAliasRoute.repoUtilsClass


trackChanges

protected trackChanges: number

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:117

The number of previous document versions to store in the database. A negative value indicates storing all versions, a value of 0 stores no versions.

Inherited from

BaseAliasRoute.trackChanges


trustedRoles

protected trustedRoles: string[]

Defined in: src/routes/BaseAliasRoute.ts:41

Inherited from

BaseAliasRoute.trustedRoles

Accessors

modelClass

Get Signature

get modelClass(): any

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:122

The class type of the model this route is associated with.

Returns

any

Inherited from

BaseAliasRoute.modelClass

Methods

count()

count(params, query, res, user?): Promise<any>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:34

Parameters

params

any

query

any

res

HttpResponse

user?

JWTUser

Returns

Promise<any>

Inherited from

BaseAliasRoute.count


create()

create(obj, req, user?): Promise<AliasMongo | AliasMongo[]>

Defined in: src/routes/BaseAliasRoute.ts:149

Parameters

obj

AliasMongo | AliasMongo[]

req

HttpRequest

user?

JWTUser

Returns

Promise<AliasMongo | AliasMongo[]>

Inherited from

BaseAliasRoute.create


delete()

delete(id, version, purge, req, user?): Promise<void>

Defined in: src/routes/BaseAliasRoute.ts:164

Parameters

id

string

version

string | undefined

purge

string | undefined

req

HttpRequest

user?

JWTUser

Returns

Promise<void>

Inherited from

BaseAliasRoute.delete


doBulkCreate()

protected doBulkCreate(objs, options): Promise<AliasMongo[]>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:151

Attempts to store a collection of objects provided in options.req.body into the datasource. Upon success, sets the newly persisted object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the client.

Parameters

objs

Partial<AliasMongo>[]

The object(s) to store in the database.

options

CreateRequestOptions

The options to process the request using.

Returns

Promise<AliasMongo[]>

Inherited from

BaseAliasRoute.doBulkCreate


doBulkUpdate()

protected doBulkUpdate(objs, options): Promise<AliasMongo[]>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:203

Attempts to modify a collection of existing data model objects.

Parameters

objs

UpdateObject<AliasMongo>[]

The object(s) to bulk update in the database.

options

UpdateRequestOptions<AliasMongo>

The options to process the request using.

Returns

Promise<AliasMongo[]>

Inherited from

BaseAliasRoute.doBulkUpdate


doCount()

protected doCount(options): Promise<HttpResponse>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:133

Attempts to retrieve the number of data model objects matching the given set of criteria as specified in the request query. Any results that have been found are set to the content-length header of the res argument.

Parameters

options

FindRequestOptions

The options to process the request using.

Returns

Promise<HttpResponse>

Inherited from

BaseAliasRoute.doCount


doCreate()

protected doCreate(obj, options): Promise<AliasMongo | AliasMongo[]>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:160

Attempts to store one or more objects provided in options.req.body into the datasource. Upon success, sets the newly persisted object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the client.

Parameters

obj

Partial<AliasMongo> | Partial<AliasMongo>[]

The object(s) to store in the database.

options

CreateRequestOptions

The options to process the request using.

Returns

Promise<AliasMongo | AliasMongo[]>

Inherited from

BaseAliasRoute.doCreate


doCreateObject()

protected doCreateObject(obj, options): Promise<AliasMongo>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:142

Attempts to store an object provided in options.req.body into the datasource. Upon success, sets the newly persisted object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the client.

Parameters

obj

Partial<T>

The object to store in the database.

options

CreateRequestOptions

The options to process the request using.

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.doCreateObject


doDelete()

protected doDelete(id, options): Promise<void>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:168

Attempts to delete an existing data model object with a given unique identifier encoded by the URI parameter id.

Parameters

id

string

The unique identifier of the object to delete.

options

DeleteRequestOptions

The options to process the request using.

Returns

Promise<void>

Inherited from

BaseAliasRoute.doDelete


doExists()

protected doExists(id, options): Promise<any>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:175

Attempts to determine if an existing object with the given unique identifier exists.

Parameters

id

string

The unique identifier of the object to verify exists.

options

FindRequestOptions

The options to process the request using.

Returns

Promise<any>

Inherited from

BaseAliasRoute.doExists


doFind()

protected doFind(options): Promise<AliasMongo[]>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:183

Attempts to retrieve all data model objects matching the given set of criteria as specified in the request query. Any results that have been found are set to the result property of the res argument. result is never null.

Parameters

options

FindRequestOptions

The options to process the request using.

Returns

Promise<AliasMongo[]>

Inherited from

BaseAliasRoute.doFind


doFindById()

protected doFindById(id, options): Promise<AliasMongo | null>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:189

Attempts to retrieve a single data model object as identified by the id parameter in the URI.

Parameters

id

string

options

FindRequestOptions

The options to process the request using.

Returns

Promise<AliasMongo | null>

Inherited from

BaseAliasRoute.doFindById


doTruncate()

protected doTruncate(options): Promise<void>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:196

Attempts to remove all entries of the data model type from the datasource matching the given parameters and query.

Parameters

options

TruncateRequestOptions

The options to process the request using.

Returns

Promise<void>

Inherited from

BaseAliasRoute.doTruncate


doUpdate()

protected doUpdate(id, obj, options): Promise<AliasMongo>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:210

Attempts to modify an existing data model object as identified by the id parameter in the URI.

Parameters

id

string

obj

UpdateObject<AliasMongo>

The object to update in the database

options

UpdateRequestOptions<AliasMongo>

The options to process the request using.

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.doUpdate


doUpdateProperty()

protected doUpdateProperty(id, propertyName, value, options): Promise<AliasMongo>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:221

Attempts to modify a single property of an existing data model object as identified by the id parameter in the URI.

Note that this effectively bypasses optimistic locking and can cause unexpected data overwrites. Use with care.

Parameters

id

string

The unique identifier of the object to update.

propertyName

string

The name of the property to update.

value

any

The value of the property to set.

options

UpdateRequestOptions<AliasMongo>

The options to process the request using.

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.doUpdateProperty


exists()

exists(id, query, res, user?): Promise<any>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:43

Parameters

id

string

query

any

res

HttpResponse

user?

JWTUser

Returns

Promise<any>

Inherited from

BaseAliasRoute.exists


find()

find(params, query, user?): Promise<AliasMongo[]>

Defined in: src/routes/BaseAliasRoute.ts:174

Parameters

params

any

query

any

user?

JWTUser

Returns

Promise<AliasMongo[]>

Inherited from

BaseAliasRoute.find


findById()

findById(id, query, user?): Promise<AliasMongo | null>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:45

Parameters

id

string

query

any

user?

JWTUser

Returns

Promise<AliasMongo | null>

Inherited from

BaseAliasRoute.findById


init()

protected init(): Promise<void>

Defined in: src/routes/BaseAliasRoute.ts:44

Returns

Promise<void>

Inherited from

BaseAliasRoute.init


requestVerificationCode()

requestVerificationCode(id, req, user): Promise<void>

Defined in: src/routes/BaseAliasRoute.ts:223

Requests a verification code be sent for the alias with the given id.

Parameters

id

string

The unique identifier of the alias to send a verification code to.

req

HttpRequest

The HTTP request being processed.

user

JWTUser

The authenticated user making the request.

Returns

Promise<void>

Inherited from

BaseAliasRoute.requestVerificationCode


sendVerificationCode()

protected sendVerificationCode(alias, req): Promise<void>

Defined in: src/routes/BaseAliasRoute.ts:237

Sends a one-time verification code to the unverified contact.

Parameters

alias

Alias

req

HttpRequest

Returns

Promise<void>

Inherited from

BaseAliasRoute.sendVerificationCode


truncate()

truncate(params, query, user?): Promise<void>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:46

Parameters

params

any

query

any

user?

JWTUser

Returns

Promise<void>

Inherited from

BaseAliasRoute.truncate


update()

update(id, obj, req, user?): Promise<AliasMongo>

Defined in: src/routes/BaseAliasRoute.ts:262

Parameters

id

string

obj

UpdateObject<AliasMongo>

req

HttpRequest

user?

JWTUser

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.update


updateBulk()

updateBulk(obj, req, user?): Promise<AliasMongo[]>

Defined in: src/routes/BaseAliasRoute.ts:273

Parameters

obj

UpdateObject<AliasMongo>[]

req

HttpRequest

user?

JWTUser

Returns

Promise<AliasMongo[]>

Inherited from

BaseAliasRoute.updateBulk


updateProperty()

updateProperty(id, propertyName, obj, user?): Promise<AliasMongo>

Defined in: src/routes/BaseAliasRoute.ts:279

Parameters

id

string

propertyName

string

obj

any

user?

JWTUser

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.updateProperty


validate()

validate(objs, options?): Promise<void>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:225

Calls repoUtils.validate() to validate the object(s) provided.

Parameters

objs

Partial<AliasMongo> | Partial<AliasMongo>[]

options?

CreateRequestOptions | UpdateRequestOptions<AliasMongo>

Returns

Promise<void>

Inherited from

BaseAliasRoute.validate


validateCreate()

protected validateCreate(obj, user?): Promise<void>

Defined in: src/routes/BaseAliasRoute.ts:81

Override this function to perform additional custom validation of object creation. This is called for each object passed to the create() operation.

Parameters

obj

Partial<T>

user?

JWTUser

Returns

Promise<void>

Inherited from

BaseAliasRoute.validateCreate


validateUpdate()

protected validateUpdate(id, obj, user?): Promise<void>

Defined in: node_modules/@rapidrest/service-core/dist/types/routes/CRUDRoute.d.ts:52

Override this function to perform additional custom validation of object updates. This is called for update() and updateBulk() operations. updateBulk() calls this function for each update object.

Parameters

id

string

obj

UpdateObject<AliasMongo>

user?

JWTUser

Returns

Promise<void>

Inherited from

BaseAliasRoute.validateUpdate


verifyContact()

verifyContact(id, obj, req, user?): Promise<AliasMongo>

Defined in: src/routes/BaseAliasRoute.ts:296

Verifies the alias using the one-time code sent automatically when it was created (see sendVerificationCode), flipping its verified flag to true.

Parameters

id

string

obj
token?

string

req

HttpRequest

user?

JWTUser

Returns

Promise<AliasMongo>

Inherited from

BaseAliasRoute.verifyContact