Skip to content

Commit 7839153

Browse files
Refactor form and logger schemas
1 parent ed05680 commit 7839153

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

src/core/form/_dto/form.dto.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
1-
import { MixedValue } from './../../../_common/types/mixed-value.type'
2-
import { Mixed } from 'mongoose'
3-
import { ApiProperty, PartialType } from '@nestjs/swagger'
4-
import { IsString, IsEnum, IsObject, ValidateNested, IsOptional, IsMongoId } from 'class-validator'
5-
import { ObjectId } from 'mongodb'
6-
import { MixedValue } from '~/_common/types/mixed-value.type'
7-
import { FormTypeList, FormTypes } from '../_enum/types'
8-
import { MetadataDto } from '~/_common/abstracts/dto/metadata.dto'
9-
import { forwardRef } from '@nestjs/common'
10-
import { Type } from 'class-transformer'
11-
import { FormSectionDto } from './parts/section.dto'
1+
import { ApiProperty, PartialType } from '@nestjs/swagger';
2+
import { IsString, IsEnum, IsObject, ValidateNested, IsOptional } from 'class-validator';
3+
import { MixedValue } from '~/_common/types/mixed-value.type';
4+
import { FormTypeList, FormTypes } from '../_enum/types';
5+
import { MetadataDto } from '~/_common/abstracts/dto/metadata.dto';
6+
import { Type } from 'class-transformer';
7+
import { FormSectionDto } from './parts/section.dto';
128

139
export class FormCreateDto extends MetadataDto {
1410
@IsString()
1511
@ApiProperty()
16-
title: string
12+
title: string;
1713

1814
@IsString()
1915
@IsOptional()
2016
@ApiProperty({ required: false })
21-
description?: string
17+
description?: string;
2218

2319
@IsEnum(FormTypeList)
2420
@ApiProperty({ enum: FormTypeList })
25-
type: FormTypes
21+
type: FormTypes;
2622

2723
@IsObject()
2824
@IsOptional()
2925
@ApiProperty({ required: false })
30-
defaultValues: { [key: string]: MixedValue }
26+
defaultValues: { [key: string]: MixedValue };
3127

3228
@ValidateNested({ each: true })
3329
@Type(() => FormSectionDto)
3430
// @ApiProperty({ type: () => FormSectionDto, isArray: true })
35-
sections: { [key: string]: FormSectionDto }
31+
sections: { [key: string]: FormSectionDto };
3632

3733
@IsString()
3834
@ApiProperty()
39-
submitButtonText: string
35+
submitButtonText: string;
4036

4137
@IsString()
4238
@ApiProperty()
43-
submitApiUrl: string
39+
submitApiUrl: string;
4440

4541
@IsObject()
4642
@IsOptional()
4743
@ApiProperty({ required: false })
48-
redirectUrl?: string
44+
redirectUrl?: string;
4945
}
5046

5147
export class FormDto extends FormCreateDto {}
5248

53-
5449
export class FormUpdateDto extends PartialType(FormDto) {}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Schema, SchemaFactory } from '@nestjs/mongoose'
2-
import { Document } from 'mongoose'
3-
import { Abstract } from '~/_common/abstracts/abstract/schemas/abstract.schema'
1+
import { Schema, SchemaFactory } from '@nestjs/mongoose';
2+
import { Document } from 'mongoose';
3+
import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema';
44

5-
export type LoggerDocument = Logger & Document
5+
export type LoggerDocument = Logger & Document;
66

77
@Schema({ versionKey: false })
88
export class Logger extends AbstractSchema {}
99

10-
export const LoggerSchema = SchemaFactory.createForClass(Logger)
10+
export const LoggerSchema = SchemaFactory.createForClass(Logger);

0 commit comments

Comments
 (0)