mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-12 07:32:41 +00:00
multiple usernames
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AuthRepository } from '../auth/adapters/secondaries/auth.repository';
|
||||
import { UsernameRepository } from '../auth/adapters/secondaries/username.repository';
|
||||
import { PrismaService } from './src/adapters/secondaries/prisma-service';
|
||||
|
||||
@Module({
|
||||
providers: [PrismaService, AuthRepository],
|
||||
exports: [PrismaService, AuthRepository],
|
||||
providers: [PrismaService, AuthRepository, UsernameRepository],
|
||||
exports: [PrismaService, AuthRepository, UsernameRepository],
|
||||
})
|
||||
export class DatabaseModule {}
|
||||
|
||||
@@ -143,14 +143,15 @@ export abstract class PrismaRepository<T> implements IRepository<T> {
|
||||
}
|
||||
}
|
||||
|
||||
async delete(uuid: string): Promise<void> {
|
||||
async delete(where: any): Promise<void> {
|
||||
try {
|
||||
const entity = await this._prisma[this._model].delete({
|
||||
where: { uuid },
|
||||
where: where,
|
||||
});
|
||||
|
||||
return entity;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
if (e instanceof PrismaClientKnownRequestError) {
|
||||
throw new DatabaseException(
|
||||
PrismaClientKnownRequestError.name,
|
||||
|
||||
@@ -217,7 +217,7 @@ describe('PrismaRepository', () => {
|
||||
const savedUuid = fakeEntities[0].uuid;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const res = await fakeRepository.delete(savedUuid);
|
||||
const res = await fakeRepository.delete({ uuid: savedUuid });
|
||||
|
||||
const deletedEntity = fakeEntities.find(
|
||||
(entity) => entity.uuid === savedUuid,
|
||||
|
||||
Reference in New Issue
Block a user