forked from Yara724/api
24 lines
703 B
TypeScript
24 lines
703 B
TypeScript
import { InjectModel } from "@nestjs/mongoose";
|
|
import { Model, Types } from "mongoose";
|
|
import { UserSignModel } from "../schema/sign.schema";
|
|
|
|
export class UserSignDbService {
|
|
constructor(
|
|
@InjectModel(UserSignModel.name)
|
|
private readonly blameVoiceModel: Model<UserSignModel>,
|
|
) {}
|
|
|
|
async create(sign: UserSignModel): Promise<UserSignModel> {
|
|
return await this.blameVoiceModel.create(sign);
|
|
}
|
|
|
|
async findOne(id: string): Promise<UserSignModel> {
|
|
return await this.blameVoiceModel.findOne(new Types.ObjectId(id));
|
|
}
|
|
|
|
async findById(id: string): Promise<UserSignModel | null> {
|
|
// Use your correct Model type
|
|
return this.blameVoiceModel.findById(id).lean();
|
|
}
|
|
}
|