53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
import { Document, Types } from 'mongoose';
|
|
import { ObjectType, Field, ID, Float } from '@nestjs/graphql';
|
|
import { Base } from '@/models/base.model';
|
|
|
|
@ObjectType()
|
|
@Schema({ timestamps: true })
|
|
export class BuildAddress extends Base {
|
|
|
|
@Field(() => ID)
|
|
readonly _id: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
buildNumber: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
doorNumber: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
floorNumber: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
commentAddress: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
letterAddress: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
shortLetterAddress: string;
|
|
|
|
@Field(() => Float)
|
|
@Prop({ required: true })
|
|
latitude: number;
|
|
|
|
@Field(() => Float)
|
|
@Prop({ required: true })
|
|
longitude: number;
|
|
|
|
@Field(() => ID, { nullable: true })
|
|
@Prop({ type: Types.ObjectId, ref: 'Street', required: false })
|
|
street?: Types.ObjectId;
|
|
|
|
}
|
|
|
|
export type BuildAddressDocument = BuildAddress & Document;
|
|
export const BuildAddressSchema = SchemaFactory.createForClass(BuildAddress);
|