fireorm

Class: TransactionRepository ‹T

Type parameters

T: IEntity

Hierarchy

AbstractFirestoreRepository‹T›

TransactionRepository

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new TransactionRepository(pathOrConstructor: EntityConstructorOrPath‹T›, transaction: Transaction, tranRefStorage: ITransactionReferenceStorage): TransactionRepository

Overrides BaseFirestoreRepository.constructor

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:15

Parameters:

Name Type
pathOrConstructor EntityConstructorOrPath‹T›
transaction Transaction
tranRefStorage ITransactionReferenceStorage

Returns: TransactionRepository

Properties

Protected Readonly colMetadata

colMetadata: FullCollectionMetadata

Inherited from TransactionRepository.colMetadata

Defined in src/AbstractFirestoreRepository.ts:35


Protected Readonly config

config: MetadataStorageConfig

Inherited from TransactionRepository.config

Defined in src/AbstractFirestoreRepository.ts:37


Protected Readonly firestoreColRef

firestoreColRef: CollectionReference

Inherited from TransactionRepository.firestoreColRef

Defined in src/AbstractFirestoreRepository.ts:38


Protected Readonly path

path: string

Inherited from TransactionRepository.path

Defined in src/AbstractFirestoreRepository.ts:36


Private tranRefStorage

tranRefStorage: ITransactionReferenceStorage

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:19


Private transaction

transaction: Transaction

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:18

Methods

create

create(item: WithOptionalId‹T›): Promise‹T›

Overrides AbstractFirestoreRepository.create

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:47

Parameters:

Name Type
item WithOptionalId‹T›

Returns: Promise‹T›


delete

delete(id: string): Promise‹void›

Overrides AbstractFirestoreRepository.delete

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:83

Parameters:

Name Type
id string

Returns: Promise‹void›


execute

execute(queries: IFireOrmQueryLine[]): Promise‹T[]›

Overrides AbstractFirestoreRepository.execute

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:26

Parameters:

Name Type
queries IFireOrmQueryLine[]

Returns: Promise‹T[]›


Protected extractTFromColSnap

extractTFromColSnap(q: QuerySnapshot, tran?: Transaction, tranRefStorage?: ITransactionReferenceStorage): T[]

Inherited from TransactionRepository.extractTFromColSnap

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

Inherited from TransactionRepository.extractTFromDocSnap

Defined in src/AbstractFirestoreRepository.ts:114

Parameters:

Name Type
doc DocumentSnapshot
tran? Transaction
tranRefStorage? ITransactionReferenceStorage

Returns: T


find

find(): Promise‹T[]›

Inherited from TransactionRepository.find

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)


findById

findById(id: string): Promise‹T›

Overrides AbstractFirestoreRepository.findById

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:37

Parameters:

Name Type
id string

Returns: Promise‹T›


findOne

findOne(): *Promise‹T null›*

Inherited from TransactionRepository.findOne

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

Inherited from TransactionRepository.initializeSubCollections

Defined in src/AbstractFirestoreRepository.ts:83

Parameters:

Name Type
entity T
tran? Transaction
tranRefStorage? ITransactionReferenceStorage

Returns: void


limit

limit(): IQueryBuilder‹T›

Overrides BaseFirestoreRepository.limit

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:87

Returns: IQueryBuilder‹T›


orderByAscending

orderByAscending(): IQueryBuilder‹T›

Overrides BaseFirestoreRepository.orderByAscending

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:91

Returns: IQueryBuilder‹T›


orderByDescending

orderByDescending(): IQueryBuilder‹T›

Overrides BaseFirestoreRepository.orderByDescending

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:95

Returns: IQueryBuilder‹T›


Protected toSerializableObject

toSerializableObject(obj: T): Record‹string, unknown›

Inherited from TransactionRepository.toSerializableObject

Defined in src/AbstractFirestoreRepository.ts:61

Parameters:

Name Type
obj T

Returns: Record‹string, unknown›


Protected transformFirestoreTypes

transformFirestoreTypes(obj: Record‹string, unknown›): object

Inherited from TransactionRepository.transformFirestoreTypes

Defined in src/AbstractFirestoreRepository.ts:64

Parameters:

Name Type
obj Record‹string, unknown›

Returns: object


update

update(item: T): Promise‹T›

Overrides AbstractFirestoreRepository.update

Defined in src/Transaction/BaseFirestoreTransactionRepository.ts:68

Parameters:

Name Type
item T

Returns: Promise‹T›


validate

validate(item: T): Promise‹ValidationError[]›

Inherited from TransactionRepository.validate

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

whereArrayContains(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereArrayContains

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

whereArrayContainsAny(prop: IWherePropParam‹T›, val: IFirestoreVal[]): IQueryBuilder‹T›

Inherited from TransactionRepository.whereArrayContainsAny

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

whereEqualTo(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereEqualTo

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

whereGreaterOrEqualThan(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereGreaterOrEqualThan

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

whereGreaterThan(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereGreaterThan

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

whereIn(prop: IWherePropParam‹T›, val: IFirestoreVal[]): IQueryBuilder‹T›

Inherited from TransactionRepository.whereIn

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

whereLessOrEqualThan(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereLessOrEqualThan

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

whereLessThan(prop: IWherePropParam‹T›, val: IFirestoreVal): IQueryBuilder‹T›

Inherited from TransactionRepository.whereLessThan

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.