refactor(backend): Functions
This commit is contained in:
parent
5ec62554e3
commit
65c1a5e6b6
57 changed files with 172 additions and 117 deletions
|
@ -1,12 +1,12 @@
|
|||
import { EntityRepository, FilterQuery } from '@mikro-orm/core';
|
||||
|
||||
export abstract class DwengoEntityRepository<T extends object> extends EntityRepository<T> {
|
||||
public async save(entity: T) {
|
||||
public async save(entity: T): Promise<void> {
|
||||
const em = this.getEntityManager();
|
||||
em.persist(entity);
|
||||
await em.flush();
|
||||
}
|
||||
public async deleteWhere(query: FilterQuery<T>) {
|
||||
public async deleteWhere(query: FilterQuery<T>): Promise<void> {
|
||||
const toDelete = await this.findOne(query);
|
||||
const em = this.getEntityManager();
|
||||
if (toDelete) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue