Commit 345755c3 authored by nanahira's avatar nanahira

bump nicot again

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