41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import mongoose, { Schema, models, Document, Model } from "mongoose";
|
|
import { Base } from "./base";
|
|
|
|
interface IPerson extends Base, Document {
|
|
firstName: string;
|
|
surname: string;
|
|
middleName: string;
|
|
sexCode: string;
|
|
personRef: string;
|
|
personTag: string;
|
|
fatherName: string;
|
|
motherName: string;
|
|
countryCode: string;
|
|
nationalIdentityId: string;
|
|
birthPlace: string;
|
|
birthDate: Date;
|
|
taxNo: string;
|
|
birthname: string;
|
|
}
|
|
|
|
const PersonSchema = new Schema<IPerson>({
|
|
firstName: { type: String, required: true },
|
|
surname: { type: String, required: true },
|
|
middleName: { type: String, required: true },
|
|
sexCode: { type: String, required: true },
|
|
personRef: { type: String, required: true },
|
|
personTag: { type: String, required: true },
|
|
fatherName: { type: String, required: true },
|
|
motherName: { type: String, required: true },
|
|
countryCode: { type: String, required: true },
|
|
nationalIdentityId: { type: String, required: true },
|
|
birthPlace: { type: String, required: true },
|
|
birthDate: { type: Date, required: true },
|
|
taxNo: { type: String, required: true },
|
|
birthname: { type: String, required: true },
|
|
});
|
|
|
|
const Person: Model<IPerson> = models.Person || mongoose.model<IPerson>("Person", PersonSchema);
|
|
|
|
export { Person };
|
|
export type { IPerson } |