optimized schema
This commit is contained in:
parent
5f34171a4a
commit
1f4ddfa10b
@ -30,7 +30,7 @@ export class CreateFieldDto {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|
||||||
@ApiPropertyOptional({ type: [String], example: ['Very Satisfied', 'Satisfied'] })
|
@ApiPropertyOptional({ type: [String], example: ['Very Satisfied', 'Satisfied']})
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@IsString({ each: true })
|
@IsString({ each: true })
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import { PaginatedResponse } from 'src/interfaces/paginated-response.interface';
|
|||||||
import { LlmService } from 'src/common/services/llm.service';
|
import { LlmService } from 'src/common/services/llm.service';
|
||||||
import { CreateFormDto } from './dto/create-form.dto';
|
import { CreateFormDto } from './dto/create-form.dto';
|
||||||
import { CreateFieldDto } from './dto/create-field.dto';
|
import { CreateFieldDto } from './dto/create-field.dto';
|
||||||
import { threadCpuUsage } from 'process';
|
|
||||||
|
|
||||||
// Reusable projections
|
// Reusable projections
|
||||||
const LIST_PROJECTION = {
|
const LIST_PROJECTION = {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|||||||
import { Document } from 'mongoose';
|
import { Document } from 'mongoose';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
|
|
||||||
import { PARENT_TYPE_KEYS, INPUT_SUB_TYPE_KEYS } from '../types/field.type';
|
import { PARENT_TYPE_KEYS, INPUT_SUB_TYPE_KEYS } from '../types/field.type';
|
||||||
import type { ParentKeyType, InputSubType } from '../types/field.type';
|
import type { ParentKeyType, InputSubType } from '../types/field.type';
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ export type FieldDocument = Field & Document;
|
|||||||
|
|
||||||
@Schema({ timestamps: true })
|
@Schema({ timestamps: true })
|
||||||
export class Field {
|
export class Field {
|
||||||
@Prop({ required: true, unique:true, default:()=>uuidv4()})
|
@Prop({ required: true, unique: true, default: () => uuidv4() })
|
||||||
id!: string;
|
id!: string;
|
||||||
|
|
||||||
@Prop({ required: true, enum: PARENT_TYPE_KEYS })
|
@Prop({ required: true, enum: PARENT_TYPE_KEYS })
|
||||||
@ -28,7 +27,7 @@ export class Field {
|
|||||||
@Prop({ required: false })
|
@Prop({ required: false })
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|
||||||
@Prop({ required: false })
|
@Prop({ required: false, default: undefined })
|
||||||
options?: string[];
|
options?: string[];
|
||||||
|
|
||||||
@Prop({ required: true, default: false })
|
@Prop({ required: true, default: false })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user