Initial Commit
This commit is contained in:
18
src/user/user.service.ts
Normal file
18
src/user/user.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { generateId } from "../utils/id";
|
||||
import { CreateUserInput, userModel } from "./user.schema";
|
||||
|
||||
export async function createUser(input: CreateUserInput) {
|
||||
const user = await userModel.create({
|
||||
tenantId: "abc",
|
||||
pid: generateId(),
|
||||
createdAt: new Date(),
|
||||
...input,
|
||||
});
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
export async function getUser(userId: string) {
|
||||
const user = await userModel.findOne({ pid: userId });
|
||||
return user;
|
||||
}
|
||||
Reference in New Issue
Block a user