▪ T: IEntity
↳ AbstractFirestoreRepository
+ new AbstractFirestoreRepository(pathOrConstructor : string |
IEntityConstructor): AbstractFirestoreRepository |
Defined in src/AbstractFirestoreRepository.ts:38
Parameters:
Name | Type |
---|---|
pathOrConstructor |
string | IEntityConstructor |
Returns: AbstractFirestoreRepository
Protected
Readonly
colMetadata• colMetadata: FullCollectionMetadata
Defined in src/AbstractFirestoreRepository.ts:35
Protected
Readonly
config• config: MetadataStorageConfig
Defined in src/AbstractFirestoreRepository.ts:37
Protected
Readonly
firestoreColRef• firestoreColRef: CollectionReference
Defined in src/AbstractFirestoreRepository.ts:38
Protected
Readonly
path• path: string
Defined in src/AbstractFirestoreRepository.ts:36
Abstract
create▸ create(item
: PartialBy‹T, “id”›): Promise‹T›
Defined in src/AbstractFirestoreRepository.ts:398
Creates a document. If no id is passed, is automatically generated. Must be implemented by base repositores
abstract
memberof
AbstractFirestoreRepository
Parameters:
Name | Type |
---|---|
item |
PartialBy‹T, “id”› |
Returns: Promise‹T›
Abstract
delete▸ delete(id
: string): Promise‹void›
Defined in src/AbstractFirestoreRepository.ts:420
Deletes a document. Must be implemented by base repositores
abstract
memberof
AbstractFirestoreRepository
Parameters:
Name | Type |
---|---|
id |
string |
Returns: Promise‹void›
Abstract
execute▸ execute(queries
: IFireOrmQueryLine[], limitVal?
: number, orderByObj?
: IOrderByParams, single?
: boolean): Promise‹T[]›
Defined in src/AbstractFirestoreRepository.ts:370
Takes all the queries stored by QueryBuilder and executes them. Must be implemented by base repositores
abstract
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
queries |
IFireOrmQueryLine[] | list of queries stored in QueryBuilder |
limitVal? |
number | - |
orderByObj? |
IOrderByParams | - |
single? |
boolean | - |
Returns: Promise‹T[]›
results from firestore converted into
entities
Protected
extractTFromColSnap▸ extractTFromColSnap(q
: QuerySnapshot, tran?
: Transaction, tranRefStorage?
: ITransactionReferenceStorage): T[]
Defined in src/AbstractFirestoreRepository.ts:129
Parameters:
Name | Type |
---|---|
q |
QuerySnapshot |
tran? |
Transaction |
tranRefStorage? |
ITransactionReferenceStorage |
Returns: T[]
Protected
extractTFromDocSnap▸ extractTFromDocSnap(doc
: DocumentSnapshot, tran?
: Transaction, tranRefStorage?
: ITransactionReferenceStorage): T
Defined in src/AbstractFirestoreRepository.ts:114
Parameters:
Name | Type |
---|---|
doc |
DocumentSnapshot |
tran? |
Transaction |
tranRefStorage? |
ITransactionReferenceStorage |
Returns: T
▸ find(): Promise‹T[]›
Defined in src/AbstractFirestoreRepository.ts:310
Execute the query and applies all the filters (if specified)
memberof
AbstractFirestoreRepository
Returns: Promise‹T[]›
List of documents that matched the filters (if specified)
Abstract
findById▸ findById(id : string): *Promise‹T |
null›* |
Defined in src/AbstractFirestoreRepository.ts:386
Retrieve a document with the specified id. Must be implemented by base repositores
abstract
memberof
AbstractFirestoreRepository
Parameters:
Name | Type |
---|---|
id |
string |
Returns: *Promise‹T | null›* |
▸ findOne(): *Promise‹T | null›* |
Defined in src/AbstractFirestoreRepository.ts:323
Execute the query to find at least one document matching all filters (if specified)
memberof
AbstractFirestoreRepository
Returns: *Promise‹T | null›* |
One document that matched the filters (if specified), or null if none exists.
Protected
initializeSubCollections▸ initializeSubCollections(entity
: T, tran?
: Transaction, tranRefStorage?
: ITransactionReferenceStorage): void
Defined in src/AbstractFirestoreRepository.ts:83
Parameters:
Name | Type |
---|---|
entity |
T |
tran? |
Transaction |
tranRefStorage? |
ITransactionReferenceStorage |
Returns: void
▸ limit(limitVal
: number): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:267
Returns a new QueryBuilder with a maximum number of results to return. Can only be used once per query.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
limitVal |
number | maximum number of results to return Must be greater or equal than 0 |
Returns: IQueryBuilder‹T›
QueryBuilder A new QueryBuilder with the specified limit applied
▸ orderByAscending(prop
: IWherePropParam‹T›): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:285
Returns a new QueryBuilder with an additional ascending order specified by @param prop. Can only be used once per query.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be ordered on, where prop could be keyof T or a lambda where T is the first parameter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified ordering applied.
▸ orderByDescending(prop
: IWherePropParam‹T›): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:299
Returns a new QueryBuilder with an additional descending order specified by @param prop. Can only be used once per query.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be ordered on, where prop could be keyof T or a lambda where T is the first parameter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified ordering applied.
Protected
toSerializableObject▸ toSerializableObject(obj
: T): Record‹string, unknown›
Defined in src/AbstractFirestoreRepository.ts:61
Parameters:
Name | Type |
---|---|
obj |
T |
Returns: Record‹string, unknown›
Protected
transformFirestoreTypes▸ transformFirestoreTypes(obj
: Record‹string, unknown›): object
Defined in src/AbstractFirestoreRepository.ts:64
Parameters:
Name | Type |
---|---|
obj |
Record‹string, unknown› |
Returns: object
Abstract
update▸ update(item
: T): Promise‹T›
Defined in src/AbstractFirestoreRepository.ts:409
Updates a document. Must be implemented by base repositores
abstract
memberof
AbstractFirestoreRepository
Parameters:
Name | Type |
---|---|
item |
T |
Returns: Promise‹T›
▸ validate(item
: T): Promise‹ValidationError[]›
Defined in src/AbstractFirestoreRepository.ts:333
Uses class-validator to validate an entity using decorators set in the collection class
Parameters:
Name | Type | Description |
---|---|---|
item |
T | class or object representing an entity |
Returns: Promise‹ValidationError[]›
An array of class-validator errors
▸ whereArrayContains(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:223
Returns a new QueryBuilder with a filter specifying that the value in @param val must be contained in @param prop.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereArrayContainsAny(prop
: IWherePropParam‹T›, val
: IFirestoreVal[]): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:238
Returns a new QueryBuilder with a filter specifying that the field @param prop is an array that contains one or more of the comparison values in @param val
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal[] | array of values to compare in the filter (max 10 items in array) |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereEqualTo(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:148
Returns a new QueryBuilder with a filter specifying that the value in @param prop must be equal to @param val.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereGreaterOrEqualThan(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:178
Returns a new QueryBuilder with a filter specifying that the value in @param prop must be greater or equal than @param val.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereGreaterThan(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:163
Returns a new QueryBuilder with a filter specifying that the value in @param prop must be greater than @param val.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereIn(prop
: IWherePropParam‹T›, val
: IFirestoreVal[]): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:253
Returns a new QueryBuilder with a filter specifying that the field @param prop matches any of the comparison values in @param val
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal[] | - |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereLessOrEqualThan(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:208
Returns a new QueryBuilder with a filter specifying that the value in @param prop must be less or equal than @param val.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.
▸ whereLessThan(prop
: IWherePropParam‹T›, val
: IFirestoreVal): IQueryBuilder‹T›
Defined in src/AbstractFirestoreRepository.ts:193
Returns a new QueryBuilder with a filter specifying that the value in @param prop must be less than @param val.
memberof
AbstractFirestoreRepository
Parameters:
Name | Type | Description |
---|---|---|
prop |
IWherePropParam‹T› | field to be filtered on, where prop could be keyof T or a lambda where T is the first parameter |
val |
IFirestoreVal | value to compare in the filter |
Returns: IQueryBuilder‹T›
A new QueryBuilder with the specified query applied.