updated graphql dtos & build and it depends
This commit is contained in:
@@ -1,51 +1,74 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
import { ObjectType, Field, ID, GraphQLISODateTime } from '@nestjs/graphql';
|
||||
import { Base } from '@/models/base.model';
|
||||
|
||||
@Schema({ timestamps: true })
|
||||
@ObjectType()
|
||||
export class Person extends Base {
|
||||
|
||||
@Field(() => ID)
|
||||
_id: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
firstName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
surname: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
middleName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
sexCode: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
personRef: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
personTag: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
fatherName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
motherName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
countryCode: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Prop({ required: true, unique: true })
|
||||
@Field()
|
||||
nationalIdentityId: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
birthPlace: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field(() => GraphQLISODateTime)
|
||||
birthDate: Date;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
taxNo: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
birthname: string;
|
||||
}
|
||||
|
||||
export type PersonDocument = Person & Document;
|
||||
export const PersonSchema = SchemaFactory.createForClass(Person);
|
||||
|
||||
// PersonSchema.index({ firstName: 1, surname: 1, middleName: 1 }, { unique: true });
|
||||
// PersonSchema.index({ nationalIdentityId: 1 }, { unique: true });
|
||||
|
||||
Reference in New Issue
Block a user