bex-twn/src/resident/resident.service.ts

18 lines
599 B
TypeScript

import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { Resident, ResidentDocument } from './schemas/Resident.schema';
import { ResidentAddress } from './schemas/ResidentAddress.schema';
@Injectable()
export class ResidentService {
constructor(
@InjectModel(Resident.name) private residentModel: Model<ResidentDocument>,
) {}
public async createResident(resident: Partial<Resident>): Promise<Resident> {
const createdResident = new this.residentModel(resident);
return createdResident.save();
}
}