persona_services > PersonaStatRoute

Class: PersonaStatRoute

Handles all REST API requests for the endpoint /personas/stats.

author: Jean-Philippe Steinmetz info@acceleratxr.com

Hierarchy

ModelRoute<PersonaStat>

↳ PersonaStatRoute

Index

Constructors

Properties

Methods


Constructors

constructor

new PersonaStatRoute(): PersonaStatRoute

Overrides ModelRoute.__constructor

Defined in routes/PersonaStatRoute.ts:50

Initializes a new instance with the specified defaults.

Returns: PersonaStatRoute


Properties

<Protected> config

● config: any

Defined in routes/PersonaStatRoute.ts:38


<Protected> logger

● logger: any

Defined in routes/PersonaStatRoute.ts:41


<Protected><Optional> personaRepo

● personaRepo: Repo<Persona>

Defined in routes/PersonaStatRoute.ts:47


<Protected><Optional> repo

● repo: Repo<PersonaStat>

Overrides ModelRoute.repo

Defined in routes/PersonaStatRoute.ts:44


<Protected><Optional> statDefRepo

● statDefRepo: Repo<PersonaStatDefinition>

Defined in routes/PersonaStatRoute.ts:50


Methods

<Private> canEdit

canEdit(persona: Persona, obj: PersonaStat, user: JWTUser): boolean

Defined in routes/PersonaStatRoute.ts:66

Returns true if the user is allowed to create or modify the given PersonaStat object.

Parameters:

Name Type Description
persona Persona The `Persona` object taht owns the `PersonaStat`.
obj PersonaStat The `PersonaStat` object to validate.
user JWTUser The user to check has permission to perform the create or modify operation.

Returns: boolean


<Private> count

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

Defined in routes/PersonaStatRoute.ts:158

Returns the count of persona stats

Parameters:

Name Type
params any
query any
Optional user JWTUser

Returns: Promise<Count>


<Private> create

create(obj: PersonaStat, user?: JWTUser): Promise<PersonaStat>

Defined in routes/PersonaStatRoute.ts:123

Create a new stat for an persona

Parameters:

Name Type
obj PersonaStat
Optional user JWTUser

Returns: Promise<PersonaStat>


<Private> delete

delete(id: string, user?: JWTUser): Promise<void>

Defined in routes/PersonaStatRoute.ts:220

Deletes the persona stat

Parameters:

Name Type
id string
Optional user JWTUser

Returns: Promise<void>


<Private> deleteByPersonaId

deleteByPersonaId(personaUid: string, statUid: string, user?: JWTUser): Promise<void>

Defined in routes/PersonaStatRoute.ts:323

Deletes the persona stat

Parameters:

Name Type
personaUid string
statUid string
Optional user JWTUser

Returns: Promise<void>


<Protected> doCount

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

Inherited from ModelRoute.doCount

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:31

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 result property of the res argument. result is never null.

Parameters:

Name Type
params any
query any
Optional user any

Returns: Promise<any>


<Protected> doCreate

doCreate(obj: PersonaStat, user?: any): Promise<PersonaStat>

Inherited from ModelRoute.doCreate

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:37

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

Parameters:

Name Type
obj PersonaStat
Optional user any

Returns: Promise<PersonaStat>


<Protected> doDelete

doDelete(id: string, user?: any): Promise<void>

Inherited from ModelRoute.doDelete

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:42

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

Parameters:

Name Type
id string
Optional user any

Returns: Promise<void>


<Protected> doFindAll

doFindAll(params: any, query: any, user?: any): Promise<PersonaStat[]>

Inherited from ModelRoute.doFindAll

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:52

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:

Name Type
params any
query any
Optional user any

Returns: Promise<PersonaStat[]>


<Protected> doFindById

doFindById(id: string, user?: any): Promise<PersonaStat | undefined>

Inherited from ModelRoute.doFindById

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:60

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

Parameters:

Name Type
id string
Optional user any

Returns: Promise<PersonaStat | undefined>


<Protected> doTruncate

doTruncate(user?: any): Promise<void>

Inherited from ModelRoute.doTruncate

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:66

Attempts to remove all entries of the data model type from the datastore.

Parameters:

Name Type Description
Optional user any The authenticated user performing the action, otherwise undefined.

Returns: Promise<void>


<Protected> doUpdate

doUpdate(id: string, obj: PersonaStat, user?: any): Promise<PersonaStat>

Inherited from ModelRoute.doUpdate

Defined in C:/Users/jpsaxr/gitlab/persona_services/node_modules/@acceleratxr/services_common/dist/types/routes/ModelRoute.d.ts:74

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

Parameters:

Name Type
id string
obj PersonaStat
Optional user any

Returns: Promise<PersonaStat>


<Private> findAll

findAll(params: any, query: any, user?: JWTUser): Promise<Array<PersonaStat>>

Defined in routes/PersonaStatRoute.ts:110

Returns all persona stats from the system that the user has access to

Parameters:

Name Type
params any
query any
Optional user JWTUser

Returns: Promise<Array<PersonaStat>>


<Private> findAllByPersonaId

findAllByPersonaId(params: any, query: any, user?: JWTUser): Promise<Array<PersonaStat>>

Defined in routes/PersonaStatRoute.ts:249

Returns all persona stats from the system that the user has access to

Parameters:

Name Type
params any
query any
Optional user JWTUser

Returns: Promise<Array<PersonaStat>>


<Private> findById

findById(id: string, user?: JWTUser): Promise<PersonaStat>

Defined in routes/PersonaStatRoute.ts:167

Returns a single persona stat from the system that the user has access to

Parameters:

Name Type
id string
Optional user JWTUser

Returns: Promise<PersonaStat>


<Private> findByIdAndPersonaId

findByIdAndPersonaId(statUid: string, user?: JWTUser): Promise<PersonaStat>

Defined in routes/PersonaStatRoute.ts:262

Returns a single persona stat from the system that the user has access to

Parameters:

Name Type
statUid string
Optional user JWTUser

Returns: Promise<PersonaStat>


<Private> initialize

initialize(): Promise<void>

Defined in routes/PersonaStatRoute.ts:80

Called on server startup to initialize the route with any defaults.

Returns: Promise<void>


<Private> update

update(id: string, obj: PersonaStat, user?: JWTUser): Promise<PersonaStat>

Defined in routes/PersonaStatRoute.ts:176

Updates a single persona stat

Parameters:

Name Type
id string
obj PersonaStat
Optional user JWTUser

Returns: Promise<PersonaStat>


<Private> updateByPersonaId

updateByPersonaId(personaUid: string, statUid: string, obj: PersonaStat, user?: JWTUser): Promise<PersonaStat>

Defined in routes/PersonaStatRoute.ts:274

Updates a single persona stat

Parameters:

Name Type
personaUid string
statUid string
obj PersonaStat
Optional user JWTUser

Returns: Promise<PersonaStat>


<Private> validate

validate(def: PersonaStatDefinition, obj: PersonaStat): void

Defined in routes/PersonaStatRoute.ts:90

Validates that the provided PersonaStat object is valid.

throws: An error if the validation check fails

Parameters:

Name Type Description
def PersonaStatDefinition The definition of the stat to validate against.
obj PersonaStat The stat to validate.

Returns: void