fixing in user and authentication
This commit is contained in:
17
src/modules/user/repositories/createUser.repository.ts
Normal file
17
src/modules/user/repositories/createUser.repository.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { userModel } from "../user.model";
|
||||
|
||||
export const createUserRepo = async (data: Prisma.UserCreateInput) => {
|
||||
try {
|
||||
const userData = await userModel.create({
|
||||
data,
|
||||
omit: {
|
||||
password: true,
|
||||
},
|
||||
});
|
||||
|
||||
return userData;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@ -1,4 +1,4 @@
|
||||
import { AppError } from "../../../helpers/error/handler";
|
||||
import { AppError } from "../../../helpers/error/instances/app";
|
||||
import { userModel } from "../user.model";
|
||||
|
||||
export const findUserByEmailOrUsernameRepo = async (identifier: string) => {
|
||||
|
||||
15
src/modules/user/repositories/getAllUser.repository.ts
Normal file
15
src/modules/user/repositories/getAllUser.repository.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { userModel } from "../user.model";
|
||||
|
||||
export const getAllUserRepo = async () => {
|
||||
try {
|
||||
const data = await userModel.findMany({
|
||||
where: {
|
||||
deletedAt: null,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user