93 lines
2.1 KiB
TypeScript
93 lines
2.1 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
import { HydratedDocument } from 'mongoose';
|
|
import { Industry } from 'src/enums/industry.enum';
|
|
import { RegulatoryElection } from 'src/enums/regulatory-election.enums';
|
|
import { ResidentStatus } from 'src/enums/status.enum';
|
|
import {
|
|
TypeOfRegistration,
|
|
TypeOfRegistrationSub,
|
|
} from 'src/enums/type-of-registration.enums';
|
|
import { ResidentAddress } from './ResidentAddress.schema';
|
|
|
|
export type ResidentDocument = HydratedDocument<Resident>;
|
|
|
|
@Schema()
|
|
export class Resident {
|
|
@Prop({ required: true, unique: true })
|
|
sub: string;
|
|
|
|
@Prop({ required: true })
|
|
firstName: string;
|
|
|
|
@Prop({ required: true })
|
|
lastName: string;
|
|
|
|
@Prop({ required: true })
|
|
fullName: string;
|
|
|
|
@Prop({ required: true })
|
|
permitNumber: number;
|
|
|
|
@Prop()
|
|
permitNumberQrCode: string;
|
|
|
|
@Prop({ required: true })
|
|
dateOfBirth: Date;
|
|
|
|
@Prop({ required: true })
|
|
countryOfBirth: string;
|
|
|
|
@Prop({ required: true })
|
|
email: string;
|
|
|
|
@Prop({ required: true })
|
|
citizenship: string;
|
|
|
|
@Prop({ required: true })
|
|
gender: string;
|
|
|
|
@Prop({
|
|
type: ResidentAddress,
|
|
required: true,
|
|
})
|
|
address: ResidentAddress;
|
|
|
|
@Prop({ required: true })
|
|
phoneNumber: string;
|
|
|
|
@Prop({ required: true, type: String, enum: TypeOfRegistration })
|
|
typeOfRegistration: TypeOfRegistration;
|
|
|
|
@Prop({ type: String, enum: TypeOfRegistrationSub })
|
|
typeOfRegistrationSub: TypeOfRegistrationSub;
|
|
|
|
@Prop({ type: String, enum: Industry })
|
|
industry: Industry;
|
|
|
|
@Prop({ required: true })
|
|
willWorkInPhysicalJurisdiction: boolean;
|
|
|
|
@Prop({ type: String, enum: RegulatoryElection })
|
|
regulatoryElection: RegulatoryElection;
|
|
|
|
@Prop()
|
|
regulatoryElectionSub: string;
|
|
|
|
@Prop({ required: true })
|
|
firstRegistrationDate: Date;
|
|
|
|
@Prop({ required: true })
|
|
nextSubscriptionPaymentDate: Date;
|
|
|
|
@Prop({ required: true })
|
|
profilePicture: string;
|
|
|
|
@Prop({ required: true, type: String, enum: ResidentStatus })
|
|
status: ResidentStatus;
|
|
|
|
@Prop()
|
|
residencyEndDate: Date;
|
|
}
|
|
|
|
export const ResidentSchema = SchemaFactory.createForClass(Resident);
|