Commit 345755c3 authored by nanahira's avatar nanahira

bump nicot again

parent 0578c810
......@@ -22,7 +22,7 @@
"lodash": "^4.17.21",
"nesties": "^1.1.1",
"nestjs-mycard": "^4.0.2",
"nicot": "^1.1.11",
"nicot": "^1.1.13",
"pg": "^8.14.1",
"pg-native": "^3.3.0",
"reflect-metadata": "^0.2.2",
......@@ -9061,9 +9061,9 @@
}
},
"node_modules/nicot": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/nicot/-/nicot-1.1.11.tgz",
"integrity": "sha512-ttZayz/JbVaJ4R4MA3bPht1+qGAC/DJ6/9sPw72wICuWakSFSMaxJbX4yQxdZ1TP8+fDYxt2UGEtrtkMbpbdrA==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/nicot/-/nicot-1.1.13.tgz",
"integrity": "sha512-uBDjRUx/jmuUGxQeC/KtmkP8C/QIZYRYJMYJuszAV7M1Na+Um9hnHTcTWeSK+whrXoIEt8bJlERFn/CnRTi06A==",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.21",
......
......@@ -17,7 +17,10 @@ import {
NotInResult,
NotQueryable,
NotWritable,
QueryColumn,
QueryEqual,
QueryGreaterEqual,
QueryLessEqual,
RelationComputed,
} from 'nicot';
import { MycardUser } from 'nestjs-mycard';
......@@ -38,7 +41,6 @@ import { Match } from '../../match/entities/match.entity';
import { TournamentRules } from '../../tournament-rules/rule-map';
import _ from 'lodash';
import { RenameClass } from 'nicot/dist/src/utility/rename-class';
import { QueryOperator } from '../../utility/query-operator';
export enum TournamentRule {
SingleElimination = 'SingleElimination',
......@@ -134,24 +136,18 @@ export class Tournament extends DescBase {
@DateColumn({ description: '创建时间', columnExtras: { nullable: false } })
createdAt: Date;
@NotWritable()
@NotInResult()
@IsDate()
@QueryOperator('createdAt', '<=')
@ApiProperty({
@QueryColumn({
description: '查询创建时间在什么时候之前的比赛',
required: false,
})
@QueryLessEqual('createdAt')
createdAtBefore: Date;
@NotWritable()
@NotInResult()
@IsDate()
@QueryOperator('createdAt', '>=')
@ApiProperty({
description: '查询创建时间在什么时候之后的比赛',
required: false,
@QueryColumn({
description: '查询创建时间在什么时候之前的比赛',
})
@QueryGreaterEqual('createdAt')
createdAtAfter: Date;
@NotColumn()
......
import { QueryCondition } from 'nicot';
export const QueryOperator = (dateField: string, operator: string) =>
QueryCondition((obj, qb, entityName, key) => {
if (!obj[key]) return;
const typeormKey = `operator_${entityName}_${dateField}_${key}`;
qb.andWhere(`${entityName}.${dateField} ${operator} :${typeormKey}`, {
[typeormKey]: obj[key],
});
});
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