typeorm#ObjectID TypeScript Examples
The following examples show how to use
typeorm#ObjectID.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NotificationsRepository.ts From hotseat-api with MIT License | 6 votes |
public async updateReadStatus(
id: ObjectID,
): Promise<Notification | undefined> {
const notification = await this.ormRepository.findOne(id);
if (!notification) {
return undefined;
}
notification.read = true;
await this.ormRepository.save(notification);
return notification;
}
Example #2
Source File: OCKContact.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #3
Source File: Notification.ts From GoBarber with MIT License | 5 votes |
@ObjectIdColumn()
id: ObjectID;
Example #4
Source File: Notification.ts From gobarber-project with MIT License | 5 votes |
@ObjectIdColumn()
id: ObjectID;
Example #5
Source File: uuid.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #6
Source File: User.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
id: ObjectID;
Example #7
Source File: OCKTask.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #8
Source File: OCKRevisionRecord.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #9
Source File: OCKPatient.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #10
Source File: OCKOutcome.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #11
Source File: Notification.ts From gobarber-api with MIT License | 5 votes |
@ObjectIdColumn()
id: ObjectID;
Example #12
Source File: OCKCarePlan.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #13
Source File: KnowledgeVector.ts From IBM-HyperProtectMBaaS with BSD 3-Clause "New" or "Revised" License | 5 votes |
@ObjectIdColumn()
_id: ObjectID;
Example #14
Source File: polymorphic.repository.ts From typeorm-polymorphic with MIT License | 5 votes |
public async findOne(
idOrOptionsOrConditions?:
| string
| number
| Date
| ObjectID
| FindConditions<E>
| FindOneOptions<E>,
optionsOrConditions?: FindConditions<E> | FindOneOptions<E>,
): Promise<E | undefined> {
const polymorphicMetadata = this.getPolymorphicMetadata();
if (Object.keys(polymorphicMetadata).length === 0) {
return idOrOptionsOrConditions &&
(typeof idOrOptionsOrConditions === 'string' ||
typeof idOrOptionsOrConditions === 'number' ||
typeof idOrOptionsOrConditions === 'object') &&
optionsOrConditions
? super.findOne(
idOrOptionsOrConditions as number | string | ObjectID | Date,
optionsOrConditions as FindConditions<E> | FindOneOptions<E>,
)
: super.findOne(
idOrOptionsOrConditions as FindConditions<E> | FindOneOptions<E>,
);
}
const entity =
idOrOptionsOrConditions &&
(typeof idOrOptionsOrConditions === 'string' ||
typeof idOrOptionsOrConditions === 'number' ||
typeof idOrOptionsOrConditions === 'object') &&
optionsOrConditions
? await super.findOne(
idOrOptionsOrConditions as number | string | ObjectID | Date,
optionsOrConditions as FindConditions<E> | FindOneOptions<E>,
)
: await super.findOne(
idOrOptionsOrConditions as FindConditions<E> | FindOneOptions<E>,
);
if (!entity) {
return entity;
}
return this.hydratePolymorphs(entity, polymorphicMetadata);
}
Example #15
Source File: polymorphic.repository.ts From typeorm-polymorphic with MIT License | 5 votes |
findOne(
id?: string | number | Date | ObjectID,
options?: FindOneOptions<E>,
): Promise<E | undefined>;
Example #16
Source File: Notification.ts From hotseat-api with MIT License | 5 votes |
@ObjectIdColumn()
id: ObjectID;
Example #17
Source File: NotificationsRepository.ts From hotseat-api with MIT License | 5 votes |
public async findById(id: ObjectID): Promise<Notification | undefined> {
const notification = await this.ormRepository.findOne(id);
return notification;
}