Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Revive
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
Ygopro Arena Revive
Commits
7576ef03
"...Irrlicht/svn:/svn.code.sf.net/p/irrlicht/code/trunk@2960" did not exist on "7e2c6364c144d84e84c5f86466e2b598799c5fb6"
Commit
7576ef03
authored
Apr 17, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix deck info history
parent
1db62e1f
Pipeline
#2942
passed with stages
in 3 minutes and 46 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
12 deletions
+29
-12
src/app.controller.ts
src/app.controller.ts
+4
-4
src/app.service.ts
src/app.service.ts
+10
-6
src/entities/mycard/DeckInfo.ts
src/entities/mycard/DeckInfo.ts
+2
-1
src/entities/mycard/DeckInfoHistory.ts
src/entities/mycard/DeckInfoHistory.ts
+2
-1
src/entities/mycard/DeckInfoOrHistory.ts
src/entities/mycard/DeckInfoOrHistory.ts
+11
-0
No files found.
src/app.controller.ts
View file @
7576ef03
...
...
@@ -2,6 +2,7 @@ import {
Body
,
Controller
,
Get
,
NotFoundException
,
Param
,
Post
,
Query
,
...
...
@@ -153,12 +154,11 @@ export class AppController {
return
result
;
}
@
Get
(
'
deckinfo
'
)
async
getDeckInfo
(@
Query
()
query
,
@
Res
()
res
:
express
.
Response
)
{
async
getDeckInfo
(@
Query
()
query
)
{
if
(
!
query
.
name
)
{
res
.
status
(
404
).
send
(
'
deck name is required!
'
);
throw
new
NotFoundException
(
'
deck name is required!
'
);
}
const
result
=
await
this
.
appService
.
getDeckInfo
(
query
);
res
.
status
(
result
.
code
).
json
(
result
);
return
await
this
.
appService
.
getDeckInfo
(
query
);
}
@
Post
(
'
upload
'
)
uploadFile
(@
Req
()
req
:
express
.
Request
,
@
Res
()
res
:
express
.
Response
)
{
...
...
src/app.service.ts
View file @
7576ef03
import
{
Injectable
}
from
'
@nestjs/common
'
;
import
{
Injectable
,
NotFoundException
}
from
'
@nestjs/common
'
;
import
{
InjectConnection
,
InjectEntityManager
}
from
'
@nestjs/typeorm
'
;
import
{
Brackets
,
...
...
@@ -35,6 +35,7 @@ import { DeckDemo } from './entities/mycard/DeckDemo';
import
{
Deck
}
from
'
./entities/mycard/Deck
'
;
import
{
Ads
}
from
'
./entities/mycard/Ads
'
;
import
{
QueryDeepPartialEntity
}
from
'
typeorm/query-builder/QueryPartialEntity
'
;
import
{
DeckInfoOrHistory
}
from
'
./entities/mycard/DeckInfoOrHistory
'
;
const
attrOffset
=
1010
;
const
raceOffset
=
1020
;
...
...
@@ -1173,10 +1174,10 @@ export class AppService {
async
getDeckInfo
(
query
:
any
)
{
const
name
:
string
=
query
.
name
;
const
version
=
query
.
version
;
let
deck
:
an
y
;
let
deck
:
DeckInfoOrHistor
y
;
if
(
version
)
{
deck
=
await
this
.
mcdb
.
getRepository
(
DeckInfo
)
.
getRepository
(
DeckInfo
History
)
.
createQueryBuilder
()
.
where
(
'
name = :name
'
,
{
name
})
.
andWhere
(
'
id = :id
'
,
{
id
:
parseInt
(
version
)
})
...
...
@@ -1191,9 +1192,10 @@ export class AppService {
.
getOne
();
}
if
(
!
deck
)
{
return
{
throw
new
NotFoundException
(
{
code
:
404
,
};
message
:
'
deck not found.
'
,
});
}
const
resName
=
deck
.
name
;
const
history
=
await
this
.
mcdb
...
...
@@ -1413,7 +1415,9 @@ export class AppService {
deckInfoHistory
.
name
=
name
;
deckInfoHistory
.
content
=
contentStr
;
deckInfoHistory
.
end_time
=
now
;
await
db
.
getRepository
(
DeckInfoHistory
).
save
(
deckInfoHistory
);
this
.
log
.
log
(
await
db
.
getRepository
(
DeckInfoHistory
).
save
(
deckInfoHistory
),
);
}
catch
(
e
)
{
this
.
log
.
error
(
`Failed to submit deck info
${
name
}
:
${
e
.
toString
()}
`
);
code
=
500
;
...
...
src/entities/mycard/DeckInfo.ts
View file @
7576ef03
import
{
Column
,
Entity
,
PrimaryGeneratedColumn
}
from
'
typeorm
'
;
import
{
DeckInfoOrHistory
}
from
'
./DeckInfoOrHistory
'
;
@
Entity
(
'
deck_info
'
,
{
schema
:
'
public
'
})
export
class
DeckInfo
{
export
class
DeckInfo
implements
DeckInfoOrHistory
{
@
PrimaryGeneratedColumn
({
type
:
'
integer
'
,
name
:
'
id
'
})
id
:
number
;
...
...
src/entities/mycard/DeckInfoHistory.ts
View file @
7576ef03
import
{
Column
,
Entity
,
PrimaryGeneratedColumn
}
from
'
typeorm
'
;
import
{
DeckInfoOrHistory
}
from
'
./DeckInfoOrHistory
'
;
@
Entity
(
'
deck_info_history
'
,
{
schema
:
'
public
'
})
export
class
DeckInfoHistory
{
export
class
DeckInfoHistory
implements
DeckInfoOrHistory
{
@
PrimaryGeneratedColumn
({
type
:
'
integer
'
,
name
:
'
id
'
})
id
:
number
;
...
...
src/entities/mycard/DeckInfoOrHistory.ts
0 → 100644
View file @
7576ef03
export
interface
DeckInfoOrHistory
{
id
:
number
;
name
:
string
;
content
:
string
;
start_time
:
Date
;
end_time
:
Date
;
}
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