Merge branch 'fakeToPush' into 'main'

minor refactor

See merge request v3/services/auth!9
This commit is contained in:
Sylvain Briat 2023-01-27 16:01:32 +00:00
commit a707dfbc28
4 changed files with 2 additions and 4 deletions

View File

@ -74,8 +74,6 @@ export abstract class PrismaRepository<T> implements IRepository<T> {
} }
} }
// TODO : using any is not good, but needed for nested entities
// TODO : Refactor for good clean architecture ?
async create(entity: Partial<T> | any, include?: any): Promise<T> { async create(entity: Partial<T> | any, include?: any): Promise<T> {
try { try {
const res = await this._prisma[this._model].create({ const res = await this._prisma[this._model].create({
@ -143,7 +141,7 @@ export abstract class PrismaRepository<T> implements IRepository<T> {
} }
} }
async delete(uuid: string): Promise<void> { async delete(uuid: string): Promise<T> {
try { try {
const entity = await this._prisma[this._model].delete({ const entity = await this._prisma[this._model].delete({
where: { uuid }, where: { uuid },

View File

@ -12,6 +12,6 @@ export interface IRepository<T> {
create(entity: Partial<T> | any, include?: any): Promise<T>; create(entity: Partial<T> | any, include?: any): Promise<T>;
update(uuid: string, entity: Partial<T>, include?: any): Promise<T>; update(uuid: string, entity: Partial<T>, include?: any): Promise<T>;
updateWhere(where: any, entity: Partial<T> | any, include?: any): Promise<T>; updateWhere(where: any, entity: Partial<T> | any, include?: any): Promise<T>;
delete(uuid: string): Promise<void>; delete(uuid: string): Promise<T>;
deleteMany(where: any): Promise<void>; deleteMany(where: any): Promise<void>;
} }