Commit c992537c authored by nanahira's avatar nanahira

extra

parent aae8117a
Pipeline #14528 failed with stages
in 21 seconds
......@@ -4,6 +4,7 @@ import { ColumnWithLengthOptions } from 'typeorm/decorator/options/ColumnWithLen
import { ColumnCommonOptions } from 'typeorm/decorator/options/ColumnCommonOptions';
import { ColumnEnumOptions } from 'typeorm/decorator/options/ColumnEnumOptions';
import {
IsDate,
IsEnum,
IsInt,
IsNotEmpty,
......@@ -117,6 +118,28 @@ export const EnumColumn = <T>(
IsEnum(targetEnum),
]);
export const DateColumn = <T>(
description = 'unknown',
required = false,
columnExtras: ColumnCommonOptions & ColumnEnumOptions = {},
swaggerExtras: ApiPropertyOptions = {},
) =>
MergePropertyDecorators([
IsDate(),
...(required ? [] : [IsOptional()]),
Column('timestamp', {
nullable: !required,
comment: description,
...columnExtras,
}),
ApiProperty({
description,
type: Date,
required,
...swaggerExtras,
}),
]);
export const NotColumn = (
description?: string,
swaggerExtras: ApiPropertyOptions = {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment