Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tabulator-another
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
tabulator-another
Commits
b320dae1
Commit
b320dae1
authored
Apr 25, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add createdAtSinceDaysAgo
parent
983f0333
Pipeline
#35525
passed with stages
in 6 minutes and 29 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
14 deletions
+91
-14
package-lock.json
package-lock.json
+64
-13
package.json
package.json
+2
-1
src/tournament/entities/Tournament.entity.ts
src/tournament/entities/Tournament.entity.ts
+13
-0
src/utility/query-since-days-ago.ts
src/utility/query-since-days-ago.ts
+12
-0
No files found.
package-lock.json
View file @
b320dae1
...
...
@@ -20,9 +20,10 @@
"class-validator"
:
"^0.14.1"
,
"crypto-random-string"
:
"3.3.1"
,
"lodash"
:
"^4.17.21"
,
"moment"
:
"^2.30.1"
,
"nesties"
:
"^1.1.1"
,
"nestjs-mycard"
:
"^4.0.2"
,
"nicot"
:
"^1.1.
9
"
,
"nicot"
:
"^1.1.
11
"
,
"pg"
:
"^8.14.1"
,
"pg-native"
:
"^3.3.0"
,
"reflect-metadata"
:
"^0.2.2"
,
...
...
@@ -5631,6 +5632,21 @@
"dev"
:
true
,
"license"
:
"MIT"
},
"node_modules/copy-anything"
:
{
"version"
:
"3.0.5"
,
"resolved"
:
"https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz"
,
"integrity"
:
"sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"is-what"
:
"^4.1.8"
},
"engines"
:
{
"node"
:
">=12.13"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/mesqueeb"
}
},
"node_modules/core-util-is"
:
{
"version"
:
"1.0.3"
,
"resolved"
:
"https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz"
,
...
...
@@ -7587,6 +7603,18 @@
"url"
:
"https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-what"
:
{
"version"
:
"4.1.16"
,
"resolved"
:
"https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz"
,
"integrity"
:
"sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
">=12.13"
},
"funding"
:
{
"url"
:
"https://github.com/sponsors/mesqueeb"
}
},
"node_modules/isarray"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
,
...
...
@@ -8901,6 +8929,15 @@
"mkdirp"
:
"bin/cmd.js"
}
},
"node_modules/moment"
:
{
"version"
:
"2.30.1"
,
"resolved"
:
"https://registry.npmjs.org/moment/-/moment-2.30.1.tgz"
,
"integrity"
:
"sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how=="
,
"license"
:
"MIT"
,
"engines"
:
{
"node"
:
"*"
}
},
"node_modules/ms"
:
{
"version"
:
"2.1.3"
,
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
,
...
...
@@ -9008,14 +9045,14 @@
"license"
:
"MIT"
},
"node_modules/nesties"
:
{
"version"
:
"1.1.
1
"
,
"resolved"
:
"https://registry.npmjs.org/nesties/-/nesties-1.1.
1
.tgz"
,
"integrity"
:
"sha512-
M8G3MPQKaxgRHK9UkGc1BtPZC1n37SNMAmVH9EIzaXxyMzXNOMR7Aqu/9ikXc6IDcF1VB3JKYpcDyZYG+EtZKw
=="
,
"version"
:
"1.1.
2
"
,
"resolved"
:
"https://registry.npmjs.org/nesties/-/nesties-1.1.
2
.tgz"
,
"integrity"
:
"sha512-
fzSToGOcde+rjXWpCoEUdEEIpTm59rl7d9SpsPqc6OnmdAiY9nfV3JOeymkBkjrTOhK7yN7U7NPDDZZ6GX40+A
=="
,
"license"
:
"MIT"
,
"peerDependencies"
:
{
"@nestjs/common"
:
"^
9.4.0 || ^10.0.0 || ^11
.0.0"
,
"@nestjs/config"
:
"^
3.0.0 || ^4
.0.0"
,
"@nestjs/swagger"
:
"^
7.1.8 || ^6.3.0 || ^11.0
.0"
"@nestjs/common"
:
"^
11.0.0 || ^9.4.0 || ^10
.0.0"
,
"@nestjs/config"
:
"^
4.0.0 || ^3
.0.0"
,
"@nestjs/swagger"
:
"^
11.0.0 || ^7.1.8 || ^6.3
.0"
}
},
"node_modules/nestjs-mycard"
:
{
...
...
@@ -9034,18 +9071,20 @@
}
},
"node_modules/nicot"
:
{
"version"
:
"1.1.
9
"
,
"resolved"
:
"https://registry.npmjs.org/nicot/-/nicot-1.1.
9
.tgz"
,
"integrity"
:
"sha512-
DG4SK6E0DQ8JBKn8xGL6cbpXBQxTfUdC2d6r6Pu2OSKM6yyz7EmhBHcviSGbNUNArShljmc06YCaj7sqqqRSyw
=="
,
"version"
:
"1.1.
11
"
,
"resolved"
:
"https://registry.npmjs.org/nicot/-/nicot-1.1.
11
.tgz"
,
"integrity"
:
"sha512-
ttZayz/JbVaJ4R4MA3bPht1+qGAC/DJ6/9sPw72wICuWakSFSMaxJbX4yQxdZ1TP8+fDYxt2UGEtrtkMbpbdrA
=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"lodash"
:
"^4.17.21"
,
"nesties"
:
"^1.1.1"
,
"nesties"
:
"^1.1.2"
,
"superjson"
:
"1.13.3"
,
"typed-reflector"
:
"^1.0.11"
},
"peerDependencies"
:
{
"@nestjs/common"
:
"^9.4.0 || ^10.0.0 || ^11.0.14"
,
"@nestjs/swagger"
:
"^7.1.8 || ^6.3.0 || ^11.1.1"
,
"@nestjs/common"
:
"^11.0.0 || ^9.4.0 || ^10.0.0"
,
"@nestjs/config"
:
"^4.0.0 || ^3.0.0"
,
"@nestjs/swagger"
:
"^11.0.0 || ^7.1.8 || ^6.3.0"
,
"class-transformer"
:
"^0.5.1"
,
"class-validator"
:
"^0.14.0"
,
"typeorm"
:
"^0.3.16"
...
...
@@ -10855,6 +10894,18 @@
"node"
:
">=14.18.0"
}
},
"node_modules/superjson"
:
{
"version"
:
"1.13.3"
,
"resolved"
:
"https://registry.npmjs.org/superjson/-/superjson-1.13.3.tgz"
,
"integrity"
:
"sha512-mJiVjfd2vokfDxsQPOwJ/PtanO87LhpYY88ubI5dUB1Ab58Txbyje3+jpm+/83R/fevaq/107NNhtYBLuoTrFg=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"copy-anything"
:
"^3.0.2"
},
"engines"
:
{
"node"
:
">=10"
}
},
"node_modules/supertest"
:
{
"version"
:
"7.1.0"
,
"resolved"
:
"https://registry.npmjs.org/supertest/-/supertest-7.1.0.tgz"
,
...
...
package.json
View file @
b320dae1
...
...
@@ -31,9 +31,10 @@
"
class-validator
"
:
"
^0.14.1
"
,
"
crypto-random-string
"
:
"
3.3.1
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
moment
"
:
"
^2.30.1
"
,
"
nesties
"
:
"
^1.1.1
"
,
"
nestjs-mycard
"
:
"
^4.0.2
"
,
"
nicot
"
:
"
^1.1.
9
"
,
"
nicot
"
:
"
^1.1.
11
"
,
"
pg
"
:
"
^8.14.1
"
,
"
pg-native
"
:
"
^3.3.0
"
,
"
reflect-metadata
"
:
"
^0.2.2
"
,
...
...
src/tournament/entities/Tournament.entity.ts
View file @
b320dae1
...
...
@@ -14,6 +14,7 @@ import {
JsonColumn
,
NotChangeable
,
NotColumn
,
NotInResult
,
NotQueryable
,
NotWritable
,
QueryEqual
,
...
...
@@ -31,6 +32,7 @@ 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
{
QuerySinceDaysAgo
}
from
'
../../utility/query-since-days-ago
'
;
export
enum
TournamentRule
{
SingleElimination
=
'
SingleElimination
'
,
...
...
@@ -126,6 +128,17 @@ export class Tournament extends DescBase {
@
DateColumn
({
description
:
'
创建时间
'
,
columnExtras
:
{
nullable
:
false
}
})
createdAt
:
Date
;
@
NotWritable
()
@
NotInResult
()
@
IsInt
()
@
IsPositive
()
@
QuerySinceDaysAgo
(
'
createdAt
'
)
@
ApiProperty
({
description
:
'
查询最多创建时间在多少天前的比赛
'
,
required
:
false
,
})
createdAtSinceDaysAgo
:
number
;
@
NotColumn
()
@
OneToMany
(()
=>
Participant
,
(
participant
)
=>
participant
.
tournament
)
participants
:
Participant
[];
...
...
src/utility/query-since-days-ago.ts
0 → 100644
View file @
b320dae1
import
{
QueryCondition
}
from
'
nicot
'
;
import
moment
from
'
moment
'
;
export
const
QuerySinceDaysAgo
=
(
dateField
:
string
)
=>
QueryCondition
((
obj
,
qb
,
entityName
,
key
)
=>
{
if
(
!
obj
[
key
])
return
;
const
since
=
moment
().
subtract
(
obj
[
key
],
'
days
'
).
toDate
();
const
typeormKey
=
`since_
${
entityName
}
_
${
dateField
}
_
${
key
}
`
;
qb
.
andWhere
(
`
${
entityName
}
.
${
dateField
}
> :
${
typeormKey
}
`
,
{
[
typeormKey
]:
since
,
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment