Commit 822a50a5 authored by nanahira's avatar nanahira

updates

parent 9c18d2d9
import { DeletionBase } from './DeletionBase.entity'; import { DeletionBase } from './DeletionBase.entity';
import { import { Column, Generated, SelectQueryBuilder } from 'typeorm';
Column,
Generated,
PrimaryGeneratedColumn,
SelectQueryBuilder,
} from 'typeorm';
import { IdWise } from '../interfaces/wises'; import { IdWise } from '../interfaces/wises';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { applyQueryProperty } from '../utility/query'; import { applyQueryProperty } from '../utility/query';
import { NotChangeable, NotWritable } from '../decorators/transform'; import { NotWritable } from '../decorators/transform';
import { IsInt, IsOptional, IsPositive } from 'class-validator'; import { IsInt, IsPositive } from 'class-validator';
import { BigintTransformer } from '../utility/bigint-transform'; import { BigintTransformer } from '../utility/bigint-transform';
export class IdBase extends DeletionBase implements IdWise { export class IdBase extends DeletionBase implements IdWise {
@Generated('increment') @Generated('increment')
@Column('int8', { primary: true, transformer: new BigintTransformer() }) @Column('bigint', {
primary: true,
unsigned: true,
transformer: new BigintTransformer(),
})
@ApiProperty({ description: '编号', required: false }) @ApiProperty({ description: '编号', required: false })
@NotWritable() @NotWritable()
@IsInt() @IsInt()
......
...@@ -6,8 +6,9 @@ import { BigintTransformer } from '../utility/bigint-transform'; ...@@ -6,8 +6,9 @@ import { BigintTransformer } from '../utility/bigint-transform';
export const RelationColumn = (description = '对应编号', notNull = false) => export const RelationColumn = (description = '对应编号', notNull = false) =>
MergePropertyDecorators([ MergePropertyDecorators([
Column('int8', { Column('bigint', {
nullable: !notNull, nullable: !notNull,
unsigned: true,
transformer: new BigintTransformer(), transformer: new BigintTransformer(),
}), }),
ApiProperty({ type: Number, description }), ApiProperty({ type: Number, description }),
......
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