Skip to main content

Class: BaseProfileRouteSQL

Defined in: auth/src/routes/sql/BaseProfileRouteSQL.ts:11

Extends​

Constructors​

Constructor​

new BaseProfileRouteSQL(): BaseProfileRouteSQL

Returns​

BaseProfileRouteSQL

Inherited from​

BaseProfileRoute.constructor

Properties​

_objectFactory?​

protected optional _objectFactory?: ObjectFactory

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

Inherited from​

BaseProfileRoute._objectFactory


aclUtils?​

protected optional aclUtils?: ACLUtils

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

Inherited from​

BaseProfileRoute.aclUtils


config?​

protected optional config?: any

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

The global application configuration.

Inherited from​

BaseProfileRoute.config


defaultACLUid​

protected defaultACLUid: string

Defined in: auth/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​

BaseProfileRoute.defaultACLUid


logger​

protected logger: any

Defined in: auth/src/routes/BaseProfileRoute.ts:31

Inherited from​

BaseProfileRoute.logger


messagingUtils?​

protected optional messagingUtils?: MessagingUtils

Defined in: auth/src/routes/BaseProfileRoute.ts:34

Inherited from​

BaseProfileRoute.messagingUtils


notificationUtils?​

protected optional notificationUtils?: NotificationUtils

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

Inherited from​

BaseProfileRoute.notificationUtils


rateLimiter?​

protected optional rateLimiter?: RateLimiter

Defined in: auth/src/routes/BaseProfileRoute.ts:37

Inherited from​

BaseProfileRoute.rateLimiter


repoUtils?​

protected optional repoUtils?: RepoUtils<ProfileSQL>

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

The repository utility class to use for common operations.

Inherited from​

BaseProfileRoute.repoUtils


repoUtilsClass​

protected readonly repoUtilsClass: any

Defined in: auth/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​

BaseProfileRoute.repoUtilsClass


trackChanges​

protected trackChanges: number

Defined in: auth/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​

BaseProfileRoute.trackChanges


trustedRoles​

protected trustedRoles: string[]

Defined in: auth/src/routes/BaseProfileRoute.ts:28

Inherited from​

BaseProfileRoute.trustedRoles

Accessors​

modelClass​

Get Signature​

get modelClass(): any

Defined in: auth/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​

BaseProfileRoute.modelClass

Methods​

count()​

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

Defined in: auth/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​

BaseProfileRoute.count


create()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:45

Parameters​

obj​

ProfileSQL | ProfileSQL[]

req​

HttpRequest

user?​

JWTUser

Returns​

Promise<ProfileSQL | ProfileSQL[]>

Inherited from​

BaseProfileRoute.create


delete()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:72

This function is overridden because a Profile's uid is intentionally the same value as its owning User's uid. The generic per-document ACL system keys AccessControlList rows by bare uid with no per-class namespace, so a User and its own Profile permanently collide on the same ACL row: whichever one creates it first "owns" that row's parentUid, and the other's owner-grant can never actually take effect. A Profile is never shared with a third party, ownership is always exactly "is this the caller's own uid, or a trusted role". So operation verifies that directly (via resolveOwnedUid) and then bypasses the generic ACL check with ignoreACL.

Parameters​

id​

string

version​

string | undefined

purge​

string | undefined

req​

HttpRequest

user?​

JWTUser

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.delete


doBulkCreate()​

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

Defined in: auth/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<ProfileSQL>[]

The object(s) to store in the database.

options​

CreateRequestOptions

The options to process the request using.

Returns​

Promise<ProfileSQL[]>

Inherited from​

BaseProfileRoute.doBulkCreate


doBulkUpdate()​

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

Defined in: auth/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<ProfileSQL>[]

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

options​

UpdateRequestOptions<ProfileSQL>

The options to process the request using.

Returns​

Promise<ProfileSQL[]>

Inherited from​

BaseProfileRoute.doBulkUpdate


doCount()​

protected doCount(options): Promise<HttpResponse>

Defined in: auth/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​

BaseProfileRoute.doCount


doCreate()​

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

Defined in: auth/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<ProfileSQL> | Partial<ProfileSQL>[]

The object(s) to store in the database.

options​

CreateRequestOptions

The options to process the request using.

Returns​

Promise<ProfileSQL | ProfileSQL[]>

Inherited from​

BaseProfileRoute.doCreate


doCreateObject()​

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

Defined in: auth/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<ProfileSQL>

Inherited from​

BaseProfileRoute.doCreateObject


doDelete()​

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

Defined in: auth/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​

BaseProfileRoute.doDelete


doExists()​

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

Defined in: auth/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​

BaseProfileRoute.doExists


doFind()​

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

Defined in: auth/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<ProfileSQL[]>

Inherited from​

BaseProfileRoute.doFind


doFindById()​

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

Defined in: auth/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<ProfileSQL | null>

Inherited from​

BaseProfileRoute.doFindById


doTruncate()​

protected doTruncate(options): Promise<void>

Defined in: auth/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​

BaseProfileRoute.doTruncate


doUpdate()​

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

Defined in: auth/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<ProfileSQL>

The object to update in the database

options​

UpdateRequestOptions<ProfileSQL>

The options to process the request using.

Returns​

Promise<ProfileSQL>

Inherited from​

BaseProfileRoute.doUpdate


doUpdateProperty()​

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

Defined in: auth/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<ProfileSQL>

The options to process the request using.

Returns​

Promise<ProfileSQL>

Inherited from​

BaseProfileRoute.doUpdateProperty


exists()​

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

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

Parameters​

id​

string

query​

any

res​

HttpResponse

user?​

JWTUser

Returns​

Promise<any>

Inherited from​

BaseProfileRoute.exists


find()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:101

This function is overridden for the same reason as delete()/findById()/update(): a Profile's uid collides with its owning User's uid on the shared per-record ACL system, so it can't be relied on here either. Non-trusted callers are scoped directly to their own uid (Profile is never shared with a third party, so that's always exactly the caller's entire result set) and the generic ACL check is bypassed with ignoreACL.

Parameters​

params​

any

query​

any

user?​

JWTUser

Returns​

Promise<ProfileSQL[]>

Inherited from​

BaseProfileRoute.find


findById()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:134

This function is overridden because a Profile's uid is intentionally the same value as its owning User's uid. The generic per-document ACL system keys AccessControlList rows by bare uid with no per-class namespace, so a User and its own Profile permanently collide on the same ACL row: whichever one creates it first "owns" that row's parentUid, and the other's owner-grant can never actually take effect. A Profile is never shared with a third party, ownership is always exactly "is this the caller's own uid, or a trusted role". So operation verifies that directly (via resolveOwnedUid) and then bypasses the generic ACL check with ignoreACL.

Parameters​

id​

string

query​

any

user?​

JWTUser

Returns​

Promise<ProfileSQL | null>

Inherited from​

BaseProfileRoute.findById


requestVerificationCode()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:163

Requests a verification code be sent for the contact with the given value.

Parameters​

id​

string

The unique identifier of the Profile the contact belongs to.

contactId​

string

The contact value (e-mail/phone) to send a verification code to.

query​

any

req​

HttpRequest

The HTTP request being processed.

user​

JWTUser

The authenticated user making the request.

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.requestVerificationCode


resolveOwnedUid()​

protected resolveOwnedUid(id, user?): string

Defined in: auth/src/routes/BaseProfileRoute.ts:195

Resolves id (handling the "me" keyword) and verifies the caller either owns the targeted Profile (targetUid === user.uid) or holds a trusted role. Throws 401/403 otherwise.

Parameters​

id​

string

user?​

JWTUser

Returns​

string

Inherited from​

BaseProfileRoute.resolveOwnedUid


sendContactsVerification()​

protected sendContactsVerification(req, previous, next): Promise<void>

Defined in: auth/src/routes/BaseProfileRoute.ts:216

Sends a one-time verification code to any contact in next that is unverified and wasn't already present (by contact+type) in previous — i.e. a genuinely new, unverified addition, not a resave of an unrelated profile field. Mirrors BaseRegistrationRoute.start()'s OTP issuance.

NOTE: generateOTP's session state (req.session.id/secret/token) is a single unnamespaced slot shared with login-OTP and registration-OTP — if next contains more than one newly-added unverified contact, only the last one processed remains verifiable in this session. Callers are expected to add one contact at a time (matches this session's existing framework-wide limitation, not fixed here).

Parameters​

req​

HttpRequest

previous​

Contact[]

next​

Contact[]

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.sendContactsVerification


sendVerificationCode()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:231

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

Parameters​

contact​

Contact

req​

HttpRequest

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.sendVerificationCode


truncate()​

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

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

Parameters​

params​

any

query​

any

user?​

JWTUser

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.truncate


update()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:270

This function is overridden because a Profile's uid is intentionally the same value as its owning User's uid. The generic per-document ACL system keys AccessControlList rows by bare uid with no per-class namespace, so a User and its own Profile permanently collide on the same ACL row: whichever one creates it first "owns" that row's parentUid, and the other's owner-grant can never actually take effect. A Profile is never shared with a third party, ownership is always exactly "is this the caller's own uid, or a trusted role". So operation verifies that directly (via resolveOwnedUid) and then bypasses the generic ACL check with ignoreACL.

Parameters​

id​

string

obj​

UpdateObject<ProfileSQL>

req​

HttpRequest

user?​

JWTUser

Returns​

Promise<ProfileSQL>

Inherited from​

BaseProfileRoute.update


updateBulk()​

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

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

Parameters​

obj​

UpdateObject<ProfileSQL>[]

req​

HttpRequest

user?​

JWTUser

Returns​

Promise<ProfileSQL[]>

Inherited from​

BaseProfileRoute.updateBulk


updateProperty()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:418

Parameters​

id​

string

propertyName​

string

obj​

any

user?​

JWTUser

Returns​

Promise<ProfileSQL>

Inherited from​

BaseProfileRoute.updateProperty


validate()​

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

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

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

Parameters​

objs​

Partial<ProfileSQL> | Partial<ProfileSQL>[]

options?​

CreateRequestOptions | UpdateRequestOptions<ProfileSQL>

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.validate


validateCreate()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:366

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​

BaseProfileRoute.validateCreate


validateUpdate()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:388

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<ProfileSQL>

user?​

JWTUser

Returns​

Promise<void>

Inherited from​

BaseProfileRoute.validateUpdate


verifyContact()​

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

Defined in: auth/src/routes/BaseProfileRoute.ts:319

Verifies a pending contact using the one-time code sent automatically when it was added (see sendContactsVerification), flipping its verified flag to true. There is no separate "start"/resend endpoint — a caller who needs a fresh code removes and re-adds the contact via PUT /:id instead, which re-triggers the same send.

The contact value is taken from the request body rather than a :contact path segment deliberately: the uWS HTTP adapter's route-parameter extraction (getParameter()) does not URL-decode path segments the way this framework's query-string/cookie parsing does, so a contact containing @/+/etc. (i.e. every email or phone number) would arrive at the handler still percent-encoded and never match the stored value. Query/body values don't have this problem.

Parameters​

id​

string

obj​
contact?​

string

token?​

string

req​

HttpRequest

user?​

JWTUser

Returns​

Promise<ProfileSQL>

Inherited from​

BaseProfileRoute.verifyContact