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
b913277a
Commit
b913277a
authored
May 19, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add statusIn, and updated edit rules
parent
6caf4810
Pipeline
#36512
passed with stages
in 6 minutes and 30 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
8 deletions
+36
-8
package-lock.json
package-lock.json
+4
-4
package.json
package.json
+1
-1
src/tournament/entities/Tournament.entity.ts
src/tournament/entities/Tournament.entity.ts
+9
-2
src/tournament/tournament.service.ts
src/tournament/tournament.service.ts
+13
-1
src/utility/decorators/query-in.ts
src/utility/decorators/query-in.ts
+9
-0
No files found.
package-lock.json
View file @
b913277a
...
...
@@ -22,7 +22,7 @@
"lodash"
:
"^4.17.21"
,
"nesties"
:
"^1.1.1"
,
"nestjs-mycard"
:
"^4.0.2"
,
"nicot"
:
"^1.1.
17
"
,
"nicot"
:
"^1.1.
21
"
,
"pg"
:
"^8.14.1"
,
"pg-native"
:
"^3.3.0"
,
"reflect-metadata"
:
"^0.2.2"
,
...
...
@@ -9067,9 +9067,9 @@
}
},
"node_modules/nicot"
:
{
"version"
:
"1.1.
17
"
,
"resolved"
:
"https://registry.npmjs.org/nicot/-/nicot-1.1.
17
.tgz"
,
"integrity"
:
"sha512-
80Bj537a/KJZNbK5RyAf0NNzrmtygQuX0OOAkLGlmYwaTxmSqNTJ/NyWiao+ObUIu6GG3HM68erhcxSgK6ihhA
=="
,
"version"
:
"1.1.
21
"
,
"resolved"
:
"https://registry.npmjs.org/nicot/-/nicot-1.1.
21
.tgz"
,
"integrity"
:
"sha512-
25OSyXQ7WCjj/UXg0CvYa01+kZj5dGDTalUAL9bAr1/1Qt/swN6tPyEPss9h66+UIizHAR4OvOw54dW7KS5yHQ
=="
,
"license"
:
"MIT"
,
"dependencies"
:
{
"lodash"
:
"^4.17.21"
,
...
...
package.json
View file @
b913277a
...
...
@@ -33,7 +33,7 @@
"
lodash
"
:
"
^4.17.21
"
,
"
nesties
"
:
"
^1.1.1
"
,
"
nestjs-mycard
"
:
"
^4.0.2
"
,
"
nicot
"
:
"
^1.1.
17
"
,
"
nicot
"
:
"
^1.1.
21
"
,
"
pg
"
:
"
^8.14.1
"
,
"
pg-native
"
:
"
^3.3.0
"
,
"
reflect-metadata
"
:
"
^0.2.2
"
,
...
...
src/tournament/entities/Tournament.entity.ts
View file @
b913277a
...
...
@@ -18,6 +18,7 @@ import {
NotQueryable
,
NotWritable
,
QueryColumn
,
QueryCondition
,
QueryEqual
,
QueryGreaterEqual
,
QueryLessEqual
,
...
...
@@ -41,6 +42,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
{
QueryIn
}
from
'
../../utility/decorators/query-in
'
;
export
enum
TournamentRule
{
SingleElimination
=
'
SingleElimination
'
,
...
...
@@ -79,7 +81,7 @@ export class RuleSettings {
@
Entity
()
export
class
Tournament
extends
DescBase
{
@
QueryEqual
()
@
NotChangeable
()
//
@NotChangeable()
@
EnumColumn
(
TournamentRule
,
{
default
:
TournamentRule
.
SingleElimination
,
description
:
'
规则
'
,
...
...
@@ -91,7 +93,8 @@ export class Tournament extends DescBase {
return
new
ruleClass
(
this
,
repo
);
}
@
NotChangeable
()
// @NotChangeable()
@
NotQueryable
()
@
JsonColumn
(
RenameClass
(
PartialType
(
RuleSettings
),
'
RuleSettingsPartial
'
),
{
description
:
'
比赛规则参数
'
,
})
...
...
@@ -111,6 +114,10 @@ export class Tournament extends DescBase {
})
status
:
TournamentStatus
;
@
QueryColumn
()
@
QueryIn
(
'
status
'
)
statusIn
:
string
;
@
NotWritable
()
@
Index
()
@
IntColumn
(
'
int
'
,
{
...
...
src/tournament/tournament.service.ts
View file @
b913277a
...
...
@@ -43,12 +43,24 @@ export class TournamentService extends CrudService(Tournament, {
return
this
.
create
(
tournament
);
}
private
readyEditableFields
:
(
keyof
Tournament
)[]
=
[
'
rule
'
,
'
ruleSettings
'
];
async
updateTournament
(
id
:
number
,
dto
:
Partial
<
Tournament
>
,
user
:
MycardUser
,
)
{
await
this
.
checkPermissionOfTournament
(
id
,
user
);
const
tournament
=
await
this
.
checkPermissionOfTournament
(
id
,
user
);
if
(
tournament
.
status
!==
TournamentStatus
.
Ready
)
{
for
(
const
field
of
this
.
readyEditableFields
)
{
if
(
dto
[
field
]
!==
undefined
)
{
throw
new
BlankReturnMessageDto
(
403
,
'
比赛已经开始,不能修改规则。
'
,
).
toException
();
}
}
}
return
this
.
update
(
id
,
dto
);
}
...
...
src/utility/decorators/query-in.ts
0 → 100644
View file @
b913277a
import
{
QueryCondition
}
from
'
nicot
'
;
export
const
QueryIn
=
(
field
:
string
)
=>
QueryCondition
((
obj
,
qb
,
entityName
,
key
)
=>
{
if
(
obj
[
key
])
{
const
values
=
(
obj
[
key
]
as
string
).
split
(
'
,
'
);
qb
.
andWhere
(
`
${
entityName
}
.
${
field
}
IN (:...
${
key
}
)`
,
{
[
key
]:
values
});
}
});
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