Compare commits
1 Commits
uint
...
restricted
| Author | SHA1 | Date | |
|---|---|---|---|
|
69438a9d0c
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -1297,9 +1297,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rbx_asset"
|
name = "rbx_asset"
|
||||||
version = "0.4.3"
|
version = "0.3.3"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "077e2a0b201a777dfd2ff822766ae7d0c8c3003206115da57f7bce15ee73cbc7"
|
checksum = "91722b37549ded270f39556194ca03d03e08bd70674d239ec845765ed9e42b7d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"flate2",
|
"flate2",
|
||||||
@@ -1798,7 +1798,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "submissions-api"
|
name = "submissions-api"
|
||||||
version = "0.7.0"
|
version = "0.6.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Stage 1: Build
|
# Stage 1: Build
|
||||||
FROM registry.itzana.me/docker-proxy/golang:1.24 AS builder
|
FROM docker.io/golang:1.23 AS builder
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Set the working directory in the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -14,7 +14,7 @@ COPY . .
|
|||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o service ./cmd/maps-service/service.go
|
RUN CGO_ENABLED=0 GOOS=linux go build -o service ./cmd/maps-service/service.go
|
||||||
|
|
||||||
# Stage 2: Run
|
# Stage 2: Run
|
||||||
FROM registry.itzana.me/docker-proxy/alpine:3.21
|
FROM alpine
|
||||||
|
|
||||||
# Set up a non-root user for security
|
# Set up a non-root user for security
|
||||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||||
|
|||||||
@@ -47,32 +47,13 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
- name: ValidatedModelVersion
|
- name: ValidatedModelVersion
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/mapfixes/{MapfixID}/status/validator-submitted:
|
|
||||||
post:
|
|
||||||
summary: (Internal endpoint) Role Validator changes status from Submitting -> Submitted
|
|
||||||
operationId: actionMapfixSubmitted
|
|
||||||
tags:
|
|
||||||
- Mapfixes
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/MapfixID'
|
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -202,32 +183,13 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
- name: ValidatedModelVersion
|
- name: ValidatedModelVersion
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/submissions/{SubmissionID}/status/validator-submitted:
|
|
||||||
post:
|
|
||||||
summary: (Internal endpoint) Role Validator changes status from Submitting -> Submitted
|
|
||||||
operationId: actionSubmissionSubmitted
|
|
||||||
tags:
|
|
||||||
- Submissions
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/SubmissionID'
|
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -291,8 +253,7 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -321,14 +282,12 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
- name: Policy
|
- name: Policy
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -397,14 +356,12 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
- name: ResourceID
|
- name: ResourceID
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -474,8 +431,7 @@ components:
|
|||||||
description: The unique identifier for a submission.
|
description: The unique identifier for a submission.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
OperationID:
|
OperationID:
|
||||||
name: OperationID
|
name: OperationID
|
||||||
in: path
|
in: path
|
||||||
@@ -483,8 +439,7 @@ components:
|
|||||||
description: The unique identifier for a long-running operation.
|
description: The unique identifier for a long-running operation.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
SubmissionID:
|
SubmissionID:
|
||||||
name: SubmissionID
|
name: SubmissionID
|
||||||
in: path
|
in: path
|
||||||
@@ -492,8 +447,7 @@ components:
|
|||||||
description: The unique identifier for a submission.
|
description: The unique identifier for a submission.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptID:
|
ScriptID:
|
||||||
name: ScriptID
|
name: ScriptID
|
||||||
in: path
|
in: path
|
||||||
@@ -501,15 +455,14 @@ components:
|
|||||||
description: The unique identifier for a script.
|
description: The unique identifier for a script.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Page:
|
Page:
|
||||||
name: Page
|
name: Page
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
minimum: 1
|
||||||
Limit:
|
Limit:
|
||||||
name: Limit
|
name: Limit
|
||||||
@@ -517,7 +470,7 @@ components:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
minimum: 1
|
||||||
maximum: 100
|
maximum: 100
|
||||||
schemas:
|
schemas:
|
||||||
@@ -528,8 +481,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
MapfixID:
|
MapfixID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
SubmissionID:
|
SubmissionID:
|
||||||
required:
|
required:
|
||||||
- SubmissionID
|
- SubmissionID
|
||||||
@@ -537,8 +489,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
SubmissionID:
|
SubmissionID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptID:
|
ScriptID:
|
||||||
required:
|
required:
|
||||||
- ScriptID
|
- ScriptID
|
||||||
@@ -546,8 +497,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ScriptID:
|
ScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyID:
|
ScriptPolicyID:
|
||||||
required:
|
required:
|
||||||
- ScriptPolicyID
|
- ScriptPolicyID
|
||||||
@@ -555,8 +505,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ScriptPolicyID:
|
ScriptPolicyID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
MapfixCreate:
|
MapfixCreate:
|
||||||
required:
|
required:
|
||||||
- OperationID
|
- OperationID
|
||||||
@@ -571,12 +520,10 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
OperationID:
|
OperationID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
AssetOwner:
|
AssetOwner:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
DisplayName:
|
DisplayName:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -585,20 +532,16 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
GameID:
|
GameID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetVersion:
|
AssetVersion:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
TargetAssetID:
|
TargetAssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
SubmissionCreate:
|
SubmissionCreate:
|
||||||
required:
|
required:
|
||||||
- OperationID
|
- OperationID
|
||||||
@@ -612,12 +555,10 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
OperationID:
|
OperationID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
AssetOwner:
|
AssetOwner:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
DisplayName:
|
DisplayName:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -626,16 +567,13 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
GameID:
|
GameID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetVersion:
|
AssetVersion:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Script:
|
Script:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -648,8 +586,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Name:
|
Name:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -662,12 +599,10 @@ components:
|
|||||||
maxLength: 1048576
|
maxLength: 1048576
|
||||||
ResourceType:
|
ResourceType:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ResourceID:
|
ResourceID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptCreate:
|
ScriptCreate:
|
||||||
required:
|
required:
|
||||||
- Name
|
- Name
|
||||||
@@ -684,12 +619,10 @@ components:
|
|||||||
maxLength: 1048576
|
maxLength: 1048576
|
||||||
ResourceType:
|
ResourceType:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ResourceID:
|
ResourceID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptPolicy:
|
ScriptPolicy:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -700,20 +633,17 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
FromScriptHash:
|
FromScriptHash:
|
||||||
type: string
|
type: string
|
||||||
minLength: 16
|
minLength: 16
|
||||||
maxLength: 16
|
maxLength: 16
|
||||||
ToScriptID:
|
ToScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Policy:
|
Policy:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyCreate:
|
ScriptPolicyCreate:
|
||||||
required:
|
required:
|
||||||
- FromScriptID
|
- FromScriptID
|
||||||
@@ -723,24 +653,20 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
FromScriptID:
|
FromScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ToScriptID:
|
ToScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Policy:
|
Policy:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
Error:
|
Error:
|
||||||
description: Represents error object
|
description: Represents error object
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
code:
|
code:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
|||||||
499
openapi.yaml
499
openapi.yaml
@@ -104,16 +104,12 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
|
||||||
maximum: 5
|
|
||||||
- name: Sort
|
- name: Sort
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
maximum: 4
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -175,48 +171,21 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
|
||||||
maximum: 5
|
|
||||||
- name: Sort
|
- name: Sort
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
maximum: 4
|
|
||||||
- name: Submitter
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: AssetID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: TargetAssetID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: StatusID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint32
|
|
||||||
minimum: 0
|
|
||||||
maximum: 9
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Mapfixes"
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Mapfix"
|
||||||
default:
|
default:
|
||||||
description: General Error
|
description: General Error
|
||||||
content:
|
content:
|
||||||
@@ -269,56 +238,6 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
/mapfixes/{MapfixID}/audit-events:
|
|
||||||
get:
|
|
||||||
summary: Retrieve a list of audit events
|
|
||||||
operationId: listMapfixAuditEvents
|
|
||||||
tags:
|
|
||||||
- Mapfixes
|
|
||||||
security: []
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/MapfixID'
|
|
||||||
- $ref: "#/components/parameters/Page"
|
|
||||||
- $ref: "#/components/parameters/Limit"
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Successful response
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/AuditEvent"
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/mapfixes/{MapfixID}/comment:
|
|
||||||
post:
|
|
||||||
summary: Post a comment to the audit log
|
|
||||||
operationId: createMapfixAuditComment
|
|
||||||
tags:
|
|
||||||
- Mapfixes
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/MapfixID'
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
text/plain:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
maxLength: 1024
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/mapfixes/{MapfixID}/model:
|
/mapfixes/{MapfixID}/model:
|
||||||
post:
|
post:
|
||||||
summary: Update model following role restrictions
|
summary: Update model following role restrictions
|
||||||
@@ -332,15 +251,13 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
- name: VersionID
|
||||||
- name: ModelVersion
|
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -367,27 +284,10 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
/mapfixes/{MapfixID}/status/trigger-submit:
|
/mapfixes/{MapfixID}/status/submit:
|
||||||
post:
|
post:
|
||||||
summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting
|
summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
|
||||||
operationId: actionMapfixTriggerSubmit
|
operationId: actionMapfixSubmit
|
||||||
tags:
|
|
||||||
- Mapfixes
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/MapfixID'
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/mapfixes/{MapfixID}/status/reset-submitting:
|
|
||||||
post:
|
|
||||||
summary: Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction
|
|
||||||
operationId: actionMapfixResetSubmitting
|
|
||||||
tags:
|
tags:
|
||||||
- Mapfixes
|
- Mapfixes
|
||||||
parameters:
|
parameters:
|
||||||
@@ -582,48 +482,21 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
|
||||||
maximum: 5
|
|
||||||
- name: Sort
|
- name: Sort
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
maximum: 4
|
|
||||||
- name: Submitter
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: AssetID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: UploadedAssetID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
- name: StatusID
|
|
||||||
in: query
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
format: uint32
|
|
||||||
minimum: 0
|
|
||||||
maximum: 10
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Submissions"
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Submission"
|
||||||
default:
|
default:
|
||||||
description: General Error
|
description: General Error
|
||||||
content:
|
content:
|
||||||
@@ -676,56 +549,6 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
/submissions/{SubmissionID}/audit-events:
|
|
||||||
get:
|
|
||||||
summary: Retrieve a list of audit events
|
|
||||||
operationId: listSubmissionAuditEvents
|
|
||||||
tags:
|
|
||||||
- Submissions
|
|
||||||
security: []
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/SubmissionID'
|
|
||||||
- $ref: "#/components/parameters/Page"
|
|
||||||
- $ref: "#/components/parameters/Limit"
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Successful response
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/AuditEvent"
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/submissions/{SubmissionID}/comment:
|
|
||||||
post:
|
|
||||||
summary: Post a comment to the audit log
|
|
||||||
operationId: createSubmissionAuditComment
|
|
||||||
tags:
|
|
||||||
- Submissions
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/SubmissionID'
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
text/plain:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
maxLength: 1024
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/submissions/{SubmissionID}/model:
|
/submissions/{SubmissionID}/model:
|
||||||
post:
|
post:
|
||||||
summary: Update model following role restrictions
|
summary: Update model following role restrictions
|
||||||
@@ -739,15 +562,13 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
- name: VersionID
|
||||||
- name: ModelVersion
|
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -774,27 +595,10 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/Error"
|
$ref: "#/components/schemas/Error"
|
||||||
/submissions/{SubmissionID}/status/trigger-submit:
|
/submissions/{SubmissionID}/status/submit:
|
||||||
post:
|
post:
|
||||||
summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting
|
summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
|
||||||
operationId: actionSubmissionTriggerSubmit
|
operationId: actionSubmissionSubmit
|
||||||
tags:
|
|
||||||
- Submissions
|
|
||||||
parameters:
|
|
||||||
- $ref: '#/components/parameters/SubmissionID'
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: Successful response
|
|
||||||
default:
|
|
||||||
description: General Error
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/Error"
|
|
||||||
/submissions/{SubmissionID}/status/reset-submitting:
|
|
||||||
post:
|
|
||||||
summary: Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction
|
|
||||||
operationId: actionSubmissionResetSubmitting
|
|
||||||
tags:
|
tags:
|
||||||
- Submissions
|
- Submissions
|
||||||
parameters:
|
parameters:
|
||||||
@@ -989,14 +793,12 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
- name: Policy
|
- name: Policy
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -1126,14 +928,12 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
- name: ResourceID
|
- name: ResourceID
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Successful response
|
description: Successful response
|
||||||
@@ -1247,8 +1047,7 @@ components:
|
|||||||
description: The unique identifier for a map.
|
description: The unique identifier for a map.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
MapfixID:
|
MapfixID:
|
||||||
name: MapfixID
|
name: MapfixID
|
||||||
in: path
|
in: path
|
||||||
@@ -1256,8 +1055,7 @@ components:
|
|||||||
description: The unique identifier for a mapfix.
|
description: The unique identifier for a mapfix.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
OperationID:
|
OperationID:
|
||||||
name: OperationID
|
name: OperationID
|
||||||
in: path
|
in: path
|
||||||
@@ -1265,8 +1063,7 @@ components:
|
|||||||
description: The unique identifier for a long-running operation.
|
description: The unique identifier for a long-running operation.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
SubmissionID:
|
SubmissionID:
|
||||||
name: SubmissionID
|
name: SubmissionID
|
||||||
in: path
|
in: path
|
||||||
@@ -1274,8 +1071,7 @@ components:
|
|||||||
description: The unique identifier for a submission.
|
description: The unique identifier for a submission.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptID:
|
ScriptID:
|
||||||
name: ScriptID
|
name: ScriptID
|
||||||
in: path
|
in: path
|
||||||
@@ -1283,8 +1079,7 @@ components:
|
|||||||
description: The unique identifier for a script.
|
description: The unique identifier for a script.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyID:
|
ScriptPolicyID:
|
||||||
name: ScriptPolicyID
|
name: ScriptPolicyID
|
||||||
in: path
|
in: path
|
||||||
@@ -1292,15 +1087,14 @@ components:
|
|||||||
description: The unique identifier for a script policy.
|
description: The unique identifier for a script policy.
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Page:
|
Page:
|
||||||
name: Page
|
name: Page
|
||||||
in: query
|
in: query
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 1
|
minimum: 1
|
||||||
Limit:
|
Limit:
|
||||||
name: Limit
|
name: Limit
|
||||||
@@ -1308,44 +1102,10 @@ components:
|
|||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
minimum: 1
|
||||||
maximum: 100
|
maximum: 100
|
||||||
schemas:
|
schemas:
|
||||||
AuditEvent:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- ID
|
|
||||||
- Date
|
|
||||||
- User
|
|
||||||
- ResourceType
|
|
||||||
- ResourceID
|
|
||||||
- EventType
|
|
||||||
- EventData
|
|
||||||
properties:
|
|
||||||
ID:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
Date:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
User:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
ResourceType:
|
|
||||||
type: integer
|
|
||||||
format: uint32
|
|
||||||
description: Is this a submission or is it a mapfix
|
|
||||||
ResourceID:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
EventType:
|
|
||||||
type: integer
|
|
||||||
format: uint32
|
|
||||||
EventData:
|
|
||||||
type: object
|
|
||||||
description: Arbitrary event data
|
|
||||||
additionalProperties: true
|
|
||||||
OperationID:
|
OperationID:
|
||||||
required:
|
required:
|
||||||
- OperationID
|
- OperationID
|
||||||
@@ -1353,8 +1113,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
OperationID:
|
OperationID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ScriptID:
|
ScriptID:
|
||||||
required:
|
required:
|
||||||
- ScriptID
|
- ScriptID
|
||||||
@@ -1362,8 +1121,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ScriptID:
|
ScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyID:
|
ScriptPolicyID:
|
||||||
required:
|
required:
|
||||||
- ScriptPolicyID
|
- ScriptPolicyID
|
||||||
@@ -1371,8 +1129,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ScriptPolicyID:
|
ScriptPolicyID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Roles:
|
Roles:
|
||||||
required:
|
required:
|
||||||
- Roles
|
- Roles
|
||||||
@@ -1380,8 +1137,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
Roles:
|
Roles:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
User:
|
User:
|
||||||
required:
|
required:
|
||||||
- UserID
|
- UserID
|
||||||
@@ -1391,8 +1147,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
UserID:
|
UserID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Username:
|
Username:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1410,8 +1165,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
DisplayName:
|
DisplayName:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1420,12 +1174,10 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
GameID:
|
GameID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
Date:
|
Date:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Mapfix:
|
Mapfix:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -1445,8 +1197,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
DisplayName:
|
DisplayName:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1455,55 +1206,33 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
GameID:
|
GameID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
CreatedAt:
|
CreatedAt:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
UpdatedAt:
|
UpdatedAt:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Submitter:
|
Submitter:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetVersion:
|
AssetVersion:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Completed:
|
Completed:
|
||||||
type: boolean
|
type: boolean
|
||||||
TargetAssetID:
|
TargetAssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
StatusID:
|
StatusID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
StatusMessage:
|
StatusMessage:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 256
|
maxLength: 256
|
||||||
Mapfixes:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- Total
|
|
||||||
- Mapfixes
|
|
||||||
properties:
|
|
||||||
Total:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
Mapfixes:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/Mapfix"
|
|
||||||
MapfixTriggerCreate:
|
MapfixTriggerCreate:
|
||||||
required:
|
required:
|
||||||
- AssetID
|
- AssetID
|
||||||
@@ -1512,12 +1241,10 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
TargetAssetID:
|
TargetAssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Operation:
|
Operation:
|
||||||
required:
|
required:
|
||||||
- OperationID
|
- OperationID
|
||||||
@@ -1530,20 +1257,16 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
OperationID:
|
OperationID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
Date:
|
Date:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Owner:
|
Owner:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Status:
|
Status:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
StatusMessage:
|
StatusMessage:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 256
|
maxLength: 256
|
||||||
@@ -1571,8 +1294,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
DisplayName:
|
DisplayName:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1581,63 +1303,39 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
GameID:
|
GameID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
CreatedAt:
|
CreatedAt:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
UpdatedAt:
|
UpdatedAt:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Submitter:
|
Submitter:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
AssetVersion:
|
AssetVersion:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ValidatedAssetID:
|
ValidatedAssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ValidatedAssetVersion:
|
ValidatedAssetVersion:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Completed:
|
Completed:
|
||||||
type: boolean
|
type: boolean
|
||||||
UploadedAssetID:
|
UploadedAssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
StatusID:
|
StatusID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
StatusMessage:
|
StatusMessage:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 256
|
maxLength: 256
|
||||||
Submissions:
|
|
||||||
required:
|
|
||||||
- Total
|
|
||||||
- Submissions
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
Total:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
minimum: 0
|
|
||||||
Submissions:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/Submission"
|
|
||||||
SubmissionTriggerCreate:
|
SubmissionTriggerCreate:
|
||||||
required:
|
required:
|
||||||
- AssetID
|
- AssetID
|
||||||
@@ -1645,8 +1343,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
AssetID:
|
AssetID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ReleaseInfo:
|
ReleaseInfo:
|
||||||
required:
|
required:
|
||||||
- SubmissionID
|
- SubmissionID
|
||||||
@@ -1655,8 +1352,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
SubmissionID:
|
SubmissionID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Date:
|
Date:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@@ -1672,8 +1368,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Name:
|
Name:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1686,12 +1381,10 @@ components:
|
|||||||
maxLength: 1048576
|
maxLength: 1048576
|
||||||
ResourceType:
|
ResourceType:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ResourceID:
|
ResourceID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptCreate:
|
ScriptCreate:
|
||||||
required:
|
required:
|
||||||
- Name
|
- Name
|
||||||
@@ -1708,12 +1401,10 @@ components:
|
|||||||
maxLength: 1048576
|
maxLength: 1048576
|
||||||
ResourceType:
|
ResourceType:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ResourceID:
|
ResourceID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptUpdate:
|
ScriptUpdate:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -1721,8 +1412,7 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Name:
|
Name:
|
||||||
type: string
|
type: string
|
||||||
maxLength: 128
|
maxLength: 128
|
||||||
@@ -1731,12 +1421,10 @@ components:
|
|||||||
maxLength: 1048576
|
maxLength: 1048576
|
||||||
ResourceType:
|
ResourceType:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ResourceID:
|
ResourceID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ScriptPolicy:
|
ScriptPolicy:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -1747,20 +1435,17 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
FromScriptHash:
|
FromScriptHash:
|
||||||
type: string
|
type: string
|
||||||
minLength: 16
|
minLength: 16
|
||||||
maxLength: 16
|
maxLength: 16
|
||||||
ToScriptID:
|
ToScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Policy:
|
Policy:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyCreate:
|
ScriptPolicyCreate:
|
||||||
required:
|
required:
|
||||||
- FromScriptID
|
- FromScriptID
|
||||||
@@ -1770,16 +1455,13 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
FromScriptID:
|
FromScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ToScriptID:
|
ToScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Policy:
|
Policy:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
ScriptPolicyUpdate:
|
ScriptPolicyUpdate:
|
||||||
required:
|
required:
|
||||||
- ID
|
- ID
|
||||||
@@ -1787,28 +1469,23 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
ID:
|
ID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
FromScriptID:
|
FromScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
ToScriptID:
|
ToScriptID:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
Policy:
|
Policy:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: int32
|
||||||
minimum: 0
|
|
||||||
Error:
|
Error:
|
||||||
description: Represents error object
|
description: Represents error object
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
code:
|
code:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint64
|
format: int64
|
||||||
minimum: 0
|
|
||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -9,29 +9,25 @@ const (
|
|||||||
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
||||||
ActionMapfixRejectOperation OperationName = "ActionMapfixReject"
|
ActionMapfixRejectOperation OperationName = "ActionMapfixReject"
|
||||||
ActionMapfixRequestChangesOperation OperationName = "ActionMapfixRequestChanges"
|
ActionMapfixRequestChangesOperation OperationName = "ActionMapfixRequestChanges"
|
||||||
ActionMapfixResetSubmittingOperation OperationName = "ActionMapfixResetSubmitting"
|
|
||||||
ActionMapfixRetryValidateOperation OperationName = "ActionMapfixRetryValidate"
|
ActionMapfixRetryValidateOperation OperationName = "ActionMapfixRetryValidate"
|
||||||
ActionMapfixRevokeOperation OperationName = "ActionMapfixRevoke"
|
ActionMapfixRevokeOperation OperationName = "ActionMapfixRevoke"
|
||||||
ActionMapfixTriggerSubmitOperation OperationName = "ActionMapfixTriggerSubmit"
|
ActionMapfixSubmitOperation OperationName = "ActionMapfixSubmit"
|
||||||
ActionMapfixTriggerUploadOperation OperationName = "ActionMapfixTriggerUpload"
|
ActionMapfixTriggerUploadOperation OperationName = "ActionMapfixTriggerUpload"
|
||||||
ActionMapfixTriggerValidateOperation OperationName = "ActionMapfixTriggerValidate"
|
ActionMapfixTriggerValidateOperation OperationName = "ActionMapfixTriggerValidate"
|
||||||
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
||||||
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
||||||
ActionSubmissionRejectOperation OperationName = "ActionSubmissionReject"
|
ActionSubmissionRejectOperation OperationName = "ActionSubmissionReject"
|
||||||
ActionSubmissionRequestChangesOperation OperationName = "ActionSubmissionRequestChanges"
|
ActionSubmissionRequestChangesOperation OperationName = "ActionSubmissionRequestChanges"
|
||||||
ActionSubmissionResetSubmittingOperation OperationName = "ActionSubmissionResetSubmitting"
|
|
||||||
ActionSubmissionRetryValidateOperation OperationName = "ActionSubmissionRetryValidate"
|
ActionSubmissionRetryValidateOperation OperationName = "ActionSubmissionRetryValidate"
|
||||||
ActionSubmissionRevokeOperation OperationName = "ActionSubmissionRevoke"
|
ActionSubmissionRevokeOperation OperationName = "ActionSubmissionRevoke"
|
||||||
ActionSubmissionTriggerSubmitOperation OperationName = "ActionSubmissionTriggerSubmit"
|
ActionSubmissionSubmitOperation OperationName = "ActionSubmissionSubmit"
|
||||||
ActionSubmissionTriggerUploadOperation OperationName = "ActionSubmissionTriggerUpload"
|
ActionSubmissionTriggerUploadOperation OperationName = "ActionSubmissionTriggerUpload"
|
||||||
ActionSubmissionTriggerValidateOperation OperationName = "ActionSubmissionTriggerValidate"
|
ActionSubmissionTriggerValidateOperation OperationName = "ActionSubmissionTriggerValidate"
|
||||||
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
||||||
CreateMapfixOperation OperationName = "CreateMapfix"
|
CreateMapfixOperation OperationName = "CreateMapfix"
|
||||||
CreateMapfixAuditCommentOperation OperationName = "CreateMapfixAuditComment"
|
|
||||||
CreateScriptOperation OperationName = "CreateScript"
|
CreateScriptOperation OperationName = "CreateScript"
|
||||||
CreateScriptPolicyOperation OperationName = "CreateScriptPolicy"
|
CreateScriptPolicyOperation OperationName = "CreateScriptPolicy"
|
||||||
CreateSubmissionOperation OperationName = "CreateSubmission"
|
CreateSubmissionOperation OperationName = "CreateSubmission"
|
||||||
CreateSubmissionAuditCommentOperation OperationName = "CreateSubmissionAuditComment"
|
|
||||||
DeleteScriptOperation OperationName = "DeleteScript"
|
DeleteScriptOperation OperationName = "DeleteScript"
|
||||||
DeleteScriptPolicyOperation OperationName = "DeleteScriptPolicy"
|
DeleteScriptPolicyOperation OperationName = "DeleteScriptPolicy"
|
||||||
GetMapOperation OperationName = "GetMap"
|
GetMapOperation OperationName = "GetMap"
|
||||||
@@ -40,12 +36,10 @@ const (
|
|||||||
GetScriptOperation OperationName = "GetScript"
|
GetScriptOperation OperationName = "GetScript"
|
||||||
GetScriptPolicyOperation OperationName = "GetScriptPolicy"
|
GetScriptPolicyOperation OperationName = "GetScriptPolicy"
|
||||||
GetSubmissionOperation OperationName = "GetSubmission"
|
GetSubmissionOperation OperationName = "GetSubmission"
|
||||||
ListMapfixAuditEventsOperation OperationName = "ListMapfixAuditEvents"
|
|
||||||
ListMapfixesOperation OperationName = "ListMapfixes"
|
ListMapfixesOperation OperationName = "ListMapfixes"
|
||||||
ListMapsOperation OperationName = "ListMaps"
|
ListMapsOperation OperationName = "ListMaps"
|
||||||
ListScriptPolicyOperation OperationName = "ListScriptPolicy"
|
ListScriptPolicyOperation OperationName = "ListScriptPolicy"
|
||||||
ListScriptsOperation OperationName = "ListScripts"
|
ListScriptsOperation OperationName = "ListScripts"
|
||||||
ListSubmissionAuditEventsOperation OperationName = "ListSubmissionAuditEvents"
|
|
||||||
ListSubmissionsOperation OperationName = "ListSubmissions"
|
ListSubmissionsOperation OperationName = "ListSubmissions"
|
||||||
ReleaseSubmissionsOperation OperationName = "ReleaseSubmissions"
|
ReleaseSubmissionsOperation OperationName = "ReleaseSubmissions"
|
||||||
SessionRolesOperation OperationName = "SessionRoles"
|
SessionRolesOperation OperationName = "SessionRoles"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,6 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -73,54 +72,12 @@ func (s *Server) decodeCreateMapfixRequest(r *http.Request) (
|
|||||||
}
|
}
|
||||||
return req, close, err
|
return req, close, err
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := request.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &request, close, nil
|
return &request, close, nil
|
||||||
default:
|
default:
|
||||||
return req, close, validate.InvalidContentType(ct)
|
return req, close, validate.InvalidContentType(ct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) decodeCreateMapfixAuditCommentRequest(r *http.Request) (
|
|
||||||
req CreateMapfixAuditCommentReq,
|
|
||||||
close func() error,
|
|
||||||
rerr error,
|
|
||||||
) {
|
|
||||||
var closers []func() error
|
|
||||||
close = func() error {
|
|
||||||
var merr error
|
|
||||||
// Close in reverse order, to match defer behavior.
|
|
||||||
for i := len(closers) - 1; i >= 0; i-- {
|
|
||||||
c := closers[i]
|
|
||||||
merr = multierr.Append(merr, c())
|
|
||||||
}
|
|
||||||
return merr
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if rerr != nil {
|
|
||||||
rerr = multierr.Append(rerr, close())
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
|
||||||
if err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "parse media type")
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case ct == "text/plain":
|
|
||||||
reader := r.Body
|
|
||||||
request := CreateMapfixAuditCommentReq{Data: reader}
|
|
||||||
return request, close, nil
|
|
||||||
default:
|
|
||||||
return req, close, validate.InvalidContentType(ct)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) decodeCreateScriptRequest(r *http.Request) (
|
func (s *Server) decodeCreateScriptRequest(r *http.Request) (
|
||||||
req *ScriptCreate,
|
req *ScriptCreate,
|
||||||
close func() error,
|
close func() error,
|
||||||
@@ -249,14 +206,6 @@ func (s *Server) decodeCreateScriptPolicyRequest(r *http.Request) (
|
|||||||
}
|
}
|
||||||
return req, close, err
|
return req, close, err
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := request.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &request, close, nil
|
return &request, close, nil
|
||||||
default:
|
default:
|
||||||
return req, close, validate.InvalidContentType(ct)
|
return req, close, validate.InvalidContentType(ct)
|
||||||
@@ -320,54 +269,12 @@ func (s *Server) decodeCreateSubmissionRequest(r *http.Request) (
|
|||||||
}
|
}
|
||||||
return req, close, err
|
return req, close, err
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := request.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &request, close, nil
|
return &request, close, nil
|
||||||
default:
|
default:
|
||||||
return req, close, validate.InvalidContentType(ct)
|
return req, close, validate.InvalidContentType(ct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) decodeCreateSubmissionAuditCommentRequest(r *http.Request) (
|
|
||||||
req CreateSubmissionAuditCommentReq,
|
|
||||||
close func() error,
|
|
||||||
rerr error,
|
|
||||||
) {
|
|
||||||
var closers []func() error
|
|
||||||
close = func() error {
|
|
||||||
var merr error
|
|
||||||
// Close in reverse order, to match defer behavior.
|
|
||||||
for i := len(closers) - 1; i >= 0; i-- {
|
|
||||||
c := closers[i]
|
|
||||||
merr = multierr.Append(merr, c())
|
|
||||||
}
|
|
||||||
return merr
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if rerr != nil {
|
|
||||||
rerr = multierr.Append(rerr, close())
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
|
||||||
if err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "parse media type")
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case ct == "text/plain":
|
|
||||||
reader := r.Body
|
|
||||||
request := CreateSubmissionAuditCommentReq{Data: reader}
|
|
||||||
return request, close, nil
|
|
||||||
default:
|
|
||||||
return req, close, validate.InvalidContentType(ct)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) decodeReleaseSubmissionsRequest(r *http.Request) (
|
func (s *Server) decodeReleaseSubmissionsRequest(r *http.Request) (
|
||||||
req []ReleaseInfo,
|
req []ReleaseInfo,
|
||||||
close func() error,
|
close func() error,
|
||||||
@@ -445,23 +352,6 @@ func (s *Server) decodeReleaseSubmissionsRequest(r *http.Request) (
|
|||||||
}).ValidateLength(len(request)); err != nil {
|
}).ValidateLength(len(request)); err != nil {
|
||||||
return errors.Wrap(err, "array")
|
return errors.Wrap(err, "array")
|
||||||
}
|
}
|
||||||
var failures []validate.FieldError
|
|
||||||
for i, elem := range request {
|
|
||||||
if err := func() error {
|
|
||||||
if err := elem.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: fmt.Sprintf("[%d]", i),
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return req, close, errors.Wrap(err, "validate")
|
return req, close, errors.Wrap(err, "validate")
|
||||||
@@ -600,14 +490,6 @@ func (s *Server) decodeUpdateScriptPolicyRequest(r *http.Request) (
|
|||||||
}
|
}
|
||||||
return req, close, err
|
return req, close, err
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := request.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &request, close, nil
|
return &request, close, nil
|
||||||
default:
|
default:
|
||||||
return req, close, validate.InvalidContentType(ct)
|
return req, close, validate.InvalidContentType(ct)
|
||||||
|
|||||||
@@ -25,16 +25,6 @@ func encodeCreateMapfixRequest(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeCreateMapfixAuditCommentRequest(
|
|
||||||
req CreateMapfixAuditCommentReq,
|
|
||||||
r *http.Request,
|
|
||||||
) error {
|
|
||||||
const contentType = "text/plain"
|
|
||||||
body := req
|
|
||||||
ht.SetBody(r, body, contentType)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeCreateScriptRequest(
|
func encodeCreateScriptRequest(
|
||||||
req *ScriptCreate,
|
req *ScriptCreate,
|
||||||
r *http.Request,
|
r *http.Request,
|
||||||
@@ -77,16 +67,6 @@ func encodeCreateSubmissionRequest(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeCreateSubmissionAuditCommentRequest(
|
|
||||||
req CreateSubmissionAuditCommentReq,
|
|
||||||
r *http.Request,
|
|
||||||
) error {
|
|
||||||
const contentType = "text/plain"
|
|
||||||
body := req
|
|
||||||
ht.SetBody(r, body, contentType)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeReleaseSubmissionsRequest(
|
func encodeReleaseSubmissionsRequest(
|
||||||
req []ReleaseInfo,
|
req []ReleaseInfo,
|
||||||
r *http.Request,
|
r *http.Request,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,13 +34,6 @@ func encodeActionMapfixRequestChangesResponse(response *ActionMapfixRequestChang
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionMapfixResetSubmittingResponse(response *ActionMapfixResetSubmittingNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeActionMapfixRetryValidateResponse(response *ActionMapfixRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixRetryValidateResponse(response *ActionMapfixRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -55,7 +48,7 @@ func encodeActionMapfixRevokeResponse(response *ActionMapfixRevokeNoContent, w h
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionMapfixTriggerSubmitResponse(response *ActionMapfixTriggerSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixSubmitResponse(response *ActionMapfixSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
@@ -104,13 +97,6 @@ func encodeActionSubmissionRequestChangesResponse(response *ActionSubmissionRequ
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionSubmissionResetSubmittingResponse(response *ActionSubmissionResetSubmittingNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeActionSubmissionRetryValidateResponse(response *ActionSubmissionRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionSubmissionRetryValidateResponse(response *ActionSubmissionRetryValidateNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -125,7 +111,7 @@ func encodeActionSubmissionRevokeResponse(response *ActionSubmissionRevokeNoCont
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionSubmissionTriggerSubmitResponse(response *ActionSubmissionTriggerSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionSubmissionSubmitResponse(response *ActionSubmissionSubmitNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|
||||||
@@ -167,13 +153,6 @@ func encodeCreateMapfixResponse(response *OperationID, w http.ResponseWriter, sp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeCreateMapfixAuditCommentResponse(response *CreateMapfixAuditCommentNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeCreateScriptResponse(response *ScriptID, w http.ResponseWriter, span trace.Span) error {
|
func encodeCreateScriptResponse(response *ScriptID, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.WriteHeader(201)
|
w.WriteHeader(201)
|
||||||
@@ -216,13 +195,6 @@ func encodeCreateSubmissionResponse(response *OperationID, w http.ResponseWriter
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeCreateSubmissionAuditCommentResponse(response *CreateSubmissionAuditCommentNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeDeleteScriptResponse(response *DeleteScriptNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeDeleteScriptResponse(response *DeleteScriptNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -321,7 +293,7 @@ func encodeGetSubmissionResponse(response *Submission, w http.ResponseWriter, sp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeListMapfixAuditEventsResponse(response []AuditEvent, w http.ResponseWriter, span trace.Span) error {
|
func encodeListMapfixesResponse(response []Mapfix, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||||
@@ -339,20 +311,6 @@ func encodeListMapfixAuditEventsResponse(response []AuditEvent, w http.ResponseW
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeListMapfixesResponse(response *Mapfixes, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
w.WriteHeader(200)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
||||||
|
|
||||||
e := new(jx.Encoder)
|
|
||||||
response.Encode(e)
|
|
||||||
if _, err := e.WriteTo(w); err != nil {
|
|
||||||
return errors.Wrap(err, "write")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeListMapsResponse(response []Map, w http.ResponseWriter, span trace.Span) error {
|
func encodeListMapsResponse(response []Map, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
@@ -407,7 +365,7 @@ func encodeListScriptsResponse(response []Script, w http.ResponseWriter, span tr
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeListSubmissionAuditEventsResponse(response []AuditEvent, w http.ResponseWriter, span trace.Span) error {
|
func encodeListSubmissionsResponse(response []Submission, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||||
@@ -425,20 +383,6 @@ func encodeListSubmissionAuditEventsResponse(response []AuditEvent, w http.Respo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeListSubmissionsResponse(response *Submissions, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
w.WriteHeader(200)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
||||||
|
|
||||||
e := new(jx.Encoder)
|
|
||||||
response.Encode(e)
|
|
||||||
if _, err := e.WriteTo(w); err != nil {
|
|
||||||
return errors.Wrap(err, "write")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeReleaseSubmissionsResponse(response *ReleaseSubmissionsCreated, w http.ResponseWriter, span trace.Span) error {
|
func encodeReleaseSubmissionsResponse(response *ReleaseSubmissionsCreated, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(201)
|
w.WriteHeader(201)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(201))
|
span.SetStatus(codes.Ok, http.StatusText(201))
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 'a': // Prefix: "audit-events"
|
case 'c': // Prefix: "completed"
|
||||||
|
|
||||||
if l := len("audit-events"); len(elem) >= l && elem[0:l] == "audit-events" {
|
if l := len("completed"); len(elem) >= l && elem[0:l] == "completed" {
|
||||||
elem = elem[l:]
|
elem = elem[l:]
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@@ -147,75 +147,17 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
if len(elem) == 0 {
|
if len(elem) == 0 {
|
||||||
// Leaf node.
|
// Leaf node.
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "GET":
|
case "POST":
|
||||||
s.handleListMapfixAuditEventsRequest([1]string{
|
s.handleSetMapfixCompletedRequest([1]string{
|
||||||
args[0],
|
args[0],
|
||||||
}, elemIsEscaped, w, r)
|
}, elemIsEscaped, w, r)
|
||||||
default:
|
default:
|
||||||
s.notAllowed(w, r, "GET")
|
s.notAllowed(w, r, "POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'c': // Prefix: "com"
|
|
||||||
|
|
||||||
if l := len("com"); len(elem) >= l && elem[0:l] == "com" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
switch elem[0] {
|
|
||||||
case 'm': // Prefix: "ment"
|
|
||||||
|
|
||||||
if l := len("ment"); len(elem) >= l && elem[0:l] == "ment" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleCreateMapfixAuditCommentRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'p': // Prefix: "pleted"
|
|
||||||
|
|
||||||
if l := len("pleted"); len(elem) >= l && elem[0:l] == "pleted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleSetMapfixCompletedRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'm': // Prefix: "model"
|
case 'm': // Prefix: "model"
|
||||||
|
|
||||||
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
||||||
@@ -318,28 +260,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submitting"
|
|
||||||
|
|
||||||
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionMapfixResetSubmittingRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -432,6 +352,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionMapfixSubmitRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -444,28 +386,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionMapfixTriggerSubmitRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -912,9 +832,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 'a': // Prefix: "audit-events"
|
case 'c': // Prefix: "completed"
|
||||||
|
|
||||||
if l := len("audit-events"); len(elem) >= l && elem[0:l] == "audit-events" {
|
if l := len("completed"); len(elem) >= l && elem[0:l] == "completed" {
|
||||||
elem = elem[l:]
|
elem = elem[l:]
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@@ -923,75 +843,17 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
if len(elem) == 0 {
|
if len(elem) == 0 {
|
||||||
// Leaf node.
|
// Leaf node.
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "GET":
|
case "POST":
|
||||||
s.handleListSubmissionAuditEventsRequest([1]string{
|
s.handleSetSubmissionCompletedRequest([1]string{
|
||||||
args[0],
|
args[0],
|
||||||
}, elemIsEscaped, w, r)
|
}, elemIsEscaped, w, r)
|
||||||
default:
|
default:
|
||||||
s.notAllowed(w, r, "GET")
|
s.notAllowed(w, r, "POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'c': // Prefix: "com"
|
|
||||||
|
|
||||||
if l := len("com"); len(elem) >= l && elem[0:l] == "com" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
switch elem[0] {
|
|
||||||
case 'm': // Prefix: "ment"
|
|
||||||
|
|
||||||
if l := len("ment"); len(elem) >= l && elem[0:l] == "ment" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleCreateSubmissionAuditCommentRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'p': // Prefix: "pleted"
|
|
||||||
|
|
||||||
if l := len("pleted"); len(elem) >= l && elem[0:l] == "pleted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleSetSubmissionCompletedRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'm': // Prefix: "model"
|
case 'm': // Prefix: "model"
|
||||||
|
|
||||||
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
||||||
@@ -1094,28 +956,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submitting"
|
|
||||||
|
|
||||||
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionSubmissionResetSubmittingRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -1208,6 +1048,28 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch r.Method {
|
||||||
|
case "POST":
|
||||||
|
s.handleActionSubmissionSubmitRequest([1]string{
|
||||||
|
args[0],
|
||||||
|
}, elemIsEscaped, w, r)
|
||||||
|
default:
|
||||||
|
s.notAllowed(w, r, "POST")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -1220,28 +1082,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionSubmissionTriggerSubmitRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -1479,9 +1319,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 'a': // Prefix: "audit-events"
|
case 'c': // Prefix: "completed"
|
||||||
|
|
||||||
if l := len("audit-events"); len(elem) >= l && elem[0:l] == "audit-events" {
|
if l := len("completed"); len(elem) >= l && elem[0:l] == "completed" {
|
||||||
elem = elem[l:]
|
elem = elem[l:]
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@@ -1490,11 +1330,11 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
if len(elem) == 0 {
|
if len(elem) == 0 {
|
||||||
// Leaf node.
|
// Leaf node.
|
||||||
switch method {
|
switch method {
|
||||||
case "GET":
|
case "POST":
|
||||||
r.name = ListMapfixAuditEventsOperation
|
r.name = SetMapfixCompletedOperation
|
||||||
r.summary = "Retrieve a list of audit events"
|
r.summary = "Called by maptest when a player completes the map"
|
||||||
r.operationID = "listMapfixAuditEvents"
|
r.operationID = "setMapfixCompleted"
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/audit-events"
|
r.pathPattern = "/mapfixes/{MapfixID}/completed"
|
||||||
r.args = args
|
r.args = args
|
||||||
r.count = 1
|
r.count = 1
|
||||||
return r, true
|
return r, true
|
||||||
@@ -1503,68 +1343,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'c': // Prefix: "com"
|
|
||||||
|
|
||||||
if l := len("com"); len(elem) >= l && elem[0:l] == "com" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
switch elem[0] {
|
|
||||||
case 'm': // Prefix: "ment"
|
|
||||||
|
|
||||||
if l := len("ment"); len(elem) >= l && elem[0:l] == "ment" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = CreateMapfixAuditCommentOperation
|
|
||||||
r.summary = "Post a comment to the audit log"
|
|
||||||
r.operationID = "createMapfixAuditComment"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/comment"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'p': // Prefix: "pleted"
|
|
||||||
|
|
||||||
if l := len("pleted"); len(elem) >= l && elem[0:l] == "pleted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = SetMapfixCompletedOperation
|
|
||||||
r.summary = "Called by maptest when a player completes the map"
|
|
||||||
r.operationID = "setMapfixCompleted"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/completed"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'm': // Prefix: "model"
|
case 'm': // Prefix: "model"
|
||||||
|
|
||||||
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
||||||
@@ -1673,30 +1451,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submitting"
|
|
||||||
|
|
||||||
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionMapfixResetSubmittingOperation
|
|
||||||
r.summary = "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction"
|
|
||||||
r.operationID = "actionMapfixResetSubmitting"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/status/reset-submitting"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -1797,6 +1551,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionMapfixSubmitOperation
|
||||||
|
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted"
|
||||||
|
r.operationID = "actionMapfixSubmit"
|
||||||
|
r.pathPattern = "/mapfixes/{MapfixID}/status/submit"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -1809,30 +1587,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionMapfixTriggerSubmitOperation
|
|
||||||
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting"
|
|
||||||
r.operationID = "actionMapfixTriggerSubmit"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/status/trigger-submit"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
@@ -2359,9 +2113,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 'a': // Prefix: "audit-events"
|
case 'c': // Prefix: "completed"
|
||||||
|
|
||||||
if l := len("audit-events"); len(elem) >= l && elem[0:l] == "audit-events" {
|
if l := len("completed"); len(elem) >= l && elem[0:l] == "completed" {
|
||||||
elem = elem[l:]
|
elem = elem[l:]
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@@ -2370,11 +2124,11 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
if len(elem) == 0 {
|
if len(elem) == 0 {
|
||||||
// Leaf node.
|
// Leaf node.
|
||||||
switch method {
|
switch method {
|
||||||
case "GET":
|
case "POST":
|
||||||
r.name = ListSubmissionAuditEventsOperation
|
r.name = SetSubmissionCompletedOperation
|
||||||
r.summary = "Retrieve a list of audit events"
|
r.summary = "Called by maptest when a player completes the map"
|
||||||
r.operationID = "listSubmissionAuditEvents"
|
r.operationID = "setSubmissionCompleted"
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/audit-events"
|
r.pathPattern = "/submissions/{SubmissionID}/completed"
|
||||||
r.args = args
|
r.args = args
|
||||||
r.count = 1
|
r.count = 1
|
||||||
return r, true
|
return r, true
|
||||||
@@ -2383,68 +2137,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'c': // Prefix: "com"
|
|
||||||
|
|
||||||
if l := len("com"); len(elem) >= l && elem[0:l] == "com" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
switch elem[0] {
|
|
||||||
case 'm': // Prefix: "ment"
|
|
||||||
|
|
||||||
if l := len("ment"); len(elem) >= l && elem[0:l] == "ment" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = CreateSubmissionAuditCommentOperation
|
|
||||||
r.summary = "Post a comment to the audit log"
|
|
||||||
r.operationID = "createSubmissionAuditComment"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/comment"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'p': // Prefix: "pleted"
|
|
||||||
|
|
||||||
if l := len("pleted"); len(elem) >= l && elem[0:l] == "pleted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = SetSubmissionCompletedOperation
|
|
||||||
r.summary = "Called by maptest when a player completes the map"
|
|
||||||
r.operationID = "setSubmissionCompleted"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/completed"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'm': // Prefix: "model"
|
case 'm': // Prefix: "model"
|
||||||
|
|
||||||
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
if l := len("model"); len(elem) >= l && elem[0:l] == "model" {
|
||||||
@@ -2553,30 +2245,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submitting"
|
|
||||||
|
|
||||||
if l := len("submitting"); len(elem) >= l && elem[0:l] == "submitting" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionSubmissionResetSubmittingOperation
|
|
||||||
r.summary = "Role Submitter manually resets submitting softlock and changes status from Submitting -> UnderConstruction"
|
|
||||||
r.operationID = "actionSubmissionResetSubmitting"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/status/reset-submitting"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploading"
|
case 'u': // Prefix: "uploading"
|
||||||
|
|
||||||
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
if l := len("uploading"); len(elem) >= l && elem[0:l] == "uploading" {
|
||||||
@@ -2677,6 +2345,30 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 's': // Prefix: "submit"
|
||||||
|
|
||||||
|
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
||||||
|
elem = elem[l:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(elem) == 0 {
|
||||||
|
// Leaf node.
|
||||||
|
switch method {
|
||||||
|
case "POST":
|
||||||
|
r.name = ActionSubmissionSubmitOperation
|
||||||
|
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted"
|
||||||
|
r.operationID = "actionSubmissionSubmit"
|
||||||
|
r.pathPattern = "/submissions/{SubmissionID}/status/submit"
|
||||||
|
r.args = args
|
||||||
|
r.count = 1
|
||||||
|
return r, true
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 't': // Prefix: "trigger-"
|
case 't': // Prefix: "trigger-"
|
||||||
|
|
||||||
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
if l := len("trigger-"); len(elem) >= l && elem[0:l] == "trigger-" {
|
||||||
@@ -2689,30 +2381,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
switch elem[0] {
|
switch elem[0] {
|
||||||
case 's': // Prefix: "submit"
|
|
||||||
|
|
||||||
if l := len("submit"); len(elem) >= l && elem[0:l] == "submit" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionSubmissionTriggerSubmitOperation
|
|
||||||
r.summary = "Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting"
|
|
||||||
r.operationID = "actionSubmissionTriggerSubmit"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/status/trigger-submit"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "upload"
|
case 'u': // Prefix: "upload"
|
||||||
|
|
||||||
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
if l := len("upload"); len(elem) >= l && elem[0:l] == "upload" {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -26,13 +26,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/request-changes
|
// POST /mapfixes/{MapfixID}/status/request-changes
|
||||||
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
ActionMapfixRequestChanges(ctx context.Context, params ActionMapfixRequestChangesParams) error
|
||||||
// ActionMapfixResetSubmitting implements actionMapfixResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
|
||||||
// UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
|
||||||
ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error
|
|
||||||
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -45,12 +38,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/revoke
|
// POST /mapfixes/{MapfixID}/status/revoke
|
||||||
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
ActionMapfixRevoke(ctx context.Context, params ActionMapfixRevokeParams) error
|
||||||
// ActionMapfixTriggerSubmit implements actionMapfixTriggerSubmit operation.
|
// ActionMapfixSubmit implements actionMapfixSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
// POST /mapfixes/{MapfixID}/status/submit
|
||||||
ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error
|
ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error
|
||||||
// ActionMapfixTriggerUpload implements actionMapfixTriggerUpload operation.
|
// ActionMapfixTriggerUpload implements actionMapfixTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
@@ -87,13 +80,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/request-changes
|
// POST /submissions/{SubmissionID}/status/request-changes
|
||||||
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
ActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) error
|
||||||
// ActionSubmissionResetSubmitting implements actionSubmissionResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
|
||||||
// UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/reset-submitting
|
|
||||||
ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error
|
|
||||||
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -106,12 +92,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/revoke
|
// POST /submissions/{SubmissionID}/status/revoke
|
||||||
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
ActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) error
|
||||||
// ActionSubmissionTriggerSubmit implements actionSubmissionTriggerSubmit operation.
|
// ActionSubmissionSubmit implements actionSubmissionSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/trigger-submit
|
// POST /submissions/{SubmissionID}/status/submit
|
||||||
ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error
|
ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error
|
||||||
// ActionSubmissionTriggerUpload implements actionSubmissionTriggerUpload operation.
|
// ActionSubmissionTriggerUpload implements actionSubmissionTriggerUpload operation.
|
||||||
//
|
//
|
||||||
// Role Admin changes status from Validated -> Uploading.
|
// Role Admin changes status from Validated -> Uploading.
|
||||||
@@ -136,12 +122,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes
|
// POST /mapfixes
|
||||||
CreateMapfix(ctx context.Context, req *MapfixTriggerCreate) (*OperationID, error)
|
CreateMapfix(ctx context.Context, req *MapfixTriggerCreate) (*OperationID, error)
|
||||||
// CreateMapfixAuditComment implements createMapfixAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/comment
|
|
||||||
CreateMapfixAuditComment(ctx context.Context, req CreateMapfixAuditCommentReq, params CreateMapfixAuditCommentParams) error
|
|
||||||
// CreateScript implements createScript operation.
|
// CreateScript implements createScript operation.
|
||||||
//
|
//
|
||||||
// Create a new script.
|
// Create a new script.
|
||||||
@@ -160,12 +140,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions
|
// POST /submissions
|
||||||
CreateSubmission(ctx context.Context, req *SubmissionTriggerCreate) (*OperationID, error)
|
CreateSubmission(ctx context.Context, req *SubmissionTriggerCreate) (*OperationID, error)
|
||||||
// CreateSubmissionAuditComment implements createSubmissionAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/comment
|
|
||||||
CreateSubmissionAuditComment(ctx context.Context, req CreateSubmissionAuditCommentReq, params CreateSubmissionAuditCommentParams) error
|
|
||||||
// DeleteScript implements deleteScript operation.
|
// DeleteScript implements deleteScript operation.
|
||||||
//
|
//
|
||||||
// Delete the specified script by ID.
|
// Delete the specified script by ID.
|
||||||
@@ -214,18 +188,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// GET /submissions/{SubmissionID}
|
// GET /submissions/{SubmissionID}
|
||||||
GetSubmission(ctx context.Context, params GetSubmissionParams) (*Submission, error)
|
GetSubmission(ctx context.Context, params GetSubmissionParams) (*Submission, error)
|
||||||
// ListMapfixAuditEvents implements listMapfixAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /mapfixes/{MapfixID}/audit-events
|
|
||||||
ListMapfixAuditEvents(ctx context.Context, params ListMapfixAuditEventsParams) ([]AuditEvent, error)
|
|
||||||
// ListMapfixes implements listMapfixes operation.
|
// ListMapfixes implements listMapfixes operation.
|
||||||
//
|
//
|
||||||
// Get list of mapfixes.
|
// Get list of mapfixes.
|
||||||
//
|
//
|
||||||
// GET /mapfixes
|
// GET /mapfixes
|
||||||
ListMapfixes(ctx context.Context, params ListMapfixesParams) (*Mapfixes, error)
|
ListMapfixes(ctx context.Context, params ListMapfixesParams) ([]Mapfix, error)
|
||||||
// ListMaps implements listMaps operation.
|
// ListMaps implements listMaps operation.
|
||||||
//
|
//
|
||||||
// Get list of maps.
|
// Get list of maps.
|
||||||
@@ -244,18 +212,12 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// GET /scripts
|
// GET /scripts
|
||||||
ListScripts(ctx context.Context, params ListScriptsParams) ([]Script, error)
|
ListScripts(ctx context.Context, params ListScriptsParams) ([]Script, error)
|
||||||
// ListSubmissionAuditEvents implements listSubmissionAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /submissions/{SubmissionID}/audit-events
|
|
||||||
ListSubmissionAuditEvents(ctx context.Context, params ListSubmissionAuditEventsParams) ([]AuditEvent, error)
|
|
||||||
// ListSubmissions implements listSubmissions operation.
|
// ListSubmissions implements listSubmissions operation.
|
||||||
//
|
//
|
||||||
// Get list of submissions.
|
// Get list of submissions.
|
||||||
//
|
//
|
||||||
// GET /submissions
|
// GET /submissions
|
||||||
ListSubmissions(ctx context.Context, params ListSubmissionsParams) (*Submissions, error)
|
ListSubmissions(ctx context.Context, params ListSubmissionsParams) ([]Submission, error)
|
||||||
// ReleaseSubmissions implements releaseSubmissions operation.
|
// ReleaseSubmissions implements releaseSubmissions operation.
|
||||||
//
|
//
|
||||||
// Release a set of uploaded maps.
|
// Release a set of uploaded maps.
|
||||||
|
|||||||
@@ -40,16 +40,6 @@ func (UnimplementedHandler) ActionMapfixRequestChanges(ctx context.Context, para
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixResetSubmitting implements actionMapfixResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
|
||||||
// UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
|
||||||
func (UnimplementedHandler) ActionMapfixResetSubmitting(ctx context.Context, params ActionMapfixResetSubmittingParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
// ActionMapfixRetryValidate implements actionMapfixRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -68,12 +58,12 @@ func (UnimplementedHandler) ActionMapfixRevoke(ctx context.Context, params Actio
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixTriggerSubmit implements actionMapfixTriggerSubmit operation.
|
// ActionMapfixSubmit implements actionMapfixSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
// POST /mapfixes/{MapfixID}/status/submit
|
||||||
func (UnimplementedHandler) ActionMapfixTriggerSubmit(ctx context.Context, params ActionMapfixTriggerSubmitParams) error {
|
func (UnimplementedHandler) ActionMapfixSubmit(ctx context.Context, params ActionMapfixSubmitParams) error {
|
||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,16 +121,6 @@ func (UnimplementedHandler) ActionSubmissionRequestChanges(ctx context.Context,
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionResetSubmitting implements actionSubmissionResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role Submitter manually resets submitting softlock and changes status from Submitting ->
|
|
||||||
// UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/reset-submitting
|
|
||||||
func (UnimplementedHandler) ActionSubmissionResetSubmitting(ctx context.Context, params ActionSubmissionResetSubmittingParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
// ActionSubmissionRetryValidate implements actionSubmissionRetryValidate operation.
|
||||||
//
|
//
|
||||||
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
// Role Reviewer re-runs validation and changes status from Accepted -> Validating.
|
||||||
@@ -159,12 +139,12 @@ func (UnimplementedHandler) ActionSubmissionRevoke(ctx context.Context, params A
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionTriggerSubmit implements actionSubmissionTriggerSubmit operation.
|
// ActionSubmissionSubmit implements actionSubmissionSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/trigger-submit
|
// POST /submissions/{SubmissionID}/status/submit
|
||||||
func (UnimplementedHandler) ActionSubmissionTriggerSubmit(ctx context.Context, params ActionSubmissionTriggerSubmitParams) error {
|
func (UnimplementedHandler) ActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) error {
|
||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,15 +184,6 @@ func (UnimplementedHandler) CreateMapfix(ctx context.Context, req *MapfixTrigger
|
|||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateMapfixAuditComment implements createMapfixAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/comment
|
|
||||||
func (UnimplementedHandler) CreateMapfixAuditComment(ctx context.Context, req CreateMapfixAuditCommentReq, params CreateMapfixAuditCommentParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateScript implements createScript operation.
|
// CreateScript implements createScript operation.
|
||||||
//
|
//
|
||||||
// Create a new script.
|
// Create a new script.
|
||||||
@@ -240,15 +211,6 @@ func (UnimplementedHandler) CreateSubmission(ctx context.Context, req *Submissio
|
|||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateSubmissionAuditComment implements createSubmissionAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/comment
|
|
||||||
func (UnimplementedHandler) CreateSubmissionAuditComment(ctx context.Context, req CreateSubmissionAuditCommentReq, params CreateSubmissionAuditCommentParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteScript implements deleteScript operation.
|
// DeleteScript implements deleteScript operation.
|
||||||
//
|
//
|
||||||
// Delete the specified script by ID.
|
// Delete the specified script by ID.
|
||||||
@@ -321,21 +283,12 @@ func (UnimplementedHandler) GetSubmission(ctx context.Context, params GetSubmiss
|
|||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListMapfixAuditEvents implements listMapfixAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /mapfixes/{MapfixID}/audit-events
|
|
||||||
func (UnimplementedHandler) ListMapfixAuditEvents(ctx context.Context, params ListMapfixAuditEventsParams) (r []AuditEvent, _ error) {
|
|
||||||
return r, ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListMapfixes implements listMapfixes operation.
|
// ListMapfixes implements listMapfixes operation.
|
||||||
//
|
//
|
||||||
// Get list of mapfixes.
|
// Get list of mapfixes.
|
||||||
//
|
//
|
||||||
// GET /mapfixes
|
// GET /mapfixes
|
||||||
func (UnimplementedHandler) ListMapfixes(ctx context.Context, params ListMapfixesParams) (r *Mapfixes, _ error) {
|
func (UnimplementedHandler) ListMapfixes(ctx context.Context, params ListMapfixesParams) (r []Mapfix, _ error) {
|
||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,21 +319,12 @@ func (UnimplementedHandler) ListScripts(ctx context.Context, params ListScriptsP
|
|||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSubmissionAuditEvents implements listSubmissionAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /submissions/{SubmissionID}/audit-events
|
|
||||||
func (UnimplementedHandler) ListSubmissionAuditEvents(ctx context.Context, params ListSubmissionAuditEventsParams) (r []AuditEvent, _ error) {
|
|
||||||
return r, ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSubmissions implements listSubmissions operation.
|
// ListSubmissions implements listSubmissions operation.
|
||||||
//
|
//
|
||||||
// Get list of submissions.
|
// Get list of submissions.
|
||||||
//
|
//
|
||||||
// GET /submissions
|
// GET /submissions
|
||||||
func (UnimplementedHandler) ListSubmissions(ctx context.Context, params ListSubmissionsParams) (r *Submissions, _ error) {
|
func (UnimplementedHandler) ListSubmissions(ctx context.Context, params ListSubmissionsParams) (r []Submission, _ error) {
|
||||||
return r, ht.ErrNotImplemented
|
return r, ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,6 @@ package datastore
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,7 +22,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Datastore interface {
|
type Datastore interface {
|
||||||
AuditEvents() AuditEvents
|
|
||||||
Mapfixes() Mapfixes
|
Mapfixes() Mapfixes
|
||||||
Operations() Operations
|
Operations() Operations
|
||||||
Submissions() Submissions
|
Submissions() Submissions
|
||||||
@@ -32,14 +29,6 @@ type Datastore interface {
|
|||||||
ScriptPolicy() ScriptPolicy
|
ScriptPolicy() ScriptPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuditEvents interface {
|
|
||||||
Get(ctx context.Context, id int64) (model.AuditEvent, error)
|
|
||||||
Create(ctx context.Context, smap model.AuditEvent) (model.AuditEvent, error)
|
|
||||||
Update(ctx context.Context, id int64, values OptionalMap) error
|
|
||||||
Delete(ctx context.Context, id int64) error
|
|
||||||
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.AuditEvent, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Mapfixes interface {
|
type Mapfixes interface {
|
||||||
Get(ctx context.Context, id int64) (model.Mapfix, error)
|
Get(ctx context.Context, id int64) (model.Mapfix, error)
|
||||||
GetList(ctx context.Context, id []int64) ([]model.Mapfix, error)
|
GetList(ctx context.Context, id []int64) ([]model.Mapfix, error)
|
||||||
@@ -49,7 +38,7 @@ type Mapfixes interface {
|
|||||||
IfStatusThenUpdateAndGet(ctx context.Context, id int64, statuses []model.MapfixStatus, values OptionalMap) (model.Mapfix, error)
|
IfStatusThenUpdateAndGet(ctx context.Context, id int64, statuses []model.MapfixStatus, values OptionalMap) (model.Mapfix, error)
|
||||||
Delete(ctx context.Context, id int64) error
|
Delete(ctx context.Context, id int64) error
|
||||||
List(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) ([]model.Mapfix, error)
|
List(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) ([]model.Mapfix, error)
|
||||||
ListWithTotal(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) (uint64, []model.Mapfix, error)
|
ListRestricted(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort, submitter int64) ([]model.Mapfix, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Operations interface {
|
type Operations interface {
|
||||||
@@ -57,7 +46,6 @@ type Operations interface {
|
|||||||
Create(ctx context.Context, smap model.Operation) (model.Operation, error)
|
Create(ctx context.Context, smap model.Operation) (model.Operation, error)
|
||||||
Update(ctx context.Context, id int32, values OptionalMap) error
|
Update(ctx context.Context, id int32, values OptionalMap) error
|
||||||
Delete(ctx context.Context, id int32) error
|
Delete(ctx context.Context, id int32) error
|
||||||
CountSince(ctx context.Context, owner int64, since time.Time) (int64, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Submissions interface {
|
type Submissions interface {
|
||||||
@@ -69,7 +57,7 @@ type Submissions interface {
|
|||||||
IfStatusThenUpdateAndGet(ctx context.Context, id int64, statuses []model.SubmissionStatus, values OptionalMap) (model.Submission, error)
|
IfStatusThenUpdateAndGet(ctx context.Context, id int64, statuses []model.SubmissionStatus, values OptionalMap) (model.Submission, error)
|
||||||
Delete(ctx context.Context, id int64) error
|
Delete(ctx context.Context, id int64) error
|
||||||
List(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) ([]model.Submission, error)
|
List(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) ([]model.Submission, error)
|
||||||
ListWithTotal(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort) (int64, []model.Submission, error)
|
ListRestricted(ctx context.Context, filters OptionalMap, page model.Page, sort ListSort, submitter int64) ([]model.Submission, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Scripts interface {
|
type Scripts interface {
|
||||||
|
|||||||
@@ -10,17 +10,7 @@ func Optional() OptionalMap {
|
|||||||
return OptionalMap{filter: map[string]interface{}{}}
|
return OptionalMap{filter: map[string]interface{}{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q OptionalMap) Add2(column string, value interface{}) OptionalMap {
|
func (q OptionalMap) Add(column string, value interface{}) OptionalMap {
|
||||||
q.filter[column] = value
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q OptionalMap) AddPostgresInt32(column string, value uint32) OptionalMap {
|
|
||||||
q.filter[column] = value
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q OptionalMap) AddPostgresInt64(column string, value uint64) OptionalMap {
|
|
||||||
q.filter[column] = value
|
q.filter[column] = value
|
||||||
return q
|
return q
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package gormstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AuditEvents struct {
|
|
||||||
db *gorm.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *AuditEvents) Get(ctx context.Context, id int64) (model.AuditEvent, error) {
|
|
||||||
var mdl model.AuditEvent
|
|
||||||
if err := env.db.First(&mdl, id).Error; err != nil {
|
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return mdl, datastore.ErrNotExist
|
|
||||||
}
|
|
||||||
return mdl, err
|
|
||||||
}
|
|
||||||
return mdl, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *AuditEvents) Create(ctx context.Context, smap model.AuditEvent) (model.AuditEvent, error) {
|
|
||||||
if err := env.db.Create(&smap).Error; err != nil {
|
|
||||||
return smap, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return smap, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *AuditEvents) Update(ctx context.Context, id int64, values datastore.OptionalMap) error {
|
|
||||||
if err := env.db.Model(&model.AuditEvent{}).Where("id = ?", id).Updates(values.Map()).Error; err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return datastore.ErrNotExist
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *AuditEvents) Delete(ctx context.Context, id int64) error {
|
|
||||||
if err := env.db.Delete(&model.AuditEvent{}, id).Error; err != nil {
|
|
||||||
if err == gorm.ErrRecordNotFound {
|
|
||||||
return datastore.ErrNotExist
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *AuditEvents) List(ctx context.Context, filters datastore.OptionalMap, page model.Page) ([]model.AuditEvent, error) {
|
|
||||||
var events []model.AuditEvent
|
|
||||||
if err := env.db.Where(filters.Map()).Offset(int((page.Number - 1) * page.Size)).Limit(int(page.Size)).Find(&events).Error; err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return events, nil
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,6 @@ func New(ctx *cli.Context) (datastore.Datastore, error) {
|
|||||||
|
|
||||||
if ctx.Bool("migrate") {
|
if ctx.Bool("migrate") {
|
||||||
if err := db.AutoMigrate(
|
if err := db.AutoMigrate(
|
||||||
&model.AuditEvent{},
|
|
||||||
&model.Mapfix{},
|
&model.Mapfix{},
|
||||||
&model.Operation{},
|
&model.Operation{},
|
||||||
&model.Submission{},
|
&model.Submission{},
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ type Gormstore struct {
|
|||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g Gormstore) AuditEvents() datastore.AuditEvents {
|
|
||||||
return &AuditEvents{db: g.db}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g Gormstore) Mapfixes() datastore.Mapfixes {
|
func (g Gormstore) Mapfixes() datastore.Mapfixes {
|
||||||
return &Mapfixes{db: g.db}
|
return &Mapfixes{db: g.db}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,18 +131,39 @@ func (env *Mapfixes) List(ctx context.Context, filters datastore.OptionalMap, pa
|
|||||||
return maps, nil
|
return maps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *Mapfixes) ListWithTotal(ctx context.Context, filters datastore.OptionalMap, page model.Page, sort datastore.ListSort) (uint64, []model.Mapfix, error) {
|
func (env *Mapfixes) ListRestricted(ctx context.Context, filters datastore.OptionalMap, page model.Page, sort datastore.ListSort, submitter int64) ([]model.Mapfix, error) {
|
||||||
// grab page items
|
var maps []model.Mapfix
|
||||||
maps, err := env.List(ctx, filters, page, sort)
|
|
||||||
if err != nil{
|
db := env.db
|
||||||
return 0, nil, err
|
|
||||||
|
switch sort {
|
||||||
|
case datastore.ListSortDisabled:
|
||||||
|
// No sort
|
||||||
|
break
|
||||||
|
case datastore.ListSortDisplayNameAscending:
|
||||||
|
db=db.Order("display_name ASC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDisplayNameDescending:
|
||||||
|
db=db.Order("display_name DESC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDateAscending:
|
||||||
|
db=db.Order("created_at ASC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDateDescending:
|
||||||
|
db=db.Order("created_at DESC")
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return nil, datastore.ErrInvalidListSort
|
||||||
}
|
}
|
||||||
|
|
||||||
// count total with filters
|
if err := db.
|
||||||
var total int64
|
Where(filters.Map()).
|
||||||
if err := env.db.Model(&model.Mapfix{}).Where(filters.Map()).Count(&total).Error; err != nil {
|
Where("status_id NOT IN ? OR submitter = ? AND status_id IN ?",PrivateSubmissions,submitter,PrivateSubmissions).
|
||||||
return 0, nil, err
|
Offset(int((page.Number - 1) * page.Size)).
|
||||||
|
Limit(int(page.Size)).
|
||||||
|
Find(&maps).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return uint64(total), maps, nil
|
return maps, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package gormstore
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||||
@@ -54,12 +53,3 @@ func (env *Operations) Delete(ctx context.Context, id int32) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *Operations) CountSince(ctx context.Context, owner int64, since time.Time) (int64, error) {
|
|
||||||
var count int64
|
|
||||||
if err := env.db.Model(&model.Operation{}).Where("owner = ? AND created_at > ?",owner,since).Count(&count).Error; err != nil {
|
|
||||||
return count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return count, nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ import (
|
|||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var(
|
||||||
|
PrivateSubmissions = []model.SubmissionStatus{
|
||||||
|
model.SubmissionStatusUnderConstruction,
|
||||||
|
model.SubmissionStatusChangesRequested,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
type Submissions struct {
|
type Submissions struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
}
|
}
|
||||||
@@ -131,18 +138,43 @@ func (env *Submissions) List(ctx context.Context, filters datastore.OptionalMap,
|
|||||||
return maps, nil
|
return maps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *Submissions) ListWithTotal(ctx context.Context, filters datastore.OptionalMap, page model.Page, sort datastore.ListSort) (int64, []model.Submission, error) {
|
func (env *Submissions) ListRestricted(ctx context.Context, filters datastore.OptionalMap, page model.Page, sort datastore.ListSort, submitter int64) ([]model.Submission, error) {
|
||||||
// grab page items
|
var maps []model.Submission
|
||||||
maps, err := env.List(ctx, filters, page, sort)
|
|
||||||
if err != nil{
|
db := env.db
|
||||||
return 0, nil, err
|
|
||||||
|
switch sort {
|
||||||
|
case datastore.ListSortDisabled:
|
||||||
|
// No sort
|
||||||
|
break
|
||||||
|
case datastore.ListSortDisplayNameAscending:
|
||||||
|
db=db.Order("display_name ASC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDisplayNameDescending:
|
||||||
|
db=db.Order("display_name DESC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDateAscending:
|
||||||
|
db=db.Order("created_at ASC")
|
||||||
|
break
|
||||||
|
case datastore.ListSortDateDescending:
|
||||||
|
db=db.Order("created_at DESC")
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return nil, datastore.ErrInvalidListSort
|
||||||
}
|
}
|
||||||
|
|
||||||
// count total with filters
|
if err := db.
|
||||||
var total int64
|
Where(filters.Map()).
|
||||||
if err := env.db.Model(&model.Submission{}).Where(filters.Map()).Count(&total).Error; err != nil {
|
// In order to see submissions,
|
||||||
return 0, nil, err
|
// at least one of two criteria must be met:
|
||||||
|
// - You are the submitter
|
||||||
|
// - The submission is not under construction / changes requested
|
||||||
|
Where("status_id NOT IN ? OR submitter = ? AND status_id IN ?",PrivateSubmissions,submitter,PrivateSubmissions).
|
||||||
|
Offset(int((page.Number - 1) * page.Size)).
|
||||||
|
Limit(int(page.Size)).
|
||||||
|
Find(&maps).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return total, maps, nil
|
return maps, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-failed
|
// POST /mapfixes/{MapfixID}/status/validator-failed
|
||||||
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
||||||
// ActionMapfixSubmitted invokes actionMapfixSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error
|
|
||||||
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -64,12 +58,6 @@ type Invoker interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/validator-failed
|
// POST /submissions/{SubmissionID}/status/validator-failed
|
||||||
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
||||||
// ActionSubmissionSubmitted invokes actionSubmissionSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error
|
|
||||||
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -241,7 +229,7 @@ func (c *Client) sendActionMapfixAccepted(ctx context.Context, params ActionMapf
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.MapfixID))
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -294,97 +282,6 @@ func (c *Client) sendActionMapfixAccepted(ctx context.Context, params ActionMapf
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixSubmitted invokes actionMapfixSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
func (c *Client) ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error {
|
|
||||||
_, err := c.sendActionMapfixSubmitted(ctx, params)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) sendActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) (res *ActionMapfixSubmittedNoContent, err error) {
|
|
||||||
otelAttrs := []attribute.KeyValue{
|
|
||||||
otelogen.OperationID("actionMapfixSubmitted"),
|
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
|
||||||
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/validator-submitted"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run stopwatch.
|
|
||||||
startTime := time.Now()
|
|
||||||
defer func() {
|
|
||||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
|
||||||
elapsedDuration := time.Since(startTime)
|
|
||||||
c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...))
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Increment request counter.
|
|
||||||
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
|
||||||
|
|
||||||
// Start a span for this request.
|
|
||||||
ctx, span := c.cfg.Tracer.Start(ctx, ActionMapfixSubmittedOperation,
|
|
||||||
trace.WithAttributes(otelAttrs...),
|
|
||||||
clientSpanKind,
|
|
||||||
)
|
|
||||||
// Track stage for error reporting.
|
|
||||||
var stage string
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, stage)
|
|
||||||
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
|
||||||
}
|
|
||||||
span.End()
|
|
||||||
}()
|
|
||||||
|
|
||||||
stage = "BuildURL"
|
|
||||||
u := uri.Clone(c.requestURL(ctx))
|
|
||||||
var pathParts [3]string
|
|
||||||
pathParts[0] = "/mapfixes/"
|
|
||||||
{
|
|
||||||
// Encode "MapfixID" parameter.
|
|
||||||
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
||||||
Param: "MapfixID",
|
|
||||||
Style: uri.PathStyleSimple,
|
|
||||||
Explode: false,
|
|
||||||
})
|
|
||||||
if err := func() error {
|
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.MapfixID))
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "encode path")
|
|
||||||
}
|
|
||||||
encoded, err := e.Result()
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "encode path")
|
|
||||||
}
|
|
||||||
pathParts[1] = encoded
|
|
||||||
}
|
|
||||||
pathParts[2] = "/status/validator-submitted"
|
|
||||||
uri.AddPathParts(u, pathParts[:]...)
|
|
||||||
|
|
||||||
stage = "EncodeRequest"
|
|
||||||
r, err := ht.NewRequest(ctx, "POST", u)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "create request")
|
|
||||||
}
|
|
||||||
|
|
||||||
stage = "SendRequest"
|
|
||||||
resp, err := c.cfg.Client.Do(r)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "do request")
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
stage = "DecodeResponse"
|
|
||||||
result, err := decodeActionMapfixSubmittedResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "decode response")
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
// ActionMapfixUploaded invokes actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -441,7 +338,7 @@ func (c *Client) sendActionMapfixUploaded(ctx context.Context, params ActionMapf
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.MapfixID))
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -532,7 +429,7 @@ func (c *Client) sendActionMapfixValidated(ctx context.Context, params ActionMap
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.MapfixID))
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -623,7 +520,7 @@ func (c *Client) sendActionOperationFailed(ctx context.Context, params ActionOpe
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint32ToString(params.OperationID))
|
return e.EncodeValue(conv.Int32ToString(params.OperationID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -732,7 +629,7 @@ func (c *Client) sendActionSubmissionAccepted(ctx context.Context, params Action
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.SubmissionID))
|
return e.EncodeValue(conv.Int64ToString(params.SubmissionID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -785,97 +682,6 @@ func (c *Client) sendActionSubmissionAccepted(ctx context.Context, params Action
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionSubmitted invokes actionSubmissionSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
func (c *Client) ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error {
|
|
||||||
_, err := c.sendActionSubmissionSubmitted(ctx, params)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) sendActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) (res *ActionSubmissionSubmittedNoContent, err error) {
|
|
||||||
otelAttrs := []attribute.KeyValue{
|
|
||||||
otelogen.OperationID("actionSubmissionSubmitted"),
|
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
|
||||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-submitted"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run stopwatch.
|
|
||||||
startTime := time.Now()
|
|
||||||
defer func() {
|
|
||||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
|
||||||
elapsedDuration := time.Since(startTime)
|
|
||||||
c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...))
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Increment request counter.
|
|
||||||
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
|
||||||
|
|
||||||
// Start a span for this request.
|
|
||||||
ctx, span := c.cfg.Tracer.Start(ctx, ActionSubmissionSubmittedOperation,
|
|
||||||
trace.WithAttributes(otelAttrs...),
|
|
||||||
clientSpanKind,
|
|
||||||
)
|
|
||||||
// Track stage for error reporting.
|
|
||||||
var stage string
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, stage)
|
|
||||||
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
|
|
||||||
}
|
|
||||||
span.End()
|
|
||||||
}()
|
|
||||||
|
|
||||||
stage = "BuildURL"
|
|
||||||
u := uri.Clone(c.requestURL(ctx))
|
|
||||||
var pathParts [3]string
|
|
||||||
pathParts[0] = "/submissions/"
|
|
||||||
{
|
|
||||||
// Encode "SubmissionID" parameter.
|
|
||||||
e := uri.NewPathEncoder(uri.PathEncoderConfig{
|
|
||||||
Param: "SubmissionID",
|
|
||||||
Style: uri.PathStyleSimple,
|
|
||||||
Explode: false,
|
|
||||||
})
|
|
||||||
if err := func() error {
|
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.SubmissionID))
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "encode path")
|
|
||||||
}
|
|
||||||
encoded, err := e.Result()
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "encode path")
|
|
||||||
}
|
|
||||||
pathParts[1] = encoded
|
|
||||||
}
|
|
||||||
pathParts[2] = "/status/validator-submitted"
|
|
||||||
uri.AddPathParts(u, pathParts[:]...)
|
|
||||||
|
|
||||||
stage = "EncodeRequest"
|
|
||||||
r, err := ht.NewRequest(ctx, "POST", u)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "create request")
|
|
||||||
}
|
|
||||||
|
|
||||||
stage = "SendRequest"
|
|
||||||
resp, err := c.cfg.Client.Do(r)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "do request")
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
stage = "DecodeResponse"
|
|
||||||
result, err := decodeActionSubmissionSubmittedResponse(resp)
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "decode response")
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded invokes actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -932,7 +738,7 @@ func (c *Client) sendActionSubmissionUploaded(ctx context.Context, params Action
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.SubmissionID))
|
return e.EncodeValue(conv.Int64ToString(params.SubmissionID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -956,7 +762,7 @@ func (c *Client) sendActionSubmissionUploaded(ctx context.Context, params Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.UploadedAssetID))
|
return e.EncodeValue(conv.Int64ToString(params.UploadedAssetID))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1041,7 +847,7 @@ func (c *Client) sendActionSubmissionValidated(ctx context.Context, params Actio
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.SubmissionID))
|
return e.EncodeValue(conv.Int64ToString(params.SubmissionID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -1432,7 +1238,7 @@ func (c *Client) sendGetScript(ctx context.Context, params GetScriptParams) (res
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.ScriptID))
|
return e.EncodeValue(conv.Int64ToString(params.ScriptID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -1527,7 +1333,7 @@ func (c *Client) sendListScriptPolicy(ctx context.Context, params ListScriptPoli
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint32ToString(params.Page))
|
return e.EncodeValue(conv.Int32ToString(params.Page))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1541,7 +1347,7 @@ func (c *Client) sendListScriptPolicy(ctx context.Context, params ListScriptPoli
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint32ToString(params.Limit))
|
return e.EncodeValue(conv.Int32ToString(params.Limit))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1379,7 @@ func (c *Client) sendListScriptPolicy(ctx context.Context, params ListScriptPoli
|
|||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
if val, ok := params.ToScriptID.Get(); ok {
|
if val, ok := params.ToScriptID.Get(); ok {
|
||||||
return e.EncodeValue(conv.Uint64ToString(val))
|
return e.EncodeValue(conv.Int64ToString(val))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -1590,7 +1396,7 @@ func (c *Client) sendListScriptPolicy(ctx context.Context, params ListScriptPoli
|
|||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
if val, ok := params.Policy.Get(); ok {
|
if val, ok := params.Policy.Get(); ok {
|
||||||
return e.EncodeValue(conv.Uint32ToString(val))
|
return e.EncodeValue(conv.Int32ToString(val))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -1682,7 +1488,7 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint32ToString(params.Page))
|
return e.EncodeValue(conv.Int32ToString(params.Page))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1696,7 +1502,7 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint32ToString(params.Limit))
|
return e.EncodeValue(conv.Int32ToString(params.Limit))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1762,7 +1568,7 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
|
|||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
if val, ok := params.ResourceType.Get(); ok {
|
if val, ok := params.ResourceType.Get(); ok {
|
||||||
return e.EncodeValue(conv.Uint32ToString(val))
|
return e.EncodeValue(conv.Int32ToString(val))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -1779,7 +1585,7 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
|
|||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
if val, ok := params.ResourceID.Get(); ok {
|
if val, ok := params.ResourceID.Get(); ok {
|
||||||
return e.EncodeValue(conv.Uint64ToString(val))
|
return e.EncodeValue(conv.Int64ToString(val))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -1866,7 +1672,7 @@ func (c *Client) sendUpdateMapfixValidatedModel(ctx context.Context, params Upda
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.MapfixID))
|
return e.EncodeValue(conv.Int64ToString(params.MapfixID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -1890,7 +1696,7 @@ func (c *Client) sendUpdateMapfixValidatedModel(ctx context.Context, params Upda
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.ValidatedModelID))
|
return e.EncodeValue(conv.Int64ToString(params.ValidatedModelID))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1904,7 +1710,7 @@ func (c *Client) sendUpdateMapfixValidatedModel(ctx context.Context, params Upda
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.ValidatedModelVersion))
|
return e.EncodeValue(conv.Int64ToString(params.ValidatedModelVersion))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -1989,7 +1795,7 @@ func (c *Client) sendUpdateSubmissionValidatedModel(ctx context.Context, params
|
|||||||
Explode: false,
|
Explode: false,
|
||||||
})
|
})
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.SubmissionID))
|
return e.EncodeValue(conv.Int64ToString(params.SubmissionID))
|
||||||
}(); err != nil {
|
}(); err != nil {
|
||||||
return res, errors.Wrap(err, "encode path")
|
return res, errors.Wrap(err, "encode path")
|
||||||
}
|
}
|
||||||
@@ -2013,7 +1819,7 @@ func (c *Client) sendUpdateSubmissionValidatedModel(ctx context.Context, params
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.ValidatedModelID))
|
return e.EncodeValue(conv.Int64ToString(params.ValidatedModelID))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
@@ -2027,7 +1833,7 @@ func (c *Client) sendUpdateSubmissionValidatedModel(ctx context.Context, params
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||||
return e.EncodeValue(conv.Uint64ToString(params.ValidatedModelVersion))
|
return e.EncodeValue(conv.Int64ToString(params.ValidatedModelVersion))
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return res, errors.Wrap(err, "encode query")
|
return res, errors.Wrap(err, "encode query")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,155 +183,6 @@ func (s *Server) handleActionMapfixAcceptedRequest(args [1]string, argsEscaped b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleActionMapfixSubmittedRequest handles actionMapfixSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
func (s *Server) handleActionMapfixSubmittedRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
|
||||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
|
||||||
w = statusWriter
|
|
||||||
otelAttrs := []attribute.KeyValue{
|
|
||||||
otelogen.OperationID("actionMapfixSubmitted"),
|
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
|
||||||
semconv.HTTPRouteKey.String("/mapfixes/{MapfixID}/status/validator-submitted"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start a span for this request.
|
|
||||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionMapfixSubmittedOperation,
|
|
||||||
trace.WithAttributes(otelAttrs...),
|
|
||||||
serverSpanKind,
|
|
||||||
)
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
// Add Labeler to context.
|
|
||||||
labeler := &Labeler{attrs: otelAttrs}
|
|
||||||
ctx = contextWithLabeler(ctx, labeler)
|
|
||||||
|
|
||||||
// Run stopwatch.
|
|
||||||
startTime := time.Now()
|
|
||||||
defer func() {
|
|
||||||
elapsedDuration := time.Since(startTime)
|
|
||||||
|
|
||||||
attrSet := labeler.AttributeSet()
|
|
||||||
attrs := attrSet.ToSlice()
|
|
||||||
code := statusWriter.status
|
|
||||||
if code != 0 {
|
|
||||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
|
||||||
attrs = append(attrs, codeAttr)
|
|
||||||
span.SetAttributes(codeAttr)
|
|
||||||
}
|
|
||||||
attrOpt := metric.WithAttributes(attrs...)
|
|
||||||
|
|
||||||
// Increment request counter.
|
|
||||||
s.requests.Add(ctx, 1, attrOpt)
|
|
||||||
|
|
||||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
|
||||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
|
||||||
}()
|
|
||||||
|
|
||||||
var (
|
|
||||||
recordError = func(stage string, err error) {
|
|
||||||
span.RecordError(err)
|
|
||||||
|
|
||||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
|
||||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
|
||||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
|
||||||
// max redirects exceeded), in which case status MUST be set to Error.
|
|
||||||
code := statusWriter.status
|
|
||||||
if code >= 100 && code < 500 {
|
|
||||||
span.SetStatus(codes.Error, stage)
|
|
||||||
}
|
|
||||||
|
|
||||||
attrSet := labeler.AttributeSet()
|
|
||||||
attrs := attrSet.ToSlice()
|
|
||||||
if code != 0 {
|
|
||||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
|
||||||
}
|
|
||||||
|
|
||||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
|
||||||
}
|
|
||||||
err error
|
|
||||||
opErrContext = ogenerrors.OperationContext{
|
|
||||||
Name: ActionMapfixSubmittedOperation,
|
|
||||||
ID: "actionMapfixSubmitted",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
params, err := decodeActionMapfixSubmittedParams(args, argsEscaped, r)
|
|
||||||
if err != nil {
|
|
||||||
err = &ogenerrors.DecodeParamsError{
|
|
||||||
OperationContext: opErrContext,
|
|
||||||
Err: err,
|
|
||||||
}
|
|
||||||
defer recordError("DecodeParams", err)
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var response *ActionMapfixSubmittedNoContent
|
|
||||||
if m := s.cfg.Middleware; m != nil {
|
|
||||||
mreq := middleware.Request{
|
|
||||||
Context: ctx,
|
|
||||||
OperationName: ActionMapfixSubmittedOperation,
|
|
||||||
OperationSummary: "(Internal endpoint) Role Validator changes status from Submitting -> Submitted",
|
|
||||||
OperationID: "actionMapfixSubmitted",
|
|
||||||
Body: nil,
|
|
||||||
Params: middleware.Parameters{
|
|
||||||
{
|
|
||||||
Name: "MapfixID",
|
|
||||||
In: "path",
|
|
||||||
}: params.MapfixID,
|
|
||||||
},
|
|
||||||
Raw: r,
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
|
||||||
Request = struct{}
|
|
||||||
Params = ActionMapfixSubmittedParams
|
|
||||||
Response = *ActionMapfixSubmittedNoContent
|
|
||||||
)
|
|
||||||
response, err = middleware.HookMiddleware[
|
|
||||||
Request,
|
|
||||||
Params,
|
|
||||||
Response,
|
|
||||||
](
|
|
||||||
m,
|
|
||||||
mreq,
|
|
||||||
unpackActionMapfixSubmittedParams,
|
|
||||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
|
||||||
err = s.h.ActionMapfixSubmitted(ctx, params)
|
|
||||||
return response, err
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
err = s.h.ActionMapfixSubmitted(ctx, params)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
|
||||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
|
||||||
defer recordError("Internal", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if errors.Is(err, ht.ErrNotImplemented) {
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
|
||||||
defer recordError("Internal", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := encodeActionMapfixSubmittedResponse(response, w, span); err != nil {
|
|
||||||
defer recordError("EncodeResponse", err)
|
|
||||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handleActionMapfixUploadedRequest handles actionMapfixUploaded operation.
|
// handleActionMapfixUploadedRequest handles actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -936,155 +787,6 @@ func (s *Server) handleActionSubmissionAcceptedRequest(args [1]string, argsEscap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleActionSubmissionSubmittedRequest handles actionSubmissionSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
func (s *Server) handleActionSubmissionSubmittedRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
|
||||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
|
||||||
w = statusWriter
|
|
||||||
otelAttrs := []attribute.KeyValue{
|
|
||||||
otelogen.OperationID("actionSubmissionSubmitted"),
|
|
||||||
semconv.HTTPRequestMethodKey.String("POST"),
|
|
||||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-submitted"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start a span for this request.
|
|
||||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ActionSubmissionSubmittedOperation,
|
|
||||||
trace.WithAttributes(otelAttrs...),
|
|
||||||
serverSpanKind,
|
|
||||||
)
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
// Add Labeler to context.
|
|
||||||
labeler := &Labeler{attrs: otelAttrs}
|
|
||||||
ctx = contextWithLabeler(ctx, labeler)
|
|
||||||
|
|
||||||
// Run stopwatch.
|
|
||||||
startTime := time.Now()
|
|
||||||
defer func() {
|
|
||||||
elapsedDuration := time.Since(startTime)
|
|
||||||
|
|
||||||
attrSet := labeler.AttributeSet()
|
|
||||||
attrs := attrSet.ToSlice()
|
|
||||||
code := statusWriter.status
|
|
||||||
if code != 0 {
|
|
||||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
|
||||||
attrs = append(attrs, codeAttr)
|
|
||||||
span.SetAttributes(codeAttr)
|
|
||||||
}
|
|
||||||
attrOpt := metric.WithAttributes(attrs...)
|
|
||||||
|
|
||||||
// Increment request counter.
|
|
||||||
s.requests.Add(ctx, 1, attrOpt)
|
|
||||||
|
|
||||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
|
||||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
|
||||||
}()
|
|
||||||
|
|
||||||
var (
|
|
||||||
recordError = func(stage string, err error) {
|
|
||||||
span.RecordError(err)
|
|
||||||
|
|
||||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
|
||||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
|
||||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
|
||||||
// max redirects exceeded), in which case status MUST be set to Error.
|
|
||||||
code := statusWriter.status
|
|
||||||
if code >= 100 && code < 500 {
|
|
||||||
span.SetStatus(codes.Error, stage)
|
|
||||||
}
|
|
||||||
|
|
||||||
attrSet := labeler.AttributeSet()
|
|
||||||
attrs := attrSet.ToSlice()
|
|
||||||
if code != 0 {
|
|
||||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
|
||||||
}
|
|
||||||
|
|
||||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
|
||||||
}
|
|
||||||
err error
|
|
||||||
opErrContext = ogenerrors.OperationContext{
|
|
||||||
Name: ActionSubmissionSubmittedOperation,
|
|
||||||
ID: "actionSubmissionSubmitted",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
params, err := decodeActionSubmissionSubmittedParams(args, argsEscaped, r)
|
|
||||||
if err != nil {
|
|
||||||
err = &ogenerrors.DecodeParamsError{
|
|
||||||
OperationContext: opErrContext,
|
|
||||||
Err: err,
|
|
||||||
}
|
|
||||||
defer recordError("DecodeParams", err)
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var response *ActionSubmissionSubmittedNoContent
|
|
||||||
if m := s.cfg.Middleware; m != nil {
|
|
||||||
mreq := middleware.Request{
|
|
||||||
Context: ctx,
|
|
||||||
OperationName: ActionSubmissionSubmittedOperation,
|
|
||||||
OperationSummary: "(Internal endpoint) Role Validator changes status from Submitting -> Submitted",
|
|
||||||
OperationID: "actionSubmissionSubmitted",
|
|
||||||
Body: nil,
|
|
||||||
Params: middleware.Parameters{
|
|
||||||
{
|
|
||||||
Name: "SubmissionID",
|
|
||||||
In: "path",
|
|
||||||
}: params.SubmissionID,
|
|
||||||
},
|
|
||||||
Raw: r,
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
|
||||||
Request = struct{}
|
|
||||||
Params = ActionSubmissionSubmittedParams
|
|
||||||
Response = *ActionSubmissionSubmittedNoContent
|
|
||||||
)
|
|
||||||
response, err = middleware.HookMiddleware[
|
|
||||||
Request,
|
|
||||||
Params,
|
|
||||||
Response,
|
|
||||||
](
|
|
||||||
m,
|
|
||||||
mreq,
|
|
||||||
unpackActionSubmissionSubmittedParams,
|
|
||||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
|
||||||
err = s.h.ActionSubmissionSubmitted(ctx, params)
|
|
||||||
return response, err
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
err = s.h.ActionSubmissionSubmitted(ctx, params)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
|
||||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
|
||||||
defer recordError("Internal", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if errors.Is(err, ht.ErrNotImplemented) {
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
|
||||||
defer recordError("Internal", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := encodeActionSubmissionSubmittedResponse(response, w, span); err != nil {
|
|
||||||
defer recordError("EncodeResponse", err)
|
|
||||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
|
||||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// handleActionSubmissionUploadedRequest handles actionSubmissionUploaded operation.
|
// handleActionSubmissionUploadedRequest handles actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func (s *Error) Encode(e *jx.Encoder) {
|
|||||||
func (s *Error) encodeFields(e *jx.Encoder) {
|
func (s *Error) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("code")
|
e.FieldStart("code")
|
||||||
e.UInt64(s.Code)
|
e.Int64(s.Code)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("message")
|
e.FieldStart("message")
|
||||||
@@ -48,8 +48,8 @@ func (s *Error) Decode(d *jx.Decoder) error {
|
|||||||
case "code":
|
case "code":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.Code = uint64(v)
|
s.Code = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -136,11 +136,11 @@ func (s *MapfixCreate) Encode(e *jx.Encoder) {
|
|||||||
func (s *MapfixCreate) encodeFields(e *jx.Encoder) {
|
func (s *MapfixCreate) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("OperationID")
|
e.FieldStart("OperationID")
|
||||||
e.UInt32(s.OperationID)
|
e.Int32(s.OperationID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetOwner")
|
e.FieldStart("AssetOwner")
|
||||||
e.UInt64(s.AssetOwner)
|
e.Int64(s.AssetOwner)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("DisplayName")
|
e.FieldStart("DisplayName")
|
||||||
@@ -152,19 +152,19 @@ func (s *MapfixCreate) encodeFields(e *jx.Encoder) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("GameID")
|
e.FieldStart("GameID")
|
||||||
e.UInt32(s.GameID)
|
e.Int32(s.GameID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetID")
|
e.FieldStart("AssetID")
|
||||||
e.UInt64(s.AssetID)
|
e.Int64(s.AssetID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetVersion")
|
e.FieldStart("AssetVersion")
|
||||||
e.UInt64(s.AssetVersion)
|
e.Int64(s.AssetVersion)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("TargetAssetID")
|
e.FieldStart("TargetAssetID")
|
||||||
e.UInt64(s.TargetAssetID)
|
e.Int64(s.TargetAssetID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,8 +191,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "OperationID":
|
case "OperationID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.OperationID = uint32(v)
|
s.OperationID = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -203,8 +203,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetOwner":
|
case "AssetOwner":
|
||||||
requiredBitSet[0] |= 1 << 1
|
requiredBitSet[0] |= 1 << 1
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetOwner = uint64(v)
|
s.AssetOwner = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -239,8 +239,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "GameID":
|
case "GameID":
|
||||||
requiredBitSet[0] |= 1 << 4
|
requiredBitSet[0] |= 1 << 4
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.GameID = uint32(v)
|
s.GameID = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -251,8 +251,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetID":
|
case "AssetID":
|
||||||
requiredBitSet[0] |= 1 << 5
|
requiredBitSet[0] |= 1 << 5
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetID = uint64(v)
|
s.AssetID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -263,8 +263,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetVersion":
|
case "AssetVersion":
|
||||||
requiredBitSet[0] |= 1 << 6
|
requiredBitSet[0] |= 1 << 6
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetVersion = uint64(v)
|
s.AssetVersion = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -275,8 +275,8 @@ func (s *MapfixCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "TargetAssetID":
|
case "TargetAssetID":
|
||||||
requiredBitSet[0] |= 1 << 7
|
requiredBitSet[0] |= 1 << 7
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.TargetAssetID = uint64(v)
|
s.TargetAssetID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ func (s *MapfixID) Encode(e *jx.Encoder) {
|
|||||||
func (s *MapfixID) encodeFields(e *jx.Encoder) {
|
func (s *MapfixID) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("MapfixID")
|
e.FieldStart("MapfixID")
|
||||||
e.UInt64(s.MapfixID)
|
e.Int64(s.MapfixID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,8 +371,8 @@ func (s *MapfixID) Decode(d *jx.Decoder) error {
|
|||||||
case "MapfixID":
|
case "MapfixID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.MapfixID = uint64(v)
|
s.MapfixID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -436,37 +436,37 @@ func (s *MapfixID) UnmarshalJSON(data []byte) error {
|
|||||||
return s.Decode(d)
|
return s.Decode(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode encodes uint64 as json.
|
// Encode encodes int64 as json.
|
||||||
func (o OptUint64) Encode(e *jx.Encoder) {
|
func (o OptInt64) Encode(e *jx.Encoder) {
|
||||||
if !o.Set {
|
if !o.Set {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.UInt64(uint64(o.Value))
|
e.Int64(int64(o.Value))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode decodes uint64 from json.
|
// Decode decodes int64 from json.
|
||||||
func (o *OptUint64) Decode(d *jx.Decoder) error {
|
func (o *OptInt64) Decode(d *jx.Decoder) error {
|
||||||
if o == nil {
|
if o == nil {
|
||||||
return errors.New("invalid: unable to decode OptUint64 to nil")
|
return errors.New("invalid: unable to decode OptInt64 to nil")
|
||||||
}
|
}
|
||||||
o.Set = true
|
o.Set = true
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
o.Value = uint64(v)
|
o.Value = int64(v)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements stdjson.Marshaler.
|
// MarshalJSON implements stdjson.Marshaler.
|
||||||
func (s OptUint64) MarshalJSON() ([]byte, error) {
|
func (s OptInt64) MarshalJSON() ([]byte, error) {
|
||||||
e := jx.Encoder{}
|
e := jx.Encoder{}
|
||||||
s.Encode(&e)
|
s.Encode(&e)
|
||||||
return e.Bytes(), nil
|
return e.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||||
func (s *OptUint64) UnmarshalJSON(data []byte) error {
|
func (s *OptInt64) UnmarshalJSON(data []byte) error {
|
||||||
d := jx.DecodeBytes(data)
|
d := jx.DecodeBytes(data)
|
||||||
return s.Decode(d)
|
return s.Decode(d)
|
||||||
}
|
}
|
||||||
@@ -482,7 +482,7 @@ func (s *Script) Encode(e *jx.Encoder) {
|
|||||||
func (s *Script) encodeFields(e *jx.Encoder) {
|
func (s *Script) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("ID")
|
e.FieldStart("ID")
|
||||||
e.UInt64(s.ID)
|
e.Int64(s.ID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("Name")
|
e.FieldStart("Name")
|
||||||
@@ -498,11 +498,11 @@ func (s *Script) encodeFields(e *jx.Encoder) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("ResourceType")
|
e.FieldStart("ResourceType")
|
||||||
e.UInt32(s.ResourceType)
|
e.Int32(s.ResourceType)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("ResourceID")
|
e.FieldStart("ResourceID")
|
||||||
e.UInt64(s.ResourceID)
|
e.Int64(s.ResourceID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,8 +527,8 @@ func (s *Script) Decode(d *jx.Decoder) error {
|
|||||||
case "ID":
|
case "ID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ID = uint64(v)
|
s.ID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -575,8 +575,8 @@ func (s *Script) Decode(d *jx.Decoder) error {
|
|||||||
case "ResourceType":
|
case "ResourceType":
|
||||||
requiredBitSet[0] |= 1 << 4
|
requiredBitSet[0] |= 1 << 4
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.ResourceType = uint32(v)
|
s.ResourceType = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -587,8 +587,8 @@ func (s *Script) Decode(d *jx.Decoder) error {
|
|||||||
case "ResourceID":
|
case "ResourceID":
|
||||||
requiredBitSet[0] |= 1 << 5
|
requiredBitSet[0] |= 1 << 5
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ResourceID = uint64(v)
|
s.ResourceID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -671,7 +671,7 @@ func (s *ScriptCreate) encodeFields(e *jx.Encoder) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("ResourceType")
|
e.FieldStart("ResourceType")
|
||||||
e.UInt32(s.ResourceType)
|
e.Int32(s.ResourceType)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if s.ResourceID.Set {
|
if s.ResourceID.Set {
|
||||||
@@ -724,8 +724,8 @@ func (s *ScriptCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "ResourceType":
|
case "ResourceType":
|
||||||
requiredBitSet[0] |= 1 << 2
|
requiredBitSet[0] |= 1 << 2
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.ResourceType = uint32(v)
|
s.ResourceType = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -810,7 +810,7 @@ func (s *ScriptID) Encode(e *jx.Encoder) {
|
|||||||
func (s *ScriptID) encodeFields(e *jx.Encoder) {
|
func (s *ScriptID) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("ScriptID")
|
e.FieldStart("ScriptID")
|
||||||
e.UInt64(s.ScriptID)
|
e.Int64(s.ScriptID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,8 +830,8 @@ func (s *ScriptID) Decode(d *jx.Decoder) error {
|
|||||||
case "ScriptID":
|
case "ScriptID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ScriptID = uint64(v)
|
s.ScriptID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -906,7 +906,7 @@ func (s *ScriptPolicy) Encode(e *jx.Encoder) {
|
|||||||
func (s *ScriptPolicy) encodeFields(e *jx.Encoder) {
|
func (s *ScriptPolicy) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("ID")
|
e.FieldStart("ID")
|
||||||
e.UInt64(s.ID)
|
e.Int64(s.ID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("FromScriptHash")
|
e.FieldStart("FromScriptHash")
|
||||||
@@ -914,11 +914,11 @@ func (s *ScriptPolicy) encodeFields(e *jx.Encoder) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("ToScriptID")
|
e.FieldStart("ToScriptID")
|
||||||
e.UInt64(s.ToScriptID)
|
e.Int64(s.ToScriptID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("Policy")
|
e.FieldStart("Policy")
|
||||||
e.UInt32(s.Policy)
|
e.Int32(s.Policy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,8 +941,8 @@ func (s *ScriptPolicy) Decode(d *jx.Decoder) error {
|
|||||||
case "ID":
|
case "ID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ID = uint64(v)
|
s.ID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -965,8 +965,8 @@ func (s *ScriptPolicy) Decode(d *jx.Decoder) error {
|
|||||||
case "ToScriptID":
|
case "ToScriptID":
|
||||||
requiredBitSet[0] |= 1 << 2
|
requiredBitSet[0] |= 1 << 2
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ToScriptID = uint64(v)
|
s.ToScriptID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -977,8 +977,8 @@ func (s *ScriptPolicy) Decode(d *jx.Decoder) error {
|
|||||||
case "Policy":
|
case "Policy":
|
||||||
requiredBitSet[0] |= 1 << 3
|
requiredBitSet[0] |= 1 << 3
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.Policy = uint32(v)
|
s.Policy = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1053,15 +1053,15 @@ func (s *ScriptPolicyCreate) Encode(e *jx.Encoder) {
|
|||||||
func (s *ScriptPolicyCreate) encodeFields(e *jx.Encoder) {
|
func (s *ScriptPolicyCreate) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("FromScriptID")
|
e.FieldStart("FromScriptID")
|
||||||
e.UInt64(s.FromScriptID)
|
e.Int64(s.FromScriptID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("ToScriptID")
|
e.FieldStart("ToScriptID")
|
||||||
e.UInt64(s.ToScriptID)
|
e.Int64(s.ToScriptID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("Policy")
|
e.FieldStart("Policy")
|
||||||
e.UInt32(s.Policy)
|
e.Int32(s.Policy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,8 +1083,8 @@ func (s *ScriptPolicyCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "FromScriptID":
|
case "FromScriptID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.FromScriptID = uint64(v)
|
s.FromScriptID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1095,8 +1095,8 @@ func (s *ScriptPolicyCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "ToScriptID":
|
case "ToScriptID":
|
||||||
requiredBitSet[0] |= 1 << 1
|
requiredBitSet[0] |= 1 << 1
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ToScriptID = uint64(v)
|
s.ToScriptID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1107,8 +1107,8 @@ func (s *ScriptPolicyCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "Policy":
|
case "Policy":
|
||||||
requiredBitSet[0] |= 1 << 2
|
requiredBitSet[0] |= 1 << 2
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.Policy = uint32(v)
|
s.Policy = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1183,7 +1183,7 @@ func (s *ScriptPolicyID) Encode(e *jx.Encoder) {
|
|||||||
func (s *ScriptPolicyID) encodeFields(e *jx.Encoder) {
|
func (s *ScriptPolicyID) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("ScriptPolicyID")
|
e.FieldStart("ScriptPolicyID")
|
||||||
e.UInt64(s.ScriptPolicyID)
|
e.Int64(s.ScriptPolicyID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1203,8 +1203,8 @@ func (s *ScriptPolicyID) Decode(d *jx.Decoder) error {
|
|||||||
case "ScriptPolicyID":
|
case "ScriptPolicyID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.ScriptPolicyID = uint64(v)
|
s.ScriptPolicyID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1279,11 +1279,11 @@ func (s *SubmissionCreate) Encode(e *jx.Encoder) {
|
|||||||
func (s *SubmissionCreate) encodeFields(e *jx.Encoder) {
|
func (s *SubmissionCreate) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("OperationID")
|
e.FieldStart("OperationID")
|
||||||
e.UInt32(s.OperationID)
|
e.Int32(s.OperationID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetOwner")
|
e.FieldStart("AssetOwner")
|
||||||
e.UInt64(s.AssetOwner)
|
e.Int64(s.AssetOwner)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("DisplayName")
|
e.FieldStart("DisplayName")
|
||||||
@@ -1295,15 +1295,15 @@ func (s *SubmissionCreate) encodeFields(e *jx.Encoder) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("GameID")
|
e.FieldStart("GameID")
|
||||||
e.UInt32(s.GameID)
|
e.Int32(s.GameID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetID")
|
e.FieldStart("AssetID")
|
||||||
e.UInt64(s.AssetID)
|
e.Int64(s.AssetID)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
e.FieldStart("AssetVersion")
|
e.FieldStart("AssetVersion")
|
||||||
e.UInt64(s.AssetVersion)
|
e.Int64(s.AssetVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1329,8 +1329,8 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "OperationID":
|
case "OperationID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.OperationID = uint32(v)
|
s.OperationID = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1341,8 +1341,8 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetOwner":
|
case "AssetOwner":
|
||||||
requiredBitSet[0] |= 1 << 1
|
requiredBitSet[0] |= 1 << 1
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetOwner = uint64(v)
|
s.AssetOwner = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1377,8 +1377,8 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "GameID":
|
case "GameID":
|
||||||
requiredBitSet[0] |= 1 << 4
|
requiredBitSet[0] |= 1 << 4
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt32()
|
v, err := d.Int32()
|
||||||
s.GameID = uint32(v)
|
s.GameID = int32(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1389,8 +1389,8 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetID":
|
case "AssetID":
|
||||||
requiredBitSet[0] |= 1 << 5
|
requiredBitSet[0] |= 1 << 5
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetID = uint64(v)
|
s.AssetID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1401,8 +1401,8 @@ func (s *SubmissionCreate) Decode(d *jx.Decoder) error {
|
|||||||
case "AssetVersion":
|
case "AssetVersion":
|
||||||
requiredBitSet[0] |= 1 << 6
|
requiredBitSet[0] |= 1 << 6
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.AssetVersion = uint64(v)
|
s.AssetVersion = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1477,7 +1477,7 @@ func (s *SubmissionID) Encode(e *jx.Encoder) {
|
|||||||
func (s *SubmissionID) encodeFields(e *jx.Encoder) {
|
func (s *SubmissionID) encodeFields(e *jx.Encoder) {
|
||||||
{
|
{
|
||||||
e.FieldStart("SubmissionID")
|
e.FieldStart("SubmissionID")
|
||||||
e.UInt64(s.SubmissionID)
|
e.Int64(s.SubmissionID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1497,8 +1497,8 @@ func (s *SubmissionID) Decode(d *jx.Decoder) error {
|
|||||||
case "SubmissionID":
|
case "SubmissionID":
|
||||||
requiredBitSet[0] |= 1 << 0
|
requiredBitSet[0] |= 1 << 0
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
v, err := d.UInt64()
|
v, err := d.Int64()
|
||||||
s.SubmissionID = uint64(v)
|
s.SubmissionID = int64(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ type OperationName = string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
ActionMapfixAcceptedOperation OperationName = "ActionMapfixAccepted"
|
||||||
ActionMapfixSubmittedOperation OperationName = "ActionMapfixSubmitted"
|
|
||||||
ActionMapfixUploadedOperation OperationName = "ActionMapfixUploaded"
|
ActionMapfixUploadedOperation OperationName = "ActionMapfixUploaded"
|
||||||
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
ActionMapfixValidatedOperation OperationName = "ActionMapfixValidated"
|
||||||
ActionOperationFailedOperation OperationName = "ActionOperationFailed"
|
ActionOperationFailedOperation OperationName = "ActionOperationFailed"
|
||||||
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
ActionSubmissionAcceptedOperation OperationName = "ActionSubmissionAccepted"
|
||||||
ActionSubmissionSubmittedOperation OperationName = "ActionSubmissionSubmitted"
|
|
||||||
ActionSubmissionUploadedOperation OperationName = "ActionSubmissionUploaded"
|
ActionSubmissionUploadedOperation OperationName = "ActionSubmissionUploaded"
|
||||||
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
ActionSubmissionValidatedOperation OperationName = "ActionSubmissionValidated"
|
||||||
CreateMapfixOperation OperationName = "CreateMapfix"
|
CreateMapfixOperation OperationName = "CreateMapfix"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -214,14 +214,6 @@ func (s *Server) decodeCreateScriptPolicyRequest(r *http.Request) (
|
|||||||
}
|
}
|
||||||
return req, close, err
|
return req, close, err
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := request.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return req, close, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &request, close, nil
|
return &request, close, nil
|
||||||
default:
|
default:
|
||||||
return req, close, validate.InvalidContentType(ct)
|
return req, close, validate.InvalidContentType(ct)
|
||||||
|
|||||||
@@ -52,75 +52,6 @@ func decodeActionMapfixAcceptedResponse(resp *http.Response) (res *ActionMapfixA
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
|
||||||
StatusCode: resp.StatusCode,
|
|
||||||
Response: response,
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
return res, validate.InvalidContentType(ct)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
||||||
}
|
|
||||||
return res, errors.Wrap(defRes, "error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func decodeActionMapfixSubmittedResponse(resp *http.Response) (res *ActionMapfixSubmittedNoContent, _ error) {
|
|
||||||
switch resp.StatusCode {
|
|
||||||
case 204:
|
|
||||||
// Code 204.
|
|
||||||
return &ActionMapfixSubmittedNoContent{}, nil
|
|
||||||
}
|
|
||||||
// Convenient error response.
|
|
||||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
|
||||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "parse media type")
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case ct == "application/json":
|
|
||||||
buf, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
d := jx.DecodeBytes(buf)
|
|
||||||
|
|
||||||
var response Error
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Decode(d); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := d.Skip(); err != io.EOF {
|
|
||||||
return errors.New("unexpected trailing data")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
err = &ogenerrors.DecodeBodyError{
|
|
||||||
ContentType: ct,
|
|
||||||
Body: buf,
|
|
||||||
Err: err,
|
|
||||||
}
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -172,15 +103,6 @@ func decodeActionMapfixUploadedResponse(resp *http.Response) (res *ActionMapfixU
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -232,15 +154,6 @@ func decodeActionMapfixValidatedResponse(resp *http.Response) (res *ActionMapfix
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -292,15 +205,6 @@ func decodeActionOperationFailedResponse(resp *http.Response) (res *ActionOperat
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -352,75 +256,6 @@ func decodeActionSubmissionAcceptedResponse(resp *http.Response) (res *ActionSub
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
|
||||||
StatusCode: resp.StatusCode,
|
|
||||||
Response: response,
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
return res, validate.InvalidContentType(ct)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
||||||
}
|
|
||||||
return res, errors.Wrap(defRes, "error")
|
|
||||||
}
|
|
||||||
|
|
||||||
func decodeActionSubmissionSubmittedResponse(resp *http.Response) (res *ActionSubmissionSubmittedNoContent, _ error) {
|
|
||||||
switch resp.StatusCode {
|
|
||||||
case 204:
|
|
||||||
// Code 204.
|
|
||||||
return &ActionSubmissionSubmittedNoContent{}, nil
|
|
||||||
}
|
|
||||||
// Convenient error response.
|
|
||||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
|
||||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
|
||||||
if err != nil {
|
|
||||||
return res, errors.Wrap(err, "parse media type")
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case ct == "application/json":
|
|
||||||
buf, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
d := jx.DecodeBytes(buf)
|
|
||||||
|
|
||||||
var response Error
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Decode(d); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := d.Skip(); err != io.EOF {
|
|
||||||
return errors.New("unexpected trailing data")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
err = &ogenerrors.DecodeBodyError{
|
|
||||||
ContentType: ct,
|
|
||||||
Body: buf,
|
|
||||||
Err: err,
|
|
||||||
}
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -472,15 +307,6 @@ func decodeActionSubmissionUploadedResponse(resp *http.Response) (res *ActionSub
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -532,15 +358,6 @@ func decodeActionSubmissionValidatedResponse(resp *http.Response) (res *ActionSu
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -588,15 +405,6 @@ func decodeCreateMapfixResponse(resp *http.Response) (res *MapfixID, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &response, nil
|
return &response, nil
|
||||||
default:
|
default:
|
||||||
return res, validate.InvalidContentType(ct)
|
return res, validate.InvalidContentType(ct)
|
||||||
@@ -633,15 +441,6 @@ func decodeCreateMapfixResponse(resp *http.Response) (res *MapfixID, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -689,15 +488,6 @@ func decodeCreateScriptResponse(resp *http.Response) (res *ScriptID, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &response, nil
|
return &response, nil
|
||||||
default:
|
default:
|
||||||
return res, validate.InvalidContentType(ct)
|
return res, validate.InvalidContentType(ct)
|
||||||
@@ -734,15 +524,6 @@ func decodeCreateScriptResponse(resp *http.Response) (res *ScriptID, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -790,15 +571,6 @@ func decodeCreateScriptPolicyResponse(resp *http.Response) (res *ScriptPolicyID,
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &response, nil
|
return &response, nil
|
||||||
default:
|
default:
|
||||||
return res, validate.InvalidContentType(ct)
|
return res, validate.InvalidContentType(ct)
|
||||||
@@ -835,15 +607,6 @@ func decodeCreateScriptPolicyResponse(resp *http.Response) (res *ScriptPolicyID,
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -891,15 +654,6 @@ func decodeCreateSubmissionResponse(resp *http.Response) (res *SubmissionID, _ e
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &response, nil
|
return &response, nil
|
||||||
default:
|
default:
|
||||||
return res, validate.InvalidContentType(ct)
|
return res, validate.InvalidContentType(ct)
|
||||||
@@ -936,15 +690,6 @@ func decodeCreateSubmissionResponse(resp *http.Response) (res *SubmissionID, _ e
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -1037,15 +782,6 @@ func decodeGetScriptResponse(resp *http.Response) (res *Script, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -1163,15 +899,6 @@ func decodeListScriptPolicyResponse(resp *http.Response) (res []ScriptPolicy, _
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -1289,15 +1016,6 @@ func decodeListScriptsResponse(resp *http.Response) (res []Script, _ error) {
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -1349,15 +1067,6 @@ func decodeUpdateMapfixValidatedModelResponse(resp *http.Response) (res *UpdateM
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
@@ -1409,15 +1118,6 @@ func decodeUpdateSubmissionValidatedModelResponse(resp *http.Response) (res *Upd
|
|||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
// Validate response.
|
|
||||||
if err := func() error {
|
|
||||||
if err := response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return res, errors.Wrap(err, "validate")
|
|
||||||
}
|
|
||||||
return &ErrorStatusCode{
|
return &ErrorStatusCode{
|
||||||
StatusCode: resp.StatusCode,
|
StatusCode: resp.StatusCode,
|
||||||
Response: response,
|
Response: response,
|
||||||
|
|||||||
@@ -20,13 +20,6 @@ func encodeActionMapfixAcceptedResponse(response *ActionMapfixAcceptedNoContent,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionMapfixSubmittedResponse(response *ActionMapfixSubmittedNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeActionMapfixUploadedResponse(response *ActionMapfixUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionMapfixUploadedResponse(response *ActionMapfixUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
@@ -55,13 +48,6 @@ func encodeActionSubmissionAcceptedResponse(response *ActionSubmissionAcceptedNo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeActionSubmissionSubmittedResponse(response *ActionSubmissionSubmittedNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.WriteHeader(204)
|
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeActionSubmissionUploadedResponse(response *ActionSubmissionUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
func encodeActionSubmissionUploadedResponse(response *ActionSubmissionUploadedNoContent, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.WriteHeader(204)
|
w.WriteHeader(204)
|
||||||
span.SetStatus(codes.Ok, http.StatusText(204))
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
||||||
|
|||||||
@@ -147,28 +147,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submitted"
|
|
||||||
|
|
||||||
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionMapfixSubmittedRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -476,28 +454,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submitted"
|
|
||||||
|
|
||||||
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch r.Method {
|
|
||||||
case "POST":
|
|
||||||
s.handleActionSubmissionSubmittedRequest([1]string{
|
|
||||||
args[0],
|
|
||||||
}, elemIsEscaped, w, r)
|
|
||||||
default:
|
|
||||||
s.notAllowed(w, r, "POST")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -760,30 +716,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submitted"
|
|
||||||
|
|
||||||
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionMapfixSubmittedOperation
|
|
||||||
r.summary = "(Internal endpoint) Role Validator changes status from Submitting -> Submitted"
|
|
||||||
r.operationID = "actionMapfixSubmitted"
|
|
||||||
r.pathPattern = "/mapfixes/{MapfixID}/status/validator-submitted"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
@@ -1127,30 +1059,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 's': // Prefix: "submitted"
|
|
||||||
|
|
||||||
if l := len("submitted"); len(elem) >= l && elem[0:l] == "submitted" {
|
|
||||||
elem = elem[l:]
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(elem) == 0 {
|
|
||||||
// Leaf node.
|
|
||||||
switch method {
|
|
||||||
case "POST":
|
|
||||||
r.name = ActionSubmissionSubmittedOperation
|
|
||||||
r.summary = "(Internal endpoint) Role Validator changes status from Submitting -> Submitted"
|
|
||||||
r.operationID = "actionSubmissionSubmitted"
|
|
||||||
r.pathPattern = "/submissions/{SubmissionID}/status/validator-submitted"
|
|
||||||
r.args = args
|
|
||||||
r.count = 1
|
|
||||||
return r, true
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'u': // Prefix: "uploaded"
|
case 'u': // Prefix: "uploaded"
|
||||||
|
|
||||||
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
if l := len("uploaded"); len(elem) >= l && elem[0:l] == "uploaded" {
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ func (s *ErrorStatusCode) Error() string {
|
|||||||
// ActionMapfixAcceptedNoContent is response for ActionMapfixAccepted operation.
|
// ActionMapfixAcceptedNoContent is response for ActionMapfixAccepted operation.
|
||||||
type ActionMapfixAcceptedNoContent struct{}
|
type ActionMapfixAcceptedNoContent struct{}
|
||||||
|
|
||||||
// ActionMapfixSubmittedNoContent is response for ActionMapfixSubmitted operation.
|
|
||||||
type ActionMapfixSubmittedNoContent struct{}
|
|
||||||
|
|
||||||
// ActionMapfixUploadedNoContent is response for ActionMapfixUploaded operation.
|
// ActionMapfixUploadedNoContent is response for ActionMapfixUploaded operation.
|
||||||
type ActionMapfixUploadedNoContent struct{}
|
type ActionMapfixUploadedNoContent struct{}
|
||||||
|
|
||||||
@@ -28,9 +25,6 @@ type ActionOperationFailedNoContent struct{}
|
|||||||
// ActionSubmissionAcceptedNoContent is response for ActionSubmissionAccepted operation.
|
// ActionSubmissionAcceptedNoContent is response for ActionSubmissionAccepted operation.
|
||||||
type ActionSubmissionAcceptedNoContent struct{}
|
type ActionSubmissionAcceptedNoContent struct{}
|
||||||
|
|
||||||
// ActionSubmissionSubmittedNoContent is response for ActionSubmissionSubmitted operation.
|
|
||||||
type ActionSubmissionSubmittedNoContent struct{}
|
|
||||||
|
|
||||||
// ActionSubmissionUploadedNoContent is response for ActionSubmissionUploaded operation.
|
// ActionSubmissionUploadedNoContent is response for ActionSubmissionUploaded operation.
|
||||||
type ActionSubmissionUploadedNoContent struct{}
|
type ActionSubmissionUploadedNoContent struct{}
|
||||||
|
|
||||||
@@ -40,12 +34,12 @@ type ActionSubmissionValidatedNoContent struct{}
|
|||||||
// Represents error object.
|
// Represents error object.
|
||||||
// Ref: #/components/schemas/Error
|
// Ref: #/components/schemas/Error
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Code uint64 `json:"code"`
|
Code int64 `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCode returns the value of Code.
|
// GetCode returns the value of Code.
|
||||||
func (s *Error) GetCode() uint64 {
|
func (s *Error) GetCode() int64 {
|
||||||
return s.Code
|
return s.Code
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +49,7 @@ func (s *Error) GetMessage() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetCode sets the value of Code.
|
// SetCode sets the value of Code.
|
||||||
func (s *Error) SetCode(val uint64) {
|
func (s *Error) SetCode(val int64) {
|
||||||
s.Code = val
|
s.Code = val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,23 +86,23 @@ func (s *ErrorStatusCode) SetResponse(val Error) {
|
|||||||
|
|
||||||
// Ref: #/components/schemas/MapfixCreate
|
// Ref: #/components/schemas/MapfixCreate
|
||||||
type MapfixCreate struct {
|
type MapfixCreate struct {
|
||||||
OperationID uint32 `json:"OperationID"`
|
OperationID int32 `json:"OperationID"`
|
||||||
AssetOwner uint64 `json:"AssetOwner"`
|
AssetOwner int64 `json:"AssetOwner"`
|
||||||
DisplayName string `json:"DisplayName"`
|
DisplayName string `json:"DisplayName"`
|
||||||
Creator string `json:"Creator"`
|
Creator string `json:"Creator"`
|
||||||
GameID uint32 `json:"GameID"`
|
GameID int32 `json:"GameID"`
|
||||||
AssetID uint64 `json:"AssetID"`
|
AssetID int64 `json:"AssetID"`
|
||||||
AssetVersion uint64 `json:"AssetVersion"`
|
AssetVersion int64 `json:"AssetVersion"`
|
||||||
TargetAssetID uint64 `json:"TargetAssetID"`
|
TargetAssetID int64 `json:"TargetAssetID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOperationID returns the value of OperationID.
|
// GetOperationID returns the value of OperationID.
|
||||||
func (s *MapfixCreate) GetOperationID() uint32 {
|
func (s *MapfixCreate) GetOperationID() int32 {
|
||||||
return s.OperationID
|
return s.OperationID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetOwner returns the value of AssetOwner.
|
// GetAssetOwner returns the value of AssetOwner.
|
||||||
func (s *MapfixCreate) GetAssetOwner() uint64 {
|
func (s *MapfixCreate) GetAssetOwner() int64 {
|
||||||
return s.AssetOwner
|
return s.AssetOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,32 +117,32 @@ func (s *MapfixCreate) GetCreator() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetGameID returns the value of GameID.
|
// GetGameID returns the value of GameID.
|
||||||
func (s *MapfixCreate) GetGameID() uint32 {
|
func (s *MapfixCreate) GetGameID() int32 {
|
||||||
return s.GameID
|
return s.GameID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetID returns the value of AssetID.
|
// GetAssetID returns the value of AssetID.
|
||||||
func (s *MapfixCreate) GetAssetID() uint64 {
|
func (s *MapfixCreate) GetAssetID() int64 {
|
||||||
return s.AssetID
|
return s.AssetID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetVersion returns the value of AssetVersion.
|
// GetAssetVersion returns the value of AssetVersion.
|
||||||
func (s *MapfixCreate) GetAssetVersion() uint64 {
|
func (s *MapfixCreate) GetAssetVersion() int64 {
|
||||||
return s.AssetVersion
|
return s.AssetVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTargetAssetID returns the value of TargetAssetID.
|
// GetTargetAssetID returns the value of TargetAssetID.
|
||||||
func (s *MapfixCreate) GetTargetAssetID() uint64 {
|
func (s *MapfixCreate) GetTargetAssetID() int64 {
|
||||||
return s.TargetAssetID
|
return s.TargetAssetID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOperationID sets the value of OperationID.
|
// SetOperationID sets the value of OperationID.
|
||||||
func (s *MapfixCreate) SetOperationID(val uint32) {
|
func (s *MapfixCreate) SetOperationID(val int32) {
|
||||||
s.OperationID = val
|
s.OperationID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetOwner sets the value of AssetOwner.
|
// SetAssetOwner sets the value of AssetOwner.
|
||||||
func (s *MapfixCreate) SetAssetOwner(val uint64) {
|
func (s *MapfixCreate) SetAssetOwner(val int64) {
|
||||||
s.AssetOwner = val
|
s.AssetOwner = val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,40 +157,132 @@ func (s *MapfixCreate) SetCreator(val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGameID sets the value of GameID.
|
// SetGameID sets the value of GameID.
|
||||||
func (s *MapfixCreate) SetGameID(val uint32) {
|
func (s *MapfixCreate) SetGameID(val int32) {
|
||||||
s.GameID = val
|
s.GameID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetID sets the value of AssetID.
|
// SetAssetID sets the value of AssetID.
|
||||||
func (s *MapfixCreate) SetAssetID(val uint64) {
|
func (s *MapfixCreate) SetAssetID(val int64) {
|
||||||
s.AssetID = val
|
s.AssetID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetVersion sets the value of AssetVersion.
|
// SetAssetVersion sets the value of AssetVersion.
|
||||||
func (s *MapfixCreate) SetAssetVersion(val uint64) {
|
func (s *MapfixCreate) SetAssetVersion(val int64) {
|
||||||
s.AssetVersion = val
|
s.AssetVersion = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTargetAssetID sets the value of TargetAssetID.
|
// SetTargetAssetID sets the value of TargetAssetID.
|
||||||
func (s *MapfixCreate) SetTargetAssetID(val uint64) {
|
func (s *MapfixCreate) SetTargetAssetID(val int64) {
|
||||||
s.TargetAssetID = val
|
s.TargetAssetID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/MapfixID
|
// Ref: #/components/schemas/MapfixID
|
||||||
type MapfixID struct {
|
type MapfixID struct {
|
||||||
MapfixID uint64 `json:"MapfixID"`
|
MapfixID int64 `json:"MapfixID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMapfixID returns the value of MapfixID.
|
// GetMapfixID returns the value of MapfixID.
|
||||||
func (s *MapfixID) GetMapfixID() uint64 {
|
func (s *MapfixID) GetMapfixID() int64 {
|
||||||
return s.MapfixID
|
return s.MapfixID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMapfixID sets the value of MapfixID.
|
// SetMapfixID sets the value of MapfixID.
|
||||||
func (s *MapfixID) SetMapfixID(val uint64) {
|
func (s *MapfixID) SetMapfixID(val int64) {
|
||||||
s.MapfixID = val
|
s.MapfixID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewOptInt32 returns new OptInt32 with value set to v.
|
||||||
|
func NewOptInt32(v int32) OptInt32 {
|
||||||
|
return OptInt32{
|
||||||
|
Value: v,
|
||||||
|
Set: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OptInt32 is optional int32.
|
||||||
|
type OptInt32 struct {
|
||||||
|
Value int32
|
||||||
|
Set bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSet returns true if OptInt32 was set.
|
||||||
|
func (o OptInt32) IsSet() bool { return o.Set }
|
||||||
|
|
||||||
|
// Reset unsets value.
|
||||||
|
func (o *OptInt32) Reset() {
|
||||||
|
var v int32
|
||||||
|
o.Value = v
|
||||||
|
o.Set = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTo sets value to v.
|
||||||
|
func (o *OptInt32) SetTo(v int32) {
|
||||||
|
o.Set = true
|
||||||
|
o.Value = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns value and boolean that denotes whether value was set.
|
||||||
|
func (o OptInt32) Get() (v int32, ok bool) {
|
||||||
|
if !o.Set {
|
||||||
|
return v, false
|
||||||
|
}
|
||||||
|
return o.Value, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or returns value if set, or given parameter if does not.
|
||||||
|
func (o OptInt32) Or(d int32) int32 {
|
||||||
|
if v, ok := o.Get(); ok {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOptInt64 returns new OptInt64 with value set to v.
|
||||||
|
func NewOptInt64(v int64) OptInt64 {
|
||||||
|
return OptInt64{
|
||||||
|
Value: v,
|
||||||
|
Set: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OptInt64 is optional int64.
|
||||||
|
type OptInt64 struct {
|
||||||
|
Value int64
|
||||||
|
Set bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSet returns true if OptInt64 was set.
|
||||||
|
func (o OptInt64) IsSet() bool { return o.Set }
|
||||||
|
|
||||||
|
// Reset unsets value.
|
||||||
|
func (o *OptInt64) Reset() {
|
||||||
|
var v int64
|
||||||
|
o.Value = v
|
||||||
|
o.Set = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTo sets value to v.
|
||||||
|
func (o *OptInt64) SetTo(v int64) {
|
||||||
|
o.Set = true
|
||||||
|
o.Value = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns value and boolean that denotes whether value was set.
|
||||||
|
func (o OptInt64) Get() (v int64, ok bool) {
|
||||||
|
if !o.Set {
|
||||||
|
return v, false
|
||||||
|
}
|
||||||
|
return o.Value, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or returns value if set, or given parameter if does not.
|
||||||
|
func (o OptInt64) Or(d int64) int64 {
|
||||||
|
if v, ok := o.Get(); ok {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
// NewOptString returns new OptString with value set to v.
|
// NewOptString returns new OptString with value set to v.
|
||||||
func NewOptString(v string) OptString {
|
func NewOptString(v string) OptString {
|
||||||
return OptString{
|
return OptString{
|
||||||
@@ -243,110 +329,18 @@ func (o OptString) Or(d string) string {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOptUint32 returns new OptUint32 with value set to v.
|
|
||||||
func NewOptUint32(v uint32) OptUint32 {
|
|
||||||
return OptUint32{
|
|
||||||
Value: v,
|
|
||||||
Set: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OptUint32 is optional uint32.
|
|
||||||
type OptUint32 struct {
|
|
||||||
Value uint32
|
|
||||||
Set bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSet returns true if OptUint32 was set.
|
|
||||||
func (o OptUint32) IsSet() bool { return o.Set }
|
|
||||||
|
|
||||||
// Reset unsets value.
|
|
||||||
func (o *OptUint32) Reset() {
|
|
||||||
var v uint32
|
|
||||||
o.Value = v
|
|
||||||
o.Set = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTo sets value to v.
|
|
||||||
func (o *OptUint32) SetTo(v uint32) {
|
|
||||||
o.Set = true
|
|
||||||
o.Value = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get returns value and boolean that denotes whether value was set.
|
|
||||||
func (o OptUint32) Get() (v uint32, ok bool) {
|
|
||||||
if !o.Set {
|
|
||||||
return v, false
|
|
||||||
}
|
|
||||||
return o.Value, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Or returns value if set, or given parameter if does not.
|
|
||||||
func (o OptUint32) Or(d uint32) uint32 {
|
|
||||||
if v, ok := o.Get(); ok {
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewOptUint64 returns new OptUint64 with value set to v.
|
|
||||||
func NewOptUint64(v uint64) OptUint64 {
|
|
||||||
return OptUint64{
|
|
||||||
Value: v,
|
|
||||||
Set: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OptUint64 is optional uint64.
|
|
||||||
type OptUint64 struct {
|
|
||||||
Value uint64
|
|
||||||
Set bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsSet returns true if OptUint64 was set.
|
|
||||||
func (o OptUint64) IsSet() bool { return o.Set }
|
|
||||||
|
|
||||||
// Reset unsets value.
|
|
||||||
func (o *OptUint64) Reset() {
|
|
||||||
var v uint64
|
|
||||||
o.Value = v
|
|
||||||
o.Set = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTo sets value to v.
|
|
||||||
func (o *OptUint64) SetTo(v uint64) {
|
|
||||||
o.Set = true
|
|
||||||
o.Value = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get returns value and boolean that denotes whether value was set.
|
|
||||||
func (o OptUint64) Get() (v uint64, ok bool) {
|
|
||||||
if !o.Set {
|
|
||||||
return v, false
|
|
||||||
}
|
|
||||||
return o.Value, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Or returns value if set, or given parameter if does not.
|
|
||||||
func (o OptUint64) Or(d uint64) uint64 {
|
|
||||||
if v, ok := o.Get(); ok {
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ref: #/components/schemas/Script
|
// Ref: #/components/schemas/Script
|
||||||
type Script struct {
|
type Script struct {
|
||||||
ID uint64 `json:"ID"`
|
ID int64 `json:"ID"`
|
||||||
Name string `json:"Name"`
|
Name string `json:"Name"`
|
||||||
Hash string `json:"Hash"`
|
Hash string `json:"Hash"`
|
||||||
Source string `json:"Source"`
|
Source string `json:"Source"`
|
||||||
ResourceType uint32 `json:"ResourceType"`
|
ResourceType int32 `json:"ResourceType"`
|
||||||
ResourceID uint64 `json:"ResourceID"`
|
ResourceID int64 `json:"ResourceID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID returns the value of ID.
|
// GetID returns the value of ID.
|
||||||
func (s *Script) GetID() uint64 {
|
func (s *Script) GetID() int64 {
|
||||||
return s.ID
|
return s.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,17 +360,17 @@ func (s *Script) GetSource() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetResourceType returns the value of ResourceType.
|
// GetResourceType returns the value of ResourceType.
|
||||||
func (s *Script) GetResourceType() uint32 {
|
func (s *Script) GetResourceType() int32 {
|
||||||
return s.ResourceType
|
return s.ResourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResourceID returns the value of ResourceID.
|
// GetResourceID returns the value of ResourceID.
|
||||||
func (s *Script) GetResourceID() uint64 {
|
func (s *Script) GetResourceID() int64 {
|
||||||
return s.ResourceID
|
return s.ResourceID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets the value of ID.
|
// SetID sets the value of ID.
|
||||||
func (s *Script) SetID(val uint64) {
|
func (s *Script) SetID(val int64) {
|
||||||
s.ID = val
|
s.ID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,21 +390,21 @@ func (s *Script) SetSource(val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetResourceType sets the value of ResourceType.
|
// SetResourceType sets the value of ResourceType.
|
||||||
func (s *Script) SetResourceType(val uint32) {
|
func (s *Script) SetResourceType(val int32) {
|
||||||
s.ResourceType = val
|
s.ResourceType = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetResourceID sets the value of ResourceID.
|
// SetResourceID sets the value of ResourceID.
|
||||||
func (s *Script) SetResourceID(val uint64) {
|
func (s *Script) SetResourceID(val int64) {
|
||||||
s.ResourceID = val
|
s.ResourceID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/ScriptCreate
|
// Ref: #/components/schemas/ScriptCreate
|
||||||
type ScriptCreate struct {
|
type ScriptCreate struct {
|
||||||
Name string `json:"Name"`
|
Name string `json:"Name"`
|
||||||
Source string `json:"Source"`
|
Source string `json:"Source"`
|
||||||
ResourceType uint32 `json:"ResourceType"`
|
ResourceType int32 `json:"ResourceType"`
|
||||||
ResourceID OptUint64 `json:"ResourceID"`
|
ResourceID OptInt64 `json:"ResourceID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetName returns the value of Name.
|
// GetName returns the value of Name.
|
||||||
@@ -424,12 +418,12 @@ func (s *ScriptCreate) GetSource() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetResourceType returns the value of ResourceType.
|
// GetResourceType returns the value of ResourceType.
|
||||||
func (s *ScriptCreate) GetResourceType() uint32 {
|
func (s *ScriptCreate) GetResourceType() int32 {
|
||||||
return s.ResourceType
|
return s.ResourceType
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResourceID returns the value of ResourceID.
|
// GetResourceID returns the value of ResourceID.
|
||||||
func (s *ScriptCreate) GetResourceID() OptUint64 {
|
func (s *ScriptCreate) GetResourceID() OptInt64 {
|
||||||
return s.ResourceID
|
return s.ResourceID
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,40 +438,40 @@ func (s *ScriptCreate) SetSource(val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetResourceType sets the value of ResourceType.
|
// SetResourceType sets the value of ResourceType.
|
||||||
func (s *ScriptCreate) SetResourceType(val uint32) {
|
func (s *ScriptCreate) SetResourceType(val int32) {
|
||||||
s.ResourceType = val
|
s.ResourceType = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetResourceID sets the value of ResourceID.
|
// SetResourceID sets the value of ResourceID.
|
||||||
func (s *ScriptCreate) SetResourceID(val OptUint64) {
|
func (s *ScriptCreate) SetResourceID(val OptInt64) {
|
||||||
s.ResourceID = val
|
s.ResourceID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/ScriptID
|
// Ref: #/components/schemas/ScriptID
|
||||||
type ScriptID struct {
|
type ScriptID struct {
|
||||||
ScriptID uint64 `json:"ScriptID"`
|
ScriptID int64 `json:"ScriptID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetScriptID returns the value of ScriptID.
|
// GetScriptID returns the value of ScriptID.
|
||||||
func (s *ScriptID) GetScriptID() uint64 {
|
func (s *ScriptID) GetScriptID() int64 {
|
||||||
return s.ScriptID
|
return s.ScriptID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetScriptID sets the value of ScriptID.
|
// SetScriptID sets the value of ScriptID.
|
||||||
func (s *ScriptID) SetScriptID(val uint64) {
|
func (s *ScriptID) SetScriptID(val int64) {
|
||||||
s.ScriptID = val
|
s.ScriptID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/ScriptPolicy
|
// Ref: #/components/schemas/ScriptPolicy
|
||||||
type ScriptPolicy struct {
|
type ScriptPolicy struct {
|
||||||
ID uint64 `json:"ID"`
|
ID int64 `json:"ID"`
|
||||||
FromScriptHash string `json:"FromScriptHash"`
|
FromScriptHash string `json:"FromScriptHash"`
|
||||||
ToScriptID uint64 `json:"ToScriptID"`
|
ToScriptID int64 `json:"ToScriptID"`
|
||||||
Policy uint32 `json:"Policy"`
|
Policy int32 `json:"Policy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID returns the value of ID.
|
// GetID returns the value of ID.
|
||||||
func (s *ScriptPolicy) GetID() uint64 {
|
func (s *ScriptPolicy) GetID() int64 {
|
||||||
return s.ID
|
return s.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,17 +481,17 @@ func (s *ScriptPolicy) GetFromScriptHash() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetToScriptID returns the value of ToScriptID.
|
// GetToScriptID returns the value of ToScriptID.
|
||||||
func (s *ScriptPolicy) GetToScriptID() uint64 {
|
func (s *ScriptPolicy) GetToScriptID() int64 {
|
||||||
return s.ToScriptID
|
return s.ToScriptID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPolicy returns the value of Policy.
|
// GetPolicy returns the value of Policy.
|
||||||
func (s *ScriptPolicy) GetPolicy() uint32 {
|
func (s *ScriptPolicy) GetPolicy() int32 {
|
||||||
return s.Policy
|
return s.Policy
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetID sets the value of ID.
|
// SetID sets the value of ID.
|
||||||
func (s *ScriptPolicy) SetID(val uint64) {
|
func (s *ScriptPolicy) SetID(val int64) {
|
||||||
s.ID = val
|
s.ID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,85 +501,85 @@ func (s *ScriptPolicy) SetFromScriptHash(val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetToScriptID sets the value of ToScriptID.
|
// SetToScriptID sets the value of ToScriptID.
|
||||||
func (s *ScriptPolicy) SetToScriptID(val uint64) {
|
func (s *ScriptPolicy) SetToScriptID(val int64) {
|
||||||
s.ToScriptID = val
|
s.ToScriptID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPolicy sets the value of Policy.
|
// SetPolicy sets the value of Policy.
|
||||||
func (s *ScriptPolicy) SetPolicy(val uint32) {
|
func (s *ScriptPolicy) SetPolicy(val int32) {
|
||||||
s.Policy = val
|
s.Policy = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/ScriptPolicyCreate
|
// Ref: #/components/schemas/ScriptPolicyCreate
|
||||||
type ScriptPolicyCreate struct {
|
type ScriptPolicyCreate struct {
|
||||||
FromScriptID uint64 `json:"FromScriptID"`
|
FromScriptID int64 `json:"FromScriptID"`
|
||||||
ToScriptID uint64 `json:"ToScriptID"`
|
ToScriptID int64 `json:"ToScriptID"`
|
||||||
Policy uint32 `json:"Policy"`
|
Policy int32 `json:"Policy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFromScriptID returns the value of FromScriptID.
|
// GetFromScriptID returns the value of FromScriptID.
|
||||||
func (s *ScriptPolicyCreate) GetFromScriptID() uint64 {
|
func (s *ScriptPolicyCreate) GetFromScriptID() int64 {
|
||||||
return s.FromScriptID
|
return s.FromScriptID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetToScriptID returns the value of ToScriptID.
|
// GetToScriptID returns the value of ToScriptID.
|
||||||
func (s *ScriptPolicyCreate) GetToScriptID() uint64 {
|
func (s *ScriptPolicyCreate) GetToScriptID() int64 {
|
||||||
return s.ToScriptID
|
return s.ToScriptID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPolicy returns the value of Policy.
|
// GetPolicy returns the value of Policy.
|
||||||
func (s *ScriptPolicyCreate) GetPolicy() uint32 {
|
func (s *ScriptPolicyCreate) GetPolicy() int32 {
|
||||||
return s.Policy
|
return s.Policy
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFromScriptID sets the value of FromScriptID.
|
// SetFromScriptID sets the value of FromScriptID.
|
||||||
func (s *ScriptPolicyCreate) SetFromScriptID(val uint64) {
|
func (s *ScriptPolicyCreate) SetFromScriptID(val int64) {
|
||||||
s.FromScriptID = val
|
s.FromScriptID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetToScriptID sets the value of ToScriptID.
|
// SetToScriptID sets the value of ToScriptID.
|
||||||
func (s *ScriptPolicyCreate) SetToScriptID(val uint64) {
|
func (s *ScriptPolicyCreate) SetToScriptID(val int64) {
|
||||||
s.ToScriptID = val
|
s.ToScriptID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPolicy sets the value of Policy.
|
// SetPolicy sets the value of Policy.
|
||||||
func (s *ScriptPolicyCreate) SetPolicy(val uint32) {
|
func (s *ScriptPolicyCreate) SetPolicy(val int32) {
|
||||||
s.Policy = val
|
s.Policy = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/ScriptPolicyID
|
// Ref: #/components/schemas/ScriptPolicyID
|
||||||
type ScriptPolicyID struct {
|
type ScriptPolicyID struct {
|
||||||
ScriptPolicyID uint64 `json:"ScriptPolicyID"`
|
ScriptPolicyID int64 `json:"ScriptPolicyID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetScriptPolicyID returns the value of ScriptPolicyID.
|
// GetScriptPolicyID returns the value of ScriptPolicyID.
|
||||||
func (s *ScriptPolicyID) GetScriptPolicyID() uint64 {
|
func (s *ScriptPolicyID) GetScriptPolicyID() int64 {
|
||||||
return s.ScriptPolicyID
|
return s.ScriptPolicyID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetScriptPolicyID sets the value of ScriptPolicyID.
|
// SetScriptPolicyID sets the value of ScriptPolicyID.
|
||||||
func (s *ScriptPolicyID) SetScriptPolicyID(val uint64) {
|
func (s *ScriptPolicyID) SetScriptPolicyID(val int64) {
|
||||||
s.ScriptPolicyID = val
|
s.ScriptPolicyID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/SubmissionCreate
|
// Ref: #/components/schemas/SubmissionCreate
|
||||||
type SubmissionCreate struct {
|
type SubmissionCreate struct {
|
||||||
OperationID uint32 `json:"OperationID"`
|
OperationID int32 `json:"OperationID"`
|
||||||
AssetOwner uint64 `json:"AssetOwner"`
|
AssetOwner int64 `json:"AssetOwner"`
|
||||||
DisplayName string `json:"DisplayName"`
|
DisplayName string `json:"DisplayName"`
|
||||||
Creator string `json:"Creator"`
|
Creator string `json:"Creator"`
|
||||||
GameID uint32 `json:"GameID"`
|
GameID int32 `json:"GameID"`
|
||||||
AssetID uint64 `json:"AssetID"`
|
AssetID int64 `json:"AssetID"`
|
||||||
AssetVersion uint64 `json:"AssetVersion"`
|
AssetVersion int64 `json:"AssetVersion"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOperationID returns the value of OperationID.
|
// GetOperationID returns the value of OperationID.
|
||||||
func (s *SubmissionCreate) GetOperationID() uint32 {
|
func (s *SubmissionCreate) GetOperationID() int32 {
|
||||||
return s.OperationID
|
return s.OperationID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetOwner returns the value of AssetOwner.
|
// GetAssetOwner returns the value of AssetOwner.
|
||||||
func (s *SubmissionCreate) GetAssetOwner() uint64 {
|
func (s *SubmissionCreate) GetAssetOwner() int64 {
|
||||||
return s.AssetOwner
|
return s.AssetOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,27 +594,27 @@ func (s *SubmissionCreate) GetCreator() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetGameID returns the value of GameID.
|
// GetGameID returns the value of GameID.
|
||||||
func (s *SubmissionCreate) GetGameID() uint32 {
|
func (s *SubmissionCreate) GetGameID() int32 {
|
||||||
return s.GameID
|
return s.GameID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetID returns the value of AssetID.
|
// GetAssetID returns the value of AssetID.
|
||||||
func (s *SubmissionCreate) GetAssetID() uint64 {
|
func (s *SubmissionCreate) GetAssetID() int64 {
|
||||||
return s.AssetID
|
return s.AssetID
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAssetVersion returns the value of AssetVersion.
|
// GetAssetVersion returns the value of AssetVersion.
|
||||||
func (s *SubmissionCreate) GetAssetVersion() uint64 {
|
func (s *SubmissionCreate) GetAssetVersion() int64 {
|
||||||
return s.AssetVersion
|
return s.AssetVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetOperationID sets the value of OperationID.
|
// SetOperationID sets the value of OperationID.
|
||||||
func (s *SubmissionCreate) SetOperationID(val uint32) {
|
func (s *SubmissionCreate) SetOperationID(val int32) {
|
||||||
s.OperationID = val
|
s.OperationID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetOwner sets the value of AssetOwner.
|
// SetAssetOwner sets the value of AssetOwner.
|
||||||
func (s *SubmissionCreate) SetAssetOwner(val uint64) {
|
func (s *SubmissionCreate) SetAssetOwner(val int64) {
|
||||||
s.AssetOwner = val
|
s.AssetOwner = val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,32 +629,32 @@ func (s *SubmissionCreate) SetCreator(val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGameID sets the value of GameID.
|
// SetGameID sets the value of GameID.
|
||||||
func (s *SubmissionCreate) SetGameID(val uint32) {
|
func (s *SubmissionCreate) SetGameID(val int32) {
|
||||||
s.GameID = val
|
s.GameID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetID sets the value of AssetID.
|
// SetAssetID sets the value of AssetID.
|
||||||
func (s *SubmissionCreate) SetAssetID(val uint64) {
|
func (s *SubmissionCreate) SetAssetID(val int64) {
|
||||||
s.AssetID = val
|
s.AssetID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetVersion sets the value of AssetVersion.
|
// SetAssetVersion sets the value of AssetVersion.
|
||||||
func (s *SubmissionCreate) SetAssetVersion(val uint64) {
|
func (s *SubmissionCreate) SetAssetVersion(val int64) {
|
||||||
s.AssetVersion = val
|
s.AssetVersion = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: #/components/schemas/SubmissionID
|
// Ref: #/components/schemas/SubmissionID
|
||||||
type SubmissionID struct {
|
type SubmissionID struct {
|
||||||
SubmissionID uint64 `json:"SubmissionID"`
|
SubmissionID int64 `json:"SubmissionID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSubmissionID returns the value of SubmissionID.
|
// GetSubmissionID returns the value of SubmissionID.
|
||||||
func (s *SubmissionID) GetSubmissionID() uint64 {
|
func (s *SubmissionID) GetSubmissionID() int64 {
|
||||||
return s.SubmissionID
|
return s.SubmissionID
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSubmissionID sets the value of SubmissionID.
|
// SetSubmissionID sets the value of SubmissionID.
|
||||||
func (s *SubmissionID) SetSubmissionID(val uint64) {
|
func (s *SubmissionID) SetSubmissionID(val int64) {
|
||||||
s.SubmissionID = val
|
s.SubmissionID = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-failed
|
// POST /mapfixes/{MapfixID}/status/validator-failed
|
||||||
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
ActionMapfixAccepted(ctx context.Context, params ActionMapfixAcceptedParams) error
|
||||||
// ActionMapfixSubmitted implements actionMapfixSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error
|
|
||||||
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -44,12 +38,6 @@ type Handler interface {
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/validator-failed
|
// POST /submissions/{SubmissionID}/status/validator-failed
|
||||||
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
ActionSubmissionAccepted(ctx context.Context, params ActionSubmissionAcceptedParams) error
|
||||||
// ActionSubmissionSubmitted implements actionSubmissionSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error
|
|
||||||
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -22,15 +22,6 @@ func (UnimplementedHandler) ActionMapfixAccepted(ctx context.Context, params Act
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixSubmitted implements actionMapfixSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
func (UnimplementedHandler) ActionMapfixSubmitted(ctx context.Context, params ActionMapfixSubmittedParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
@@ -67,15 +58,6 @@ func (UnimplementedHandler) ActionSubmissionAccepted(ctx context.Context, params
|
|||||||
return ht.ErrNotImplemented
|
return ht.ErrNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionSubmitted implements actionSubmissionSubmitted operation.
|
|
||||||
//
|
|
||||||
// (Internal endpoint) Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
func (UnimplementedHandler) ActionSubmissionSubmitted(ctx context.Context, params ActionSubmissionSubmittedParams) error {
|
|
||||||
return ht.ErrNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
||||||
//
|
//
|
||||||
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
// (Internal endpoint) Role Validator changes status from Uploading -> Uploaded.
|
||||||
|
|||||||
@@ -8,107 +8,12 @@ import (
|
|||||||
"github.com/ogen-go/ogen/validate"
|
"github.com/ogen-go/ogen/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Error) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.Code)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "code",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ErrorStatusCode) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := s.Response.Validate(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "Response",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MapfixCreate) Validate() error {
|
func (s *MapfixCreate) Validate() error {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return validate.ErrNilPointer
|
return validate.ErrNilPointer
|
||||||
}
|
}
|
||||||
|
|
||||||
var failures []validate.FieldError
|
var failures []validate.FieldError
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.OperationID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "OperationID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetOwner)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetOwner",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
if err := (validate.String{
|
if err := (validate.String{
|
||||||
MinLength: 0,
|
MinLength: 0,
|
||||||
@@ -147,118 +52,6 @@ func (s *MapfixCreate) Validate() error {
|
|||||||
Error: err,
|
Error: err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.GameID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "GameID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetVersion)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetVersion",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.TargetAssetID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "TargetAssetID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *MapfixID) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.MapfixID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "MapfixID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
@@ -271,26 +64,6 @@ func (s *Script) Validate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var failures []validate.FieldError
|
var failures []validate.FieldError
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
if err := (validate.String{
|
if err := (validate.String{
|
||||||
MinLength: 0,
|
MinLength: 0,
|
||||||
@@ -348,46 +121,6 @@ func (s *Script) Validate() error {
|
|||||||
Error: err,
|
Error: err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ResourceType)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ResourceType",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ResourceID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ResourceID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
@@ -438,85 +171,6 @@ func (s *ScriptCreate) Validate() error {
|
|||||||
Error: err,
|
Error: err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ResourceType)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ResourceType",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if value, ok := s.ResourceID.Get(); ok {
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(value)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ResourceID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ScriptID) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ScriptID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ScriptID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
@@ -529,26 +183,6 @@ func (s *ScriptPolicy) Validate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var failures []validate.FieldError
|
var failures []validate.FieldError
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
if err := (validate.String{
|
if err := (validate.String{
|
||||||
MinLength: 16,
|
MinLength: 16,
|
||||||
@@ -568,150 +202,6 @@ func (s *ScriptPolicy) Validate() error {
|
|||||||
Error: err,
|
Error: err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ToScriptID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ToScriptID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.Policy)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "Policy",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ScriptPolicyCreate) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.FromScriptID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "FromScriptID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ToScriptID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ToScriptID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.Policy)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "Policy",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ScriptPolicyID) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.ScriptPolicyID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "ScriptPolicyID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
@@ -724,46 +214,6 @@ func (s *SubmissionCreate) Validate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var failures []validate.FieldError
|
var failures []validate.FieldError
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.OperationID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "OperationID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetOwner)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetOwner",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
if err := func() error {
|
||||||
if err := (validate.String{
|
if err := (validate.String{
|
||||||
MinLength: 0,
|
MinLength: 0,
|
||||||
@@ -802,98 +252,6 @@ func (s *SubmissionCreate) Validate() error {
|
|||||||
Error: err,
|
Error: err,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.GameID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "GameID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.AssetVersion)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "AssetVersion",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
|
||||||
return &validate.Error{Fields: failures}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SubmissionID) Validate() error {
|
|
||||||
if s == nil {
|
|
||||||
return validate.ErrNilPointer
|
|
||||||
}
|
|
||||||
|
|
||||||
var failures []validate.FieldError
|
|
||||||
if err := func() error {
|
|
||||||
if err := (validate.Int{
|
|
||||||
MinSet: true,
|
|
||||||
Min: 0,
|
|
||||||
MaxSet: false,
|
|
||||||
Max: 0,
|
|
||||||
MinExclusive: false,
|
|
||||||
MaxExclusive: false,
|
|
||||||
MultipleOfSet: false,
|
|
||||||
MultipleOf: 0,
|
|
||||||
}).Validate(int64(s.SubmissionID)); err != nil {
|
|
||||||
return errors.Wrap(err, "int")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}(); err != nil {
|
|
||||||
failures = append(failures, validate.FieldError{
|
|
||||||
Name: "SubmissionID",
|
|
||||||
Error: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(failures) > 0 {
|
if len(failures) > 0 {
|
||||||
return &validate.Error{Fields: failures}
|
return &validate.Error{Fields: failures}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AuditEventType uint32
|
|
||||||
|
|
||||||
// User clicked "Submit", "Accept" etc
|
|
||||||
const AuditEventTypeAction AuditEventType = 0
|
|
||||||
type AuditEventDataAction struct {
|
|
||||||
TargetStatus uint32 `json:"target_status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// User wrote a comment
|
|
||||||
const AuditEventTypeComment AuditEventType = 1
|
|
||||||
type AuditEventDataComment struct {
|
|
||||||
Comment string `json:"comment"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// User changed Model
|
|
||||||
const AuditEventTypeChangeModel AuditEventType = 2
|
|
||||||
type AuditEventDataChangeModel struct {
|
|
||||||
OldModelID uint64 `json:"old_model_id"`
|
|
||||||
OldModelVersion uint64 `json:"old_model_version"`
|
|
||||||
NewModelID uint64 `json:"new_model_id"`
|
|
||||||
NewModelVersion uint64 `json:"new_model_version"`
|
|
||||||
}
|
|
||||||
// Validator validates model
|
|
||||||
const AuditEventTypeChangeValidatedModel AuditEventType = 3
|
|
||||||
type AuditEventDataChangeValidatedModel struct {
|
|
||||||
ValidatedModelID uint64 `json:"validated_model_id"`
|
|
||||||
ValidatedModelVersion uint64 `json:"validated_model_version"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// User changed DisplayName / Creator
|
|
||||||
const AuditEventTypeChangeDisplayName AuditEventType = 4
|
|
||||||
const AuditEventTypeChangeCreator AuditEventType = 5
|
|
||||||
type AuditEventDataChangeName struct {
|
|
||||||
OldName string `json:"old_name"`
|
|
||||||
NewName string `json:"new_name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AuditEvent struct {
|
|
||||||
ID uint64 `gorm:"primaryKey"`
|
|
||||||
CreatedAt time.Time
|
|
||||||
User uint64
|
|
||||||
ResourceType ResourceType // is this a submission or is it a mapfix
|
|
||||||
ResourceID uint64 // submission / mapfix / map ID
|
|
||||||
EventType AuditEventType
|
|
||||||
EventData json.RawMessage `gorm:"type:jsonb"`
|
|
||||||
}
|
|
||||||
@@ -2,42 +2,39 @@ package model
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type MapfixStatus uint32
|
type MapfixStatus int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Phase: Creation
|
// Phase: Final MapfixStatus
|
||||||
MapfixStatusUnderConstruction MapfixStatus = 0
|
MapfixStatusRejected MapfixStatus = 8
|
||||||
MapfixStatusChangesRequested MapfixStatus = 1
|
MapfixStatusUploaded MapfixStatus = 7 // uploaded to the group, final status for mapfixes
|
||||||
|
|
||||||
// Phase: Review
|
|
||||||
MapfixStatusSubmitting MapfixStatus = 2
|
|
||||||
MapfixStatusSubmitted MapfixStatus = 3
|
|
||||||
|
|
||||||
// Phase: Testing
|
// Phase: Testing
|
||||||
MapfixStatusAcceptedUnvalidated MapfixStatus = 4 // pending script review, can re-trigger validation
|
MapfixStatusUploading MapfixStatus = 6
|
||||||
MapfixStatusValidating MapfixStatus = 5
|
MapfixStatusValidated MapfixStatus = 5
|
||||||
MapfixStatusValidated MapfixStatus = 6
|
MapfixStatusValidating MapfixStatus = 4
|
||||||
MapfixStatusUploading MapfixStatus = 7
|
MapfixStatusAccepted MapfixStatus = 3 // pending script review, can re-trigger validation
|
||||||
|
|
||||||
// Phase: Final MapfixStatus
|
// Phase: Creation
|
||||||
MapfixStatusUploaded MapfixStatus = 8 // uploaded to the group, but pending release
|
MapfixStatusChangesRequested MapfixStatus = 2
|
||||||
MapfixStatusRejected MapfixStatus = 9
|
MapfixStatusSubmitted MapfixStatus = 1
|
||||||
|
MapfixStatusUnderConstruction MapfixStatus = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mapfix struct {
|
type Mapfix struct {
|
||||||
ID uint64 `gorm:"primaryKey"`
|
ID int64 `gorm:"primaryKey"`
|
||||||
DisplayName string
|
DisplayName string
|
||||||
Creator string
|
Creator string
|
||||||
GameID uint32
|
GameID int32
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
Submitter uint64 // UserID
|
Submitter int64 // UserID
|
||||||
AssetID uint64
|
AssetID int64
|
||||||
AssetVersion uint64
|
AssetVersion int64
|
||||||
ValidatedAssetID uint64
|
ValidatedAssetID int64
|
||||||
ValidatedAssetVersion uint64
|
ValidatedAssetVersion int64
|
||||||
Completed bool // Has this version of the map been completed at least once on maptest
|
Completed bool // Has this version of the map been completed at least once on maptest
|
||||||
TargetAssetID uint64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
|
TargetAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
|
||||||
StatusID MapfixStatus
|
StatusID MapfixStatus
|
||||||
StatusMessage string
|
StatusMessage string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,42 +7,42 @@ package model
|
|||||||
|
|
||||||
type CreateSubmissionRequest struct {
|
type CreateSubmissionRequest struct {
|
||||||
// operation_id is passed back in the response message
|
// operation_id is passed back in the response message
|
||||||
OperationID uint32
|
OperationID int32
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateMapfixRequest struct {
|
type CreateMapfixRequest struct {
|
||||||
OperationID uint32
|
OperationID int32
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
TargetAssetID uint64
|
TargetAssetID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type ValidateSubmissionRequest struct {
|
type ValidateSubmissionRequest struct {
|
||||||
// submission_id is passed back in the response message
|
// submission_id is passed back in the response message
|
||||||
SubmissionID uint64
|
SubmissionID int64
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
ModelVersion uint64
|
ModelVersion int64
|
||||||
ValidatedModelID *uint64 // optional value
|
ValidatedModelID *int64 // optional value
|
||||||
}
|
}
|
||||||
|
|
||||||
type ValidateMapfixRequest struct {
|
type ValidateMapfixRequest struct {
|
||||||
MapfixID uint64
|
MapfixID int64
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
ModelVersion uint64
|
ModelVersion int64
|
||||||
ValidatedModelID *uint64 // optional value
|
ValidatedModelID *int64 // optional value
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new map
|
// Create a new map
|
||||||
type UploadSubmissionRequest struct {
|
type UploadSubmissionRequest struct {
|
||||||
SubmissionID uint64
|
SubmissionID int64
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
ModelVersion uint64
|
ModelVersion int64
|
||||||
ModelName string
|
ModelName string
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadMapfixRequest struct {
|
type UploadMapfixRequest struct {
|
||||||
MapfixID uint64
|
MapfixID int64
|
||||||
ModelID uint64
|
ModelID int64
|
||||||
ModelVersion uint64
|
ModelVersion int64
|
||||||
TargetAssetID uint64
|
TargetAssetID int64
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type OperationStatus uint32
|
type OperationStatus int32
|
||||||
const (
|
const (
|
||||||
OperationStatusCreated OperationStatus = 0
|
OperationStatusCreated OperationStatus = 0
|
||||||
OperationStatusCompleted OperationStatus = 1
|
OperationStatusCompleted OperationStatus = 1
|
||||||
@@ -10,9 +10,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Operation struct {
|
type Operation struct {
|
||||||
ID uint32 `gorm:"primaryKey"`
|
ID int32 `gorm:"primaryKey"`
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
Owner uint64 // UserID
|
Owner int64 // UserID
|
||||||
StatusID OperationStatus
|
StatusID OperationStatus
|
||||||
StatusMessage string
|
StatusMessage string
|
||||||
Path string // redirect to view completed operation e.g. "/mapfixes/4"
|
Path string // redirect to view completed operation e.g. "/mapfixes/4"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
type Page struct {
|
type Page struct {
|
||||||
Number uint32
|
Number int32
|
||||||
Size uint32
|
Size int32
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package model
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type Policy uint32
|
type Policy int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ScriptPolicyNone Policy = 0 // not yet reviewed
|
ScriptPolicyNone Policy = 0 // not yet reviewed
|
||||||
@@ -13,7 +13,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ScriptPolicy struct {
|
type ScriptPolicy struct {
|
||||||
ID uint64 `gorm:"primaryKey"`
|
ID int64 `gorm:"primaryKey"`
|
||||||
// Hash of the source code that leads to this policy.
|
// Hash of the source code that leads to this policy.
|
||||||
// If this is a replacement mapping, the original source may not be pointed to by any policy.
|
// If this is a replacement mapping, the original source may not be pointed to by any policy.
|
||||||
// The original source should still exist in the scripts table, which can be located by the same hash.
|
// The original source should still exist in the scripts table, which can be located by the same hash.
|
||||||
@@ -21,7 +21,7 @@ type ScriptPolicy struct {
|
|||||||
// The ID of the replacement source (ScriptPolicyReplace)
|
// The ID of the replacement source (ScriptPolicyReplace)
|
||||||
// or verbatim source (ScriptPolicyAllowed)
|
// or verbatim source (ScriptPolicyAllowed)
|
||||||
// or 0 (other)
|
// or 0 (other)
|
||||||
ToScriptID uint64
|
ToScriptID int64
|
||||||
Policy Policy
|
Policy Policy
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func HashParse(hash string) (uint64, error){
|
|||||||
return strconv.ParseUint(hash, 16, 64)
|
return strconv.ParseUint(hash, 16, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceType uint32
|
type ResourceType int32
|
||||||
const (
|
const (
|
||||||
ResourceUnknown ResourceType = 0
|
ResourceUnknown ResourceType = 0
|
||||||
ResourceMapfix ResourceType = 1
|
ResourceMapfix ResourceType = 1
|
||||||
@@ -31,17 +31,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Script struct {
|
type Script struct {
|
||||||
ID uint64 `gorm:"primaryKey"`
|
ID int64 `gorm:"primaryKey"`
|
||||||
Name string
|
Name string
|
||||||
hash uint64
|
Hash int64 // postgres does not support unsigned integers, so we have to pretend
|
||||||
Source string
|
Source string
|
||||||
ResourceType ResourceType // is this a submission or is it a mapfix
|
ResourceType ResourceType // is this a submission or is it a mapfix
|
||||||
ResourceID uint64 // which submission / mapfix did this script first appear in
|
ResourceID int64 // which submission / mapfix did this script first appear in
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// postgres does not support unsigned integers, so we have to pretend
|
|
||||||
func (script *Script) GetPostgresInt64() (int64) {
|
|
||||||
return int64(script.hash)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,43 +2,40 @@ package model
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type SubmissionStatus uint32
|
type SubmissionStatus int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Phase: Creation
|
// Phase: Final SubmissionStatus
|
||||||
SubmissionStatusUnderConstruction SubmissionStatus = 0
|
SubmissionStatusReleased SubmissionStatus = 9
|
||||||
SubmissionStatusChangesRequested SubmissionStatus = 1
|
SubmissionStatusRejected SubmissionStatus = 8
|
||||||
|
|
||||||
// Phase: Review
|
|
||||||
SubmissionStatusSubmitting SubmissionStatus = 2
|
|
||||||
SubmissionStatusSubmitted SubmissionStatus = 3
|
|
||||||
|
|
||||||
// Phase: Testing
|
// Phase: Testing
|
||||||
SubmissionStatusAcceptedUnvalidated SubmissionStatus = 4 // pending script review, can re-trigger validation
|
SubmissionStatusUploaded SubmissionStatus = 7 // uploaded to the group, but pending release
|
||||||
SubmissionStatusValidating SubmissionStatus = 5
|
SubmissionStatusUploading SubmissionStatus = 6
|
||||||
SubmissionStatusValidated SubmissionStatus = 6
|
SubmissionStatusValidated SubmissionStatus = 5
|
||||||
SubmissionStatusUploading SubmissionStatus = 7
|
SubmissionStatusValidating SubmissionStatus = 4
|
||||||
SubmissionStatusUploaded SubmissionStatus = 8 // uploaded to the group, but pending release
|
SubmissionStatusAccepted SubmissionStatus = 3 // pending script review, can re-trigger validation
|
||||||
|
|
||||||
// Phase: Final SubmissionStatus
|
// Phase: Creation
|
||||||
SubmissionStatusRejected SubmissionStatus = 9
|
SubmissionStatusChangesRequested SubmissionStatus = 2
|
||||||
SubmissionStatusReleased SubmissionStatus = 10
|
SubmissionStatusSubmitted SubmissionStatus = 1
|
||||||
|
SubmissionStatusUnderConstruction SubmissionStatus = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
type Submission struct {
|
type Submission struct {
|
||||||
ID uint64 `gorm:"primaryKey"`
|
ID int64 `gorm:"primaryKey"`
|
||||||
DisplayName string
|
DisplayName string
|
||||||
Creator string
|
Creator string
|
||||||
GameID uint32
|
GameID int32
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time
|
UpdatedAt time.Time
|
||||||
Submitter uint64 // UserID
|
Submitter int64 // UserID
|
||||||
AssetID uint64
|
AssetID int64
|
||||||
AssetVersion uint64
|
AssetVersion int64
|
||||||
ValidatedAssetID uint64
|
ValidatedAssetID int64
|
||||||
ValidatedAssetVersion uint64
|
ValidatedAssetVersion int64
|
||||||
Completed bool // Has this version of the map been completed at least once on maptest
|
Completed bool // Has this version of the map been completed at least once on maptest
|
||||||
UploadedAssetID uint64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
|
UploadedAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
|
||||||
StatusID SubmissionStatus
|
StatusID SubmissionStatus
|
||||||
StatusMessage string
|
StatusMessage string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/api"
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
// CreateMapfixAuditComment implements createMapfixAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/comment
|
|
||||||
func (svc *Service) CreateMapfixAuditComment(ctx context.Context, req api.CreateMapfixAuditCommentReq, params api.CreateMapfixAuditCommentParams) (error) {
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
|
||||||
if !ok {
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
has_role, err := userInfo.HasRoleMapfixReview()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !has_role {
|
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
data := []byte{}
|
|
||||||
_, err = req.Read(data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
Comment := string(data)
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataComment{
|
|
||||||
Comment: Comment,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeComment,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListMapfixAuditEvents invokes listMapfixAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /mapfixes/{MapfixID}/audit-events
|
|
||||||
func (svc *Service) ListMapfixAuditEvents(ctx context.Context, params api.ListMapfixAuditEventsParams) ([]api.AuditEvent, error) {
|
|
||||||
filter := datastore.Optional()
|
|
||||||
|
|
||||||
filter.AddPostgresInt32("resource_type", uint32(model.ResourceMapfix))
|
|
||||||
filter.AddPostgresInt64("resource_id", params.MapfixID)
|
|
||||||
|
|
||||||
items, err := svc.DB.AuditEvents().List(ctx, filter, model.Page{
|
|
||||||
Number: params.Page,
|
|
||||||
Size: params.Limit,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var resp []api.AuditEvent
|
|
||||||
for _, item := range items {
|
|
||||||
EventData := api.AuditEventEventData{}
|
|
||||||
err = EventData.UnmarshalJSON(item.EventData)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
resp = append(resp, api.AuditEvent{
|
|
||||||
ID: item.ID,
|
|
||||||
Date: item.CreatedAt.Unix(),
|
|
||||||
User: item.User,
|
|
||||||
ResourceType: uint32(item.ResourceType),
|
|
||||||
ResourceID: item.ResourceID,
|
|
||||||
EventType: uint32(item.EventType),
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSubmissionAuditComment implements createSubmissionAuditComment operation.
|
|
||||||
//
|
|
||||||
// Post a comment to the audit log
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/comment
|
|
||||||
func (svc *Service) CreateSubmissionAuditComment(ctx context.Context, req api.CreateSubmissionAuditCommentReq, params api.CreateSubmissionAuditCommentParams) (error) {
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
|
||||||
if !ok {
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
has_role, err := userInfo.HasRoleSubmissionReview()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !has_role {
|
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
data := []byte{}
|
|
||||||
_, err = req.Read(data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
Comment := string(data)
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataComment{
|
|
||||||
Comment: Comment,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeComment,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSubmissionAuditEvents invokes listSubmissionAuditEvents operation.
|
|
||||||
//
|
|
||||||
// Retrieve a list of audit events.
|
|
||||||
//
|
|
||||||
// GET /submissions/{SubmissionID}/audit-events
|
|
||||||
func (svc *Service) ListSubmissionAuditEvents(ctx context.Context, params api.ListSubmissionAuditEventsParams) ([]api.AuditEvent, error) {
|
|
||||||
filter := datastore.Optional()
|
|
||||||
|
|
||||||
filter.AddPostgresInt32("resource_type", uint32(model.ResourceSubmission))
|
|
||||||
filter.AddPostgresInt64("resource_id", params.SubmissionID)
|
|
||||||
|
|
||||||
items, err := svc.DB.AuditEvents().List(ctx, filter, model.Page{
|
|
||||||
Number: params.Page,
|
|
||||||
Size: params.Limit,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var resp []api.AuditEvent
|
|
||||||
for _, item := range items {
|
|
||||||
EventData := api.AuditEventEventData{}
|
|
||||||
err = EventData.UnmarshalJSON(item.EventData)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
resp = append(resp, api.AuditEvent{
|
|
||||||
ID: item.ID,
|
|
||||||
Date: item.CreatedAt.Unix(),
|
|
||||||
User: item.User,
|
|
||||||
ResourceType: uint32(item.ResourceType),
|
|
||||||
ResourceID: item.ResourceID,
|
|
||||||
EventType: uint32(item.EventType),
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
@@ -25,29 +25,18 @@ var(
|
|||||||
model.MapfixStatusUploading,
|
model.MapfixStatusUploading,
|
||||||
model.MapfixStatusValidated,
|
model.MapfixStatusValidated,
|
||||||
model.MapfixStatusValidating,
|
model.MapfixStatusValidating,
|
||||||
model.MapfixStatusAcceptedUnvalidated,
|
model.MapfixStatusAccepted,
|
||||||
}
|
}
|
||||||
// Allow 5 mapfixes every 10 minutes
|
|
||||||
CreateMapfixRateLimit int64 = 5
|
|
||||||
CreateMapfixRecencyWindow = time.Second*600
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrCreationPhaseMapfixesLimit = errors.New("Active mapfixes limited to 20")
|
ErrCreationPhaseMapfixesLimit = errors.New("Active mapfixes limited to 20")
|
||||||
ErrActiveMapfixSameTargetAssetID = errors.New("There is an active mapfix with the same TargetAssetID")
|
ErrActiveMapfixSameTargetAssetID = errors.New("There is an active mapfix with the same TargetAssetID")
|
||||||
ErrAcceptOwnMapfix = fmt.Errorf("%w: You cannot accept your own mapfix as the submitter", ErrPermissionDenied)
|
ErrAcceptOwnMapfix = fmt.Errorf("%w: You cannot accept your own mapfix as the submitter", ErrPermissionDenied)
|
||||||
ErrCreateMapfixRateLimit = errors.New("You must not create more than 5 mapfixes every 10 minutes")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// POST /mapfixes
|
// POST /mapfixes
|
||||||
func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTriggerCreate) (*api.OperationID, error) {
|
func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTriggerCreate) (*api.OperationID, error) {
|
||||||
// sanitization
|
|
||||||
if request.AssetID<0 || request.TargetAssetID<0{
|
|
||||||
return nil, ErrNegativeID
|
|
||||||
}
|
|
||||||
var ModelID=uint64(request.AssetID);
|
|
||||||
var TargetAssetID=uint64(request.TargetAssetID);
|
|
||||||
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, ErrUserInfo
|
return nil, ErrUserInfo
|
||||||
@@ -65,7 +54,7 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
filter.Add("status_id", CreationPhaseMapfixStatuses)
|
filter.Add("status_id", CreationPhaseMapfixStatuses)
|
||||||
creation_mapfixes, err := svc.DB.Mapfixes().List(ctx, filter, model.Page{
|
creation_mapfixes, err := svc.DB.Mapfixes().List(ctx, filter, model.Page{
|
||||||
Number: 1,
|
Number: 1,
|
||||||
Size: uint32(CreationPhaseMapfixesLimit),
|
Size: int32(CreationPhaseMapfixesLimit),
|
||||||
},datastore.ListSortDisabled)
|
},datastore.ListSortDisabled)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -87,23 +76,8 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if too many operations have been created recently
|
|
||||||
{
|
|
||||||
count, err := svc.DB.Operations().CountSince(ctx,
|
|
||||||
int64(userId),
|
|
||||||
time.Now().Add(-CreateMapfixRecencyWindow),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if CreateMapfixRateLimit < count {
|
|
||||||
return nil, ErrCreateMapfixRateLimit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
||||||
Owner: userId,
|
Owner: int64(userId),
|
||||||
StatusID: model.OperationStatusCreated,
|
StatusID: model.OperationStatusCreated,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -112,8 +86,8 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
|
|
||||||
create_request := model.CreateMapfixRequest{
|
create_request := model.CreateMapfixRequest{
|
||||||
OperationID: operation.ID,
|
OperationID: operation.ID,
|
||||||
ModelID: ModelID,
|
ModelID: request.AssetID,
|
||||||
TargetAssetID: TargetAssetID,
|
TargetAssetID: request.TargetAssetID,
|
||||||
}
|
}
|
||||||
|
|
||||||
j, err := json.Marshal(create_request)
|
j, err := json.Marshal(create_request)
|
||||||
@@ -121,10 +95,7 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.mapfixes.create", []byte(j))
|
svc.Nats.Publish("maptest.mapfixes.create", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &api.OperationID{
|
return &api.OperationID{
|
||||||
OperationID: operation.ID,
|
OperationID: operation.ID,
|
||||||
@@ -137,7 +108,7 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *api.MapfixTrigger
|
|||||||
//
|
//
|
||||||
// GET /mapfixes/{MapfixID}
|
// GET /mapfixes/{MapfixID}
|
||||||
func (svc *Service) GetMapfix(ctx context.Context, params api.GetMapfixParams) (*api.Mapfix, error) {
|
func (svc *Service) GetMapfix(ctx context.Context, params api.GetMapfixParams) (*api.Mapfix, error) {
|
||||||
mapfix, err := svc.DB.Mapfixes().Get(ctx, int64(params.MapfixID))
|
mapfix, err := svc.DB.Mapfixes().Get(ctx, params.MapfixID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -145,15 +116,15 @@ func (svc *Service) GetMapfix(ctx context.Context, params api.GetMapfixParams) (
|
|||||||
ID: mapfix.ID,
|
ID: mapfix.ID,
|
||||||
DisplayName: mapfix.DisplayName,
|
DisplayName: mapfix.DisplayName,
|
||||||
Creator: mapfix.Creator,
|
Creator: mapfix.Creator,
|
||||||
GameID: uint32(mapfix.GameID),
|
GameID: mapfix.GameID,
|
||||||
CreatedAt: mapfix.CreatedAt.Unix(),
|
CreatedAt: mapfix.CreatedAt.Unix(),
|
||||||
UpdatedAt: mapfix.UpdatedAt.Unix(),
|
UpdatedAt: mapfix.UpdatedAt.Unix(),
|
||||||
Submitter: mapfix.Submitter,
|
Submitter: int64(mapfix.Submitter),
|
||||||
AssetID: mapfix.AssetID,
|
AssetID: int64(mapfix.AssetID),
|
||||||
AssetVersion: mapfix.AssetVersion,
|
AssetVersion: int64(mapfix.AssetVersion),
|
||||||
Completed: mapfix.Completed,
|
Completed: mapfix.Completed,
|
||||||
TargetAssetID: mapfix.TargetAssetID,
|
TargetAssetID: int64(mapfix.TargetAssetID),
|
||||||
StatusID: uint32(mapfix.StatusID),
|
StatusID: int32(mapfix.StatusID),
|
||||||
StatusMessage: mapfix.StatusMessage,
|
StatusMessage: mapfix.StatusMessage,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -163,34 +134,22 @@ func (svc *Service) GetMapfix(ctx context.Context, params api.GetMapfixParams) (
|
|||||||
// Get list of mapfixes.
|
// Get list of mapfixes.
|
||||||
//
|
//
|
||||||
// GET /mapfixes
|
// GET /mapfixes
|
||||||
func (svc *Service) ListMapfixes(ctx context.Context, params api.ListMapfixesParams) (*api.Mapfixes, error) {
|
func (svc *Service) ListMapfixes(ctx context.Context, params api.ListMapfixesParams) ([]api.Mapfix, error) {
|
||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
|
|
||||||
if params.DisplayName.IsSet(){
|
if params.DisplayName.IsSet(){
|
||||||
filter.Add2("display_name", params.DisplayName.Value)
|
filter.Add("display_name", params.DisplayName.Value)
|
||||||
}
|
}
|
||||||
if params.Creator.IsSet(){
|
if params.Creator.IsSet(){
|
||||||
filter.Add2("creator", params.Creator.Value)
|
filter.Add("creator", params.Creator.Value)
|
||||||
}
|
}
|
||||||
if params.GameID.IsSet(){
|
if params.GameID.IsSet(){
|
||||||
filter.AddPostgresInt32("game_id", params.GameID.Value)
|
filter.Add("game_id", params.GameID.Value)
|
||||||
}
|
|
||||||
if params.Submitter.IsSet(){
|
|
||||||
filter.AddPostgresInt64("submitter", params.Submitter.Value)
|
|
||||||
}
|
|
||||||
if params.AssetID.IsSet(){
|
|
||||||
filter.AddPostgresInt64("asset_id", params.AssetID.Value)
|
|
||||||
}
|
|
||||||
if params.TargetAssetID.IsSet(){
|
|
||||||
filter.AddPostgresInt64("target_asset_id", params.TargetAssetID.Value)
|
|
||||||
}
|
|
||||||
if params.StatusID.IsSet(){
|
|
||||||
filter.AddPostgresInt32("status_id", params.StatusID.Value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sort := datastore.ListSort(params.Sort.Or(uint32(datastore.ListSortDisabled)))
|
sort := datastore.ListSort(params.Sort.Or(int32(datastore.ListSortDisabled)))
|
||||||
|
|
||||||
total, items, err := svc.DB.Mapfixes().ListWithTotal(ctx, filter, model.Page{
|
items, err := svc.DB.Mapfixes().List(ctx, filter, model.Page{
|
||||||
Number: params.Page,
|
Number: params.Page,
|
||||||
Size: params.Limit,
|
Size: params.Limit,
|
||||||
},sort)
|
},sort)
|
||||||
@@ -198,26 +157,25 @@ func (svc *Service) ListMapfixes(ctx context.Context, params api.ListMapfixesPar
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp api.Mapfixes
|
var resp []api.Mapfix
|
||||||
resp.Total=total
|
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
resp.Mapfixes = append(resp.Mapfixes, api.Mapfix{
|
resp = append(resp, api.Mapfix{
|
||||||
ID: item.ID,
|
ID: item.ID,
|
||||||
DisplayName: item.DisplayName,
|
DisplayName: item.DisplayName,
|
||||||
Creator: item.Creator,
|
Creator: item.Creator,
|
||||||
GameID: item.GameID,
|
GameID: item.GameID,
|
||||||
CreatedAt: item.CreatedAt.Unix(),
|
CreatedAt: item.CreatedAt.Unix(),
|
||||||
UpdatedAt: item.UpdatedAt.Unix(),
|
UpdatedAt: item.UpdatedAt.Unix(),
|
||||||
Submitter: item.Submitter,
|
Submitter: int64(item.Submitter),
|
||||||
AssetID: item.AssetID,
|
AssetID: int64(item.AssetID),
|
||||||
AssetVersion: item.AssetVersion,
|
AssetVersion: int64(item.AssetVersion),
|
||||||
Completed: item.Completed,
|
Completed: item.Completed,
|
||||||
TargetAssetID: item.TargetAssetID,
|
TargetAssetID: int64(item.TargetAssetID),
|
||||||
StatusID: uint32(item.StatusID),
|
StatusID: int32(item.StatusID),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return &resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PatchMapfixCompleted implements patchMapfixCompleted operation.
|
// PatchMapfixCompleted implements patchMapfixCompleted operation.
|
||||||
@@ -262,58 +220,22 @@ func (svc *Service) UpdateMapfixModel(ctx context.Context, params api.UpdateMapf
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(mapfix.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == mapfix.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
OldModelID := mapfix.AssetID
|
|
||||||
OldModelVersion := mapfix.AssetVersion
|
|
||||||
NewModelID := uint64(params.ModelID)
|
|
||||||
NewModelVersion := uint64(params.ModelVersion)
|
|
||||||
|
|
||||||
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
||||||
pmap := datastore.Optional()
|
pmap := datastore.Optional()
|
||||||
pmap.Add("asset_id", NewModelID)
|
pmap.AddNotNil("asset_id", params.ModelID)
|
||||||
pmap.Add("asset_version", NewModelVersion)
|
pmap.AddNotNil("asset_version", params.VersionID)
|
||||||
//always reset completed when model changes
|
//always reset completed when model changes
|
||||||
pmap.Add("completed", false)
|
pmap.Add("completed", false)
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusChangesRequested, model.MapfixStatusSubmitted, model.MapfixStatusUnderConstruction}, pmap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusChangesRequested, model.MapfixStatusSubmitted, model.MapfixStatusUnderConstruction}, pmap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataChangeModel{
|
|
||||||
OldModelID: OldModelID,
|
|
||||||
OldModelVersion: OldModelVersion,
|
|
||||||
NewModelID: NewModelID,
|
|
||||||
NewModelVersion: NewModelVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeChangeModel,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixReject invokes actionMapfixReject operation.
|
// ActionMapfixReject invokes actionMapfixReject operation.
|
||||||
@@ -333,45 +255,13 @@ func (svc *Service) ActionMapfixReject(ctx context.Context, params api.ActionMap
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusRejected
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusRejected)
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixRequestChanges invokes actionMapfixRequestChanges operation.
|
// ActionMapfixRequestChanges invokes actionMapfixRequestChanges operation.
|
||||||
@@ -391,13 +281,13 @@ func (svc *Service) ActionMapfixRequestChanges(ctx context.Context, params api.A
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", model.MapfixStatusChangesRequested)
|
smap.Add("status_id", model.MapfixStatusChangesRequested)
|
||||||
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidated, model.MapfixStatusAcceptedUnvalidated, model.MapfixStatusSubmitted}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidated, model.MapfixStatusAccepted, model.MapfixStatusSubmitted}, smap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixRevoke invokes actionMapfixRevoke operation.
|
// ActionMapfixRevoke invokes actionMapfixRevoke operation.
|
||||||
@@ -417,56 +307,27 @@ func (svc *Service) ActionMapfixRevoke(ctx context.Context, params api.ActionMap
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(mapfix.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == mapfix.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusUnderConstruction
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusUnderConstruction)
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted, model.MapfixStatusChangesRequested}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted, model.MapfixStatusChangesRequested}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixTriggerSubmit invokes actionMapfixTriggerSubmit operation.
|
// ActionMapfixSubmit invokes actionMapfixSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/status/trigger-submit
|
// POST /mapfixes/{MapfixID}/status/submit
|
||||||
func (svc *Service) ActionMapfixTriggerSubmit(ctx context.Context, params api.ActionMapfixTriggerSubmitParams) error {
|
func (svc *Service) ActionMapfixSubmit(ctx context.Context, params api.ActionMapfixSubmitParams) error {
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ErrUserInfo
|
return ErrUserInfo
|
||||||
@@ -478,114 +339,19 @@ func (svc *Service) ActionMapfixTriggerSubmit(ctx context.Context, params api.Ac
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(mapfix.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == mapfix.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusSubmitted
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusSubmitted)
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUnderConstruction, model.MapfixStatusChangesRequested}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUnderConstruction, model.MapfixStatusChangesRequested}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionMapfixResetSubmitting implements actionMapfixResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role MapfixReview changes status from Submitting -> UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/reset-submitting
|
|
||||||
func (svc *Service) ActionMapfixResetSubmitting(ctx context.Context, params api.ActionMapfixResetSubmittingParams) error {
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
|
||||||
if !ok {
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// check when mapfix was updated
|
|
||||||
mapfix, err := svc.DB.Mapfixes().Get(ctx, params.MapfixID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if time.Now().Before(mapfix.UpdatedAt.Add(time.Second*10)) {
|
|
||||||
// the last time the mapfix was updated must be longer than 10 seconds ago
|
|
||||||
return ErrDelayReset
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if caller has required role
|
|
||||||
has_role := userId == mapfix.Submitter
|
|
||||||
if !has_role {
|
|
||||||
return ErrPermissionDeniedNotSubmitter
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction
|
|
||||||
target_status := model.MapfixStatusUnderConstruction
|
|
||||||
smap := datastore.Optional()
|
|
||||||
smap.Add("status_id", target_status)
|
|
||||||
smap.Add("status_message", "Manually forced reset")
|
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitting}, smap)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixTriggerUpload invokes actionMapfixTriggerUpload operation.
|
// ActionMapfixTriggerUpload invokes actionMapfixTriggerUpload operation.
|
||||||
@@ -605,18 +371,12 @@ func (svc *Service) ActionMapfixTriggerUpload(ctx context.Context, params api.Ac
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixUpload
|
return ErrPermissionDeniedNeedRoleMapUpload
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusUploading
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusUploading)
|
||||||
mapfix, err := svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidated}, smap)
|
mapfix, err := svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidated}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -635,31 +395,7 @@ func (svc *Service) ActionMapfixTriggerUpload(ctx context.Context, params api.Ac
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.mapfixes.upload", []byte(j))
|
svc.Nats.Publish("maptest.mapfixes.uploadfix", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -681,12 +417,7 @@ func (svc *Service) ActionMapfixValidated(ctx context.Context, params api.Action
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixUpload
|
return ErrPermissionDeniedNeedRoleMapUpload
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check when mapfix was updated
|
// check when mapfix was updated
|
||||||
@@ -700,36 +431,9 @@ func (svc *Service) ActionMapfixValidated(ctx context.Context, params api.Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusValidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusValidated)
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUploading}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUploading}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixTriggerValidate invokes actionMapfixTriggerValidate operation.
|
// ActionMapfixTriggerValidate invokes actionMapfixTriggerValidate operation.
|
||||||
@@ -749,7 +453,7 @@ func (svc *Service) ActionMapfixTriggerValidate(ctx context.Context, params api.
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
}
|
||||||
|
|
||||||
// read mapfix (this could be done with a transaction WHERE clause)
|
// read mapfix (this could be done with a transaction WHERE clause)
|
||||||
@@ -758,13 +462,11 @@ func (svc *Service) ActionMapfixTriggerValidate(ctx context.Context, params api.
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err = userInfo.IsSubmitter(uint64(mapfix.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is NOT the submitter
|
// check if caller is NOT the submitter
|
||||||
has_role = userId == mapfix.Submitter
|
|
||||||
if has_role {
|
if has_role {
|
||||||
return ErrAcceptOwnMapfix
|
return ErrAcceptOwnMapfix
|
||||||
}
|
}
|
||||||
@@ -787,9 +489,8 @@ func (svc *Service) ActionMapfixTriggerValidate(ctx context.Context, params api.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusValidating
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusValidating)
|
||||||
mapfix, err = svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted}, smap)
|
mapfix, err = svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitted}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -812,31 +513,7 @@ func (svc *Service) ActionMapfixTriggerValidate(ctx context.Context, params api.
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.mapfixes.validate", []byte(j))
|
svc.Nats.Publish("maptest.mapfixes.validate", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -858,19 +535,13 @@ func (svc *Service) ActionMapfixRetryValidate(ctx context.Context, params api.Ac
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusValidating
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusValidating)
|
||||||
mapfix, err := svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusAcceptedUnvalidated}, smap)
|
mapfix, err := svc.DB.Mapfixes().IfStatusThenUpdateAndGet(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusAccepted}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -892,31 +563,7 @@ func (svc *Service) ActionMapfixRetryValidate(ctx context.Context, params api.Ac
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.mapfixes.validate", []byte(j))
|
svc.Nats.Publish("maptest.mapfixes.validate", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -938,12 +585,7 @@ func (svc *Service) ActionMapfixAccepted(ctx context.Context, params api.ActionM
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleMapfixReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check when mapfix was updated
|
// check when mapfix was updated
|
||||||
@@ -957,35 +599,8 @@ func (svc *Service) ActionMapfixAccepted(ctx context.Context, params api.ActionM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusAcceptedUnvalidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusAccepted)
|
||||||
smap.Add("status_message", "Manually forced reset")
|
smap.Add("status_message", "Manually forced reset")
|
||||||
err = svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,11 @@ func (svc *Service) GetOperation(ctx context.Context, params api.GetOperationPar
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(operation.Owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// check if caller is operation owner
|
||||||
// check if caller is the submitter
|
|
||||||
has_role := userId == operation.Owner
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return nil, ErrPermissionDeniedNotSubmitter
|
return nil, ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
@@ -38,7 +36,7 @@ func (svc *Service) GetOperation(ctx context.Context, params api.GetOperationPar
|
|||||||
return &api.Operation{
|
return &api.Operation{
|
||||||
OperationID: operation.ID,
|
OperationID: operation.ID,
|
||||||
Date: operation.CreatedAt.Unix(),
|
Date: operation.CreatedAt.Unix(),
|
||||||
Owner: int64(operation.Owner),
|
Owner: operation.Owner,
|
||||||
Status: int32(operation.StatusID),
|
Status: int32(operation.StatusID),
|
||||||
StatusMessage: operation.StatusMessage,
|
StatusMessage: operation.StatusMessage,
|
||||||
Path: operation.Path,
|
Path: operation.Path,
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ func (svc *Service) ListScriptPolicy(ctx context.Context, params api.ListScriptP
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
filter.Add("from_script_hash", int64(hash)) // No type safety!
|
filter.AddNotNil("from_script_hash", int64(hash)) // No type safety!
|
||||||
}
|
}
|
||||||
if params.ToScriptID.IsSet(){
|
if params.ToScriptID.IsSet(){
|
||||||
filter.Add("to_script_id", params.ToScriptID.Value)
|
filter.AddNotNil("to_script_id", params.ToScriptID.Value)
|
||||||
}
|
}
|
||||||
if params.Policy.IsSet(){
|
if params.Policy.IsSet(){
|
||||||
filter.Add("policy", params.Policy.Value)
|
filter.AddNotNil("policy", params.Policy.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
||||||
@@ -121,6 +121,13 @@ func (svc *Service) DeleteScriptPolicy(ctx context.Context, params api.DeleteScr
|
|||||||
//
|
//
|
||||||
// GET /script-policy/{ScriptPolicyID}
|
// GET /script-policy/{ScriptPolicyID}
|
||||||
func (svc *Service) GetScriptPolicy(ctx context.Context, params api.GetScriptPolicyParams) (*api.ScriptPolicy, error) {
|
func (svc *Service) GetScriptPolicy(ctx context.Context, params api.GetScriptPolicyParams) (*api.ScriptPolicy, error) {
|
||||||
|
_, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
|
if !ok {
|
||||||
|
return nil, ErrUserInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read permission for script policy only requires you to be logged in
|
||||||
|
|
||||||
policy, err := svc.DB.ScriptPolicy().Get(ctx, params.ScriptPolicyID)
|
policy, err := svc.DB.ScriptPolicy().Get(ctx, params.ScriptPolicyID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -57,19 +57,19 @@ func (svc *Service) ListScripts(ctx context.Context, params api.ListScriptsParam
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
filter.Add("hash", int64(hash)) // No type safety!
|
filter.AddNotNil("hash", int64(hash)) // No type safety!
|
||||||
}
|
}
|
||||||
if params.Name.IsSet(){
|
if params.Name.IsSet(){
|
||||||
filter.Add("name", params.Name.Value)
|
filter.AddNotNil("name", params.Name.Value)
|
||||||
}
|
}
|
||||||
if params.Source.IsSet(){
|
if params.Source.IsSet(){
|
||||||
filter.Add("source", params.Source.Value)
|
filter.AddNotNil("source", params.Source.Value)
|
||||||
}
|
}
|
||||||
if params.ResourceType.IsSet(){
|
if params.ResourceType.IsSet(){
|
||||||
filter.Add("resource_type", params.ResourceType.Value)
|
filter.AddNotNil("resource_type", params.ResourceType.Value)
|
||||||
}
|
}
|
||||||
if params.ResourceID.IsSet(){
|
if params.ResourceID.IsSet(){
|
||||||
filter.Add("resource_id", params.ResourceID.Value)
|
filter.AddNotNil("resource_id", params.ResourceID.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.Scripts().List(ctx, filter, model.Page{
|
items, err := svc.DB.Scripts().List(ctx, filter, model.Page{
|
||||||
@@ -122,6 +122,13 @@ func (svc *Service) DeleteScript(ctx context.Context, params api.DeleteScriptPar
|
|||||||
//
|
//
|
||||||
// GET /scripts/{ScriptID}
|
// GET /scripts/{ScriptID}
|
||||||
func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) (*api.Script, error) {
|
func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) (*api.Script, error) {
|
||||||
|
_, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
|
if !ok {
|
||||||
|
return nil, ErrUserInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read permission for scripts only requires you to be logged in
|
||||||
|
|
||||||
script, err := svc.DB.Scripts().Get(ctx, params.ScriptID)
|
script, err := svc.DB.Scripts().Get(ctx, params.ScriptID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -88,6 +88,13 @@ func (usr UserInfoHandle) Validate() (bool, error) {
|
|||||||
}
|
}
|
||||||
return validate.Valid, nil
|
return validate.Valid, nil
|
||||||
}
|
}
|
||||||
|
func (usr UserInfoHandle) IsSubmitter(submitter uint64) (bool, error) {
|
||||||
|
userId, err := usr.GetUserID()
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return userId == submitter, nil
|
||||||
|
}
|
||||||
func (usr UserInfoHandle) hasRoles(wantRoles Roles) (bool, error) {
|
func (usr UserInfoHandle) hasRoles(wantRoles Roles) (bool, error) {
|
||||||
haveroles, err := usr.GetRoles()
|
haveroles, err := usr.GetRoles()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -19,14 +19,11 @@ var (
|
|||||||
ErrDelayReset = errors.New("Please give the validator at least 10 seconds to operate before attempting to reset the status")
|
ErrDelayReset = errors.New("Please give the validator at least 10 seconds to operate before attempting to reset the status")
|
||||||
ErrPermissionDeniedNotSubmitter = fmt.Errorf("%w: You must be the submitter to perform this action", ErrPermissionDenied)
|
ErrPermissionDeniedNotSubmitter = fmt.Errorf("%w: You must be the submitter to perform this action", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleSubmissionRelease = fmt.Errorf("%w: Need Role SubmissionRelease", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleSubmissionRelease = fmt.Errorf("%w: Need Role SubmissionRelease", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleMapfixUpload = fmt.Errorf("%w: Need Role MapfixUpload", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleMapUpload = fmt.Errorf("%w: Need Role MapUpload", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleMapfixReview = fmt.Errorf("%w: Need Role MapfixReview", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleMapReview = fmt.Errorf("%w: Need Role MapReview", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleSubmissionUpload = fmt.Errorf("%w: Need Role SubmissionUpload", ErrPermissionDenied)
|
|
||||||
ErrPermissionDeniedNeedRoleSubmissionReview = fmt.Errorf("%w: Need Role SubmissionReview", ErrPermissionDenied)
|
|
||||||
ErrPermissionDeniedNeedRoleMapDownload = fmt.Errorf("%w: Need Role MapDownload", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleMapDownload = fmt.Errorf("%w: Need Role MapDownload", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleScriptWrite = fmt.Errorf("%w: Need Role ScriptWrite", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleScriptWrite = fmt.Errorf("%w: Need Role ScriptWrite", ErrPermissionDenied)
|
||||||
ErrPermissionDeniedNeedRoleMaptest = fmt.Errorf("%w: Need Role Maptest", ErrPermissionDenied)
|
ErrPermissionDeniedNeedRoleMaptest = fmt.Errorf("%w: Need Role Maptest", ErrPermissionDenied)
|
||||||
ErrNegativeID = errors.New("A negative ID was provided")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
|
|||||||
@@ -25,11 +25,8 @@ var(
|
|||||||
model.SubmissionStatusUploading,
|
model.SubmissionStatusUploading,
|
||||||
model.SubmissionStatusValidated,
|
model.SubmissionStatusValidated,
|
||||||
model.SubmissionStatusValidating,
|
model.SubmissionStatusValidating,
|
||||||
model.SubmissionStatusAcceptedUnvalidated,
|
model.SubmissionStatusAccepted,
|
||||||
}
|
}
|
||||||
// Allow 5 submissions every 10 minutes
|
|
||||||
CreateSubmissionRateLimit int64 = 5
|
|
||||||
CreateSubmissionRecencyWindow = time.Second*600
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -38,17 +35,10 @@ var (
|
|||||||
ErrReleaseInvalidStatus = errors.New("Only submissions with Uploaded status can be released")
|
ErrReleaseInvalidStatus = errors.New("Only submissions with Uploaded status can be released")
|
||||||
ErrReleaseNoUploadedAssetID = errors.New("Only submissions with a UploadedAssetID can be released")
|
ErrReleaseNoUploadedAssetID = errors.New("Only submissions with a UploadedAssetID can be released")
|
||||||
ErrAcceptOwnSubmission = fmt.Errorf("%w: You cannot accept your own submission as the submitter", ErrPermissionDenied)
|
ErrAcceptOwnSubmission = fmt.Errorf("%w: You cannot accept your own submission as the submitter", ErrPermissionDenied)
|
||||||
ErrCreateSubmissionRateLimit = errors.New("You must not create more than 5 submissions every 10 minutes")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// POST /submissions
|
// POST /submissions
|
||||||
func (svc *Service) CreateSubmission(ctx context.Context, request *api.SubmissionTriggerCreate) (*api.OperationID, error) {
|
func (svc *Service) CreateSubmission(ctx context.Context, request *api.SubmissionTriggerCreate) (*api.OperationID, error) {
|
||||||
// sanitization
|
|
||||||
if request.AssetID<0{
|
|
||||||
return nil, ErrNegativeID
|
|
||||||
}
|
|
||||||
var ModelID=uint64(request.AssetID);
|
|
||||||
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, ErrUserInfo
|
return nil, ErrUserInfo
|
||||||
@@ -76,24 +66,8 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *api.Submissio
|
|||||||
return nil, ErrCreationPhaseSubmissionsLimit
|
return nil, ErrCreationPhaseSubmissionsLimit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if too many operations have been created recently
|
|
||||||
{
|
|
||||||
count, err := svc.DB.Operations().CountSince(ctx,
|
|
||||||
int64(userId),
|
|
||||||
time.Now().Add(-CreateSubmissionRecencyWindow),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if CreateSubmissionRateLimit < count {
|
|
||||||
return nil, ErrCreateSubmissionRateLimit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
operation, err := svc.DB.Operations().Create(ctx, model.Operation{
|
||||||
Owner: userId,
|
Owner: int64(userId),
|
||||||
StatusID: model.OperationStatusCreated,
|
StatusID: model.OperationStatusCreated,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -102,7 +76,7 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *api.Submissio
|
|||||||
|
|
||||||
create_request := model.CreateSubmissionRequest{
|
create_request := model.CreateSubmissionRequest{
|
||||||
OperationID: operation.ID,
|
OperationID: operation.ID,
|
||||||
ModelID: ModelID,
|
ModelID: request.AssetID,
|
||||||
}
|
}
|
||||||
|
|
||||||
j, err := json.Marshal(create_request)
|
j, err := json.Marshal(create_request)
|
||||||
@@ -110,10 +84,7 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *api.Submissio
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.submissions.create", []byte(j))
|
svc.Nats.Publish("maptest.submissions.create", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &api.OperationID{
|
return &api.OperationID{
|
||||||
OperationID: operation.ID,
|
OperationID: operation.ID,
|
||||||
@@ -134,7 +105,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP
|
|||||||
ID: submission.ID,
|
ID: submission.ID,
|
||||||
DisplayName: submission.DisplayName,
|
DisplayName: submission.DisplayName,
|
||||||
Creator: submission.Creator,
|
Creator: submission.Creator,
|
||||||
GameID: int32(submission.GameID),
|
GameID: submission.GameID,
|
||||||
CreatedAt: submission.CreatedAt.Unix(),
|
CreatedAt: submission.CreatedAt.Unix(),
|
||||||
UpdatedAt: submission.UpdatedAt.Unix(),
|
UpdatedAt: submission.UpdatedAt.Unix(),
|
||||||
Submitter: int64(submission.Submitter),
|
Submitter: int64(submission.Submitter),
|
||||||
@@ -152,7 +123,7 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP
|
|||||||
// Get list of submissions.
|
// Get list of submissions.
|
||||||
//
|
//
|
||||||
// GET /submissions
|
// GET /submissions
|
||||||
func (svc *Service) ListSubmissions(ctx context.Context, params api.ListSubmissionsParams) (*api.Submissions, error) {
|
func (svc *Service) ListSubmissions(ctx context.Context, params api.ListSubmissionsParams) ([]api.Submission, error) {
|
||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
|
|
||||||
if params.DisplayName.IsSet(){
|
if params.DisplayName.IsSet(){
|
||||||
@@ -164,22 +135,10 @@ func (svc *Service) ListSubmissions(ctx context.Context, params api.ListSubmissi
|
|||||||
if params.GameID.IsSet(){
|
if params.GameID.IsSet(){
|
||||||
filter.Add("game_id", params.GameID.Value)
|
filter.Add("game_id", params.GameID.Value)
|
||||||
}
|
}
|
||||||
if params.Submitter.IsSet(){
|
|
||||||
filter.Add("submitter", params.Submitter.Value)
|
|
||||||
}
|
|
||||||
if params.AssetID.IsSet(){
|
|
||||||
filter.Add("asset_id", params.AssetID.Value)
|
|
||||||
}
|
|
||||||
if params.UploadedAssetID.IsSet(){
|
|
||||||
filter.Add("uploaded_asset_id", params.UploadedAssetID.Value)
|
|
||||||
}
|
|
||||||
if params.StatusID.IsSet(){
|
|
||||||
filter.Add("status_id", params.StatusID.Value)
|
|
||||||
}
|
|
||||||
|
|
||||||
sort := datastore.ListSort(params.Sort.Or(int32(datastore.ListSortDisabled)))
|
sort := datastore.ListSort(params.Sort.Or(int32(datastore.ListSortDisabled)))
|
||||||
|
|
||||||
total, items, err := svc.DB.Submissions().ListWithTotal(ctx, filter, model.Page{
|
items, err := svc.DB.Submissions().List(ctx, filter, model.Page{
|
||||||
Number: params.Page,
|
Number: params.Page,
|
||||||
Size: params.Limit,
|
Size: params.Limit,
|
||||||
},sort)
|
},sort)
|
||||||
@@ -187,14 +146,13 @@ func (svc *Service) ListSubmissions(ctx context.Context, params api.ListSubmissi
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp api.Submissions
|
var resp []api.Submission
|
||||||
resp.Total=total
|
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
resp.Submissions = append(resp.Submissions, api.Submission{
|
resp = append(resp, api.Submission{
|
||||||
ID: item.ID,
|
ID: item.ID,
|
||||||
DisplayName: item.DisplayName,
|
DisplayName: item.DisplayName,
|
||||||
Creator: item.Creator,
|
Creator: item.Creator,
|
||||||
GameID: int32(item.GameID),
|
GameID: item.GameID,
|
||||||
CreatedAt: item.CreatedAt.Unix(),
|
CreatedAt: item.CreatedAt.Unix(),
|
||||||
UpdatedAt: item.UpdatedAt.Unix(),
|
UpdatedAt: item.UpdatedAt.Unix(),
|
||||||
Submitter: int64(item.Submitter),
|
Submitter: int64(item.Submitter),
|
||||||
@@ -206,7 +164,7 @@ func (svc *Service) ListSubmissions(ctx context.Context, params api.ListSubmissi
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return &resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PatchSubmissionCompleted implements patchSubmissionCompleted operation.
|
// PatchSubmissionCompleted implements patchSubmissionCompleted operation.
|
||||||
@@ -251,58 +209,22 @@ func (svc *Service) UpdateSubmissionModel(ctx context.Context, params api.Update
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(submission.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == submission.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
OldModelID := submission.AssetID
|
|
||||||
OldModelVersion := submission.AssetVersion
|
|
||||||
NewModelID := uint64(params.ModelID)
|
|
||||||
NewModelVersion := uint64(params.ModelVersion)
|
|
||||||
|
|
||||||
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
||||||
pmap := datastore.Optional()
|
pmap := datastore.Optional()
|
||||||
pmap.Add("asset_id", NewModelID)
|
pmap.AddNotNil("asset_id", params.ModelID)
|
||||||
pmap.Add("asset_version", NewModelVersion)
|
pmap.AddNotNil("asset_version", params.VersionID)
|
||||||
//always reset completed when model changes
|
//always reset completed when model changes
|
||||||
pmap.Add("completed", false)
|
pmap.Add("completed", false)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusChangesRequested, model.SubmissionStatusUnderConstruction}, pmap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusChangesRequested, model.SubmissionStatusSubmitted, model.SubmissionStatusUnderConstruction}, pmap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataChangeModel{
|
|
||||||
OldModelID: OldModelID,
|
|
||||||
OldModelVersion: OldModelVersion,
|
|
||||||
NewModelID: NewModelID,
|
|
||||||
NewModelVersion: NewModelVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: submission.ID,
|
|
||||||
EventType: model.AuditEventTypeChangeModel,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionReject invokes actionSubmissionReject operation.
|
// ActionSubmissionReject invokes actionSubmissionReject operation.
|
||||||
@@ -322,45 +244,13 @@ func (svc *Service) ActionSubmissionReject(ctx context.Context, params api.Actio
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusRejected
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusRejected)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionRequestChanges invokes actionSubmissionRequestChanges operation.
|
// ActionSubmissionRequestChanges invokes actionSubmissionRequestChanges operation.
|
||||||
@@ -380,45 +270,13 @@ func (svc *Service) ActionSubmissionRequestChanges(ctx context.Context, params a
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusChangesRequested
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusChangesRequested)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidated, model.SubmissionStatusAcceptedUnvalidated, model.SubmissionStatusSubmitted}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidated, model.SubmissionStatusAccepted, model.SubmissionStatusSubmitted}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionRevoke invokes actionSubmissionRevoke operation.
|
// ActionSubmissionRevoke invokes actionSubmissionRevoke operation.
|
||||||
@@ -438,56 +296,27 @@ func (svc *Service) ActionSubmissionRevoke(ctx context.Context, params api.Actio
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(submission.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == submission.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusUnderConstruction
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusUnderConstruction)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted, model.SubmissionStatusChangesRequested}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted, model.SubmissionStatusChangesRequested}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionTriggerSubmit invokes actionSubmissionTriggerSubmit operation.
|
// ActionSubmissionSubmit invokes actionSubmissionSubmit operation.
|
||||||
//
|
//
|
||||||
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitting.
|
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
|
||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/status/trigger-submit
|
// POST /submissions/{SubmissionID}/status/submit
|
||||||
func (svc *Service) ActionSubmissionTriggerSubmit(ctx context.Context, params api.ActionSubmissionTriggerSubmitParams) error {
|
func (svc *Service) ActionSubmissionSubmit(ctx context.Context, params api.ActionSubmissionSubmitParams) error {
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ErrUserInfo
|
return ErrUserInfo
|
||||||
@@ -499,114 +328,19 @@ func (svc *Service) ActionSubmissionTriggerSubmit(ctx context.Context, params ap
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err := userInfo.IsSubmitter(uint64(submission.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is the submitter
|
// check if caller is the submitter
|
||||||
has_role := userId == submission.Submitter
|
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNotSubmitter
|
return ErrPermissionDeniedNotSubmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusSubmitted
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusSubmitted)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUnderConstruction, model.SubmissionStatusChangesRequested}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUnderConstruction, model.SubmissionStatusChangesRequested}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionSubmissionResetSubmitting implements actionSubmissionResetSubmitting operation.
|
|
||||||
//
|
|
||||||
// Role SubmissionReview changes status from Submitting -> UnderConstruction.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/reset-submitting
|
|
||||||
func (svc *Service) ActionSubmissionResetSubmitting(ctx context.Context, params api.ActionSubmissionResetSubmittingParams) error {
|
|
||||||
userInfo, ok := ctx.Value("UserInfo").(UserInfoHandle)
|
|
||||||
if !ok {
|
|
||||||
return ErrUserInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// check when submission was updated
|
|
||||||
submission, err := svc.DB.Submissions().Get(ctx, params.SubmissionID)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if time.Now().Before(submission.UpdatedAt.Add(time.Second*10)) {
|
|
||||||
// the last time the submission was updated must be longer than 10 seconds ago
|
|
||||||
return ErrDelayReset
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if caller has required role
|
|
||||||
has_role := userId == submission.Submitter
|
|
||||||
if !has_role {
|
|
||||||
return ErrPermissionDeniedNotSubmitter
|
|
||||||
}
|
|
||||||
|
|
||||||
// transaction
|
|
||||||
target_status := model.SubmissionStatusUnderConstruction
|
|
||||||
smap := datastore.Optional()
|
|
||||||
smap.Add("status_id", target_status)
|
|
||||||
smap.Add("status_message", "Manually forced reset")
|
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitting}, smap)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionTriggerUpload invokes actionSubmissionTriggerUpload operation.
|
// ActionSubmissionTriggerUpload invokes actionSubmissionTriggerUpload operation.
|
||||||
@@ -626,18 +360,12 @@ func (svc *Service) ActionSubmissionTriggerUpload(ctx context.Context, params ap
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionUpload
|
return ErrPermissionDeniedNeedRoleMapUpload
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusUploading
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusUploading)
|
||||||
submission, err := svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidated}, smap)
|
submission, err := svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidated}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -659,36 +387,12 @@ func (svc *Service) ActionSubmissionTriggerUpload(ctx context.Context, params ap
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.submissions.upload", []byte(j))
|
svc.Nats.Publish("maptest.submissions.upload", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// refuse to operate
|
// refuse to operate
|
||||||
return ErrUploadedAssetIDAlreadyExists
|
return ErrUploadedAssetIDAlreadyExists
|
||||||
}
|
}
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,12 +413,7 @@ func (svc *Service) ActionSubmissionValidated(ctx context.Context, params api.Ac
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionUpload
|
return ErrPermissionDeniedNeedRoleMapUpload
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check when submission was updated
|
// check when submission was updated
|
||||||
@@ -728,36 +427,9 @@ func (svc *Service) ActionSubmissionValidated(ctx context.Context, params api.Ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusValidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusValidated)
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUploading}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUploading}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionTriggerValidate invokes actionSubmissionTriggerValidate operation.
|
// ActionSubmissionTriggerValidate invokes actionSubmissionTriggerValidate operation.
|
||||||
@@ -777,7 +449,7 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
}
|
||||||
|
|
||||||
// read submission (this could be done with a transaction WHERE clause)
|
// read submission (this could be done with a transaction WHERE clause)
|
||||||
@@ -786,21 +458,18 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
has_role, err = userInfo.IsSubmitter(uint64(submission.Submitter))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if caller is NOT the submitter
|
// check if caller is NOT the submitter
|
||||||
has_role = userId == submission.Submitter
|
|
||||||
if has_role {
|
if has_role {
|
||||||
return ErrAcceptOwnSubmission
|
return ErrAcceptOwnSubmission
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusValidating
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusValidating)
|
||||||
submission, err = svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted}, smap)
|
submission, err = svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitted}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -823,31 +492,7 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.submissions.validate", []byte(j))
|
svc.Nats.Publish("maptest.submissions.validate", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -869,19 +514,13 @@ func (svc *Service) ActionSubmissionRetryValidate(ctx context.Context, params ap
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusValidating
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusValidating)
|
||||||
submission, err := svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusAcceptedUnvalidated}, smap)
|
submission, err := svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusAccepted}, smap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -903,31 +542,7 @@ func (svc *Service) ActionSubmissionRetryValidate(ctx context.Context, params ap
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = svc.Nats.Publish("maptest.submissions.validate", []byte(j))
|
svc.Nats.Publish("maptest.submissions.validate", []byte(j))
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -949,12 +564,7 @@ func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params api.Act
|
|||||||
}
|
}
|
||||||
// check if caller has required role
|
// check if caller has required role
|
||||||
if !has_role {
|
if !has_role {
|
||||||
return ErrPermissionDeniedNeedRoleSubmissionReview
|
return ErrPermissionDeniedNeedRoleMapReview
|
||||||
}
|
|
||||||
|
|
||||||
userId, err := userInfo.GetUserID()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check when submission was updated
|
// check when submission was updated
|
||||||
@@ -968,37 +578,10 @@ func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params api.Act
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusAcceptedUnvalidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusAccepted)
|
||||||
smap.Add("status_message", "Manually forced reset")
|
smap.Add("status_message", "Manually forced reset")
|
||||||
err = svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: userId,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseSubmissions invokes releaseSubmissions operation.
|
// ReleaseSubmissions invokes releaseSubmissions operation.
|
||||||
@@ -1044,13 +627,12 @@ func (svc *Service) ReleaseSubmissions(ctx context.Context, request []api.Releas
|
|||||||
|
|
||||||
for i,submission := range submissions{
|
for i,submission := range submissions{
|
||||||
date := request[i].Date.Unix()
|
date := request[i].Date.Unix()
|
||||||
var GameID = int32(submission.GameID)
|
|
||||||
// create each map with go-grpc
|
// create each map with go-grpc
|
||||||
_, err := svc.Client.Create(ctx, &maps.MapRequest{
|
_, err := svc.Client.Create(ctx, &maps.MapRequest{
|
||||||
ID: int64(submission.UploadedAssetID),
|
ID: submission.UploadedAssetID,
|
||||||
DisplayName: &submission.DisplayName,
|
DisplayName: &submission.DisplayName,
|
||||||
Creator: &submission.Creator,
|
Creator: &submission.Creator,
|
||||||
GameID: &GameID,
|
GameID: &submission.GameID,
|
||||||
Date: &date,
|
Date: &date,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package service_internal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ var(
|
|||||||
model.MapfixStatusUploading,
|
model.MapfixStatusUploading,
|
||||||
model.MapfixStatusValidated,
|
model.MapfixStatusValidated,
|
||||||
model.MapfixStatusValidating,
|
model.MapfixStatusValidating,
|
||||||
model.MapfixStatusAcceptedUnvalidated,
|
model.MapfixStatusAccepted,
|
||||||
model.MapfixStatusChangesRequested,
|
model.MapfixStatusChangesRequested,
|
||||||
model.MapfixStatusSubmitted,
|
model.MapfixStatusSubmitted,
|
||||||
model.MapfixStatusUnderConstruction,
|
model.MapfixStatusUnderConstruction,
|
||||||
@@ -35,82 +34,13 @@ var(
|
|||||||
//
|
//
|
||||||
// POST /mapfixes/{MapfixID}/validated-model
|
// POST /mapfixes/{MapfixID}/validated-model
|
||||||
func (svc *Service) UpdateMapfixValidatedModel(ctx context.Context, params internal.UpdateMapfixValidatedModelParams) error {
|
func (svc *Service) UpdateMapfixValidatedModel(ctx context.Context, params internal.UpdateMapfixValidatedModelParams) error {
|
||||||
ValidatedModelID := uint64(params.ValidatedModelID)
|
|
||||||
ValidatedModelVersion := uint64(params.ValidatedModelVersion)
|
|
||||||
|
|
||||||
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
||||||
pmap := datastore.Optional()
|
pmap := datastore.Optional()
|
||||||
pmap.Add("validated_asset_id", ValidatedModelID)
|
pmap.AddNotNil("validated_asset_id", params.ValidatedModelID)
|
||||||
pmap.Add("validated_asset_version", ValidatedModelVersion)
|
pmap.AddNotNil("validated_asset_version", params.ValidatedModelVersion)
|
||||||
// DO NOT reset completed when validated model is updated
|
// DO NOT reset completed when validated model is updated
|
||||||
// pmap.Add("completed", false)
|
// pmap.Add("completed", false)
|
||||||
err := svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, pmap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, pmap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataChangeValidatedModel{
|
|
||||||
ValidatedModelID: ValidatedModelID,
|
|
||||||
ValidatedModelVersion: ValidatedModelVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeChangeValidatedModel,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionMapfixValidate invokes actionMapfixValidate operation.
|
|
||||||
//
|
|
||||||
// Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /mapfixes/{MapfixID}/status/validator-submitted
|
|
||||||
func (svc *Service) ActionMapfixSubmitted(ctx context.Context, params internal.ActionMapfixSubmittedParams) error {
|
|
||||||
// transaction
|
|
||||||
target_status := model.MapfixStatusSubmitted
|
|
||||||
smap := datastore.Optional()
|
|
||||||
smap.Add("status_id", target_status)
|
|
||||||
err := svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusSubmitting}, smap)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixValidate invokes actionMapfixValidate operation.
|
// ActionMapfixValidate invokes actionMapfixValidate operation.
|
||||||
@@ -132,37 +62,10 @@ func (svc *Service) ActionMapfixValidated(ctx context.Context, params internal.A
|
|||||||
// POST /mapfixes/{MapfixID}/status/validator-failed
|
// POST /mapfixes/{MapfixID}/status/validator-failed
|
||||||
func (svc *Service) ActionMapfixAccepted(ctx context.Context, params internal.ActionMapfixAcceptedParams) error {
|
func (svc *Service) ActionMapfixAccepted(ctx context.Context, params internal.ActionMapfixAcceptedParams) error {
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusAcceptedUnvalidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusAccepted)
|
||||||
smap.Add("status_message", params.StatusMessage)
|
smap.Add("status_message", params.StatusMessage)
|
||||||
err := svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusValidating}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
// ActionMapfixUploaded implements actionMapfixUploaded operation.
|
||||||
@@ -172,54 +75,13 @@ func (svc *Service) ActionMapfixAccepted(ctx context.Context, params internal.Ac
|
|||||||
// POST /mapfixes/{MapfixID}/status/validator-uploaded
|
// POST /mapfixes/{MapfixID}/status/validator-uploaded
|
||||||
func (svc *Service) ActionMapfixUploaded(ctx context.Context, params internal.ActionMapfixUploadedParams) error {
|
func (svc *Service) ActionMapfixUploaded(ctx context.Context, params internal.ActionMapfixUploadedParams) error {
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.MapfixStatusUploaded
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.MapfixStatusUploaded)
|
||||||
err := svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUploading}, smap)
|
return svc.DB.Mapfixes().IfStatusThenUpdate(ctx, params.MapfixID, []model.MapfixStatus{model.MapfixStatusUploading}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceMapfix,
|
|
||||||
ResourceID: params.MapfixID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST /mapfixes
|
// POST /mapfixes
|
||||||
func (svc *Service) CreateMapfix(ctx context.Context, request *internal.MapfixCreate) (*internal.MapfixID, error) {
|
func (svc *Service) CreateMapfix(ctx context.Context, request *internal.MapfixCreate) (*internal.MapfixID, error) {
|
||||||
// sanitization
|
|
||||||
if request.GameID<0||
|
|
||||||
request.AssetOwner<0||
|
|
||||||
request.AssetID<0||
|
|
||||||
request.AssetVersion<0||
|
|
||||||
request.TargetAssetID<0{
|
|
||||||
return nil, ErrNegativeID
|
|
||||||
}
|
|
||||||
var GameID=uint32(request.GameID);
|
|
||||||
var Submitter=uint64(request.AssetOwner);
|
|
||||||
var AssetID=uint64(request.AssetID);
|
|
||||||
var AssetVersion=uint64(request.AssetVersion);
|
|
||||||
var TargetAssetID=uint64(request.TargetAssetID);
|
|
||||||
|
|
||||||
// Check if an active mapfix with the same asset id exists
|
// Check if an active mapfix with the same asset id exists
|
||||||
{
|
{
|
||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
@@ -245,7 +107,7 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *internal.MapfixCr
|
|||||||
|
|
||||||
// check if user owns asset
|
// check if user owns asset
|
||||||
// TODO: allow bypass by admin
|
// TODO: allow bypass by admin
|
||||||
if operation.Owner != Submitter {
|
if operation.Owner != request.AssetOwner {
|
||||||
return nil, ErrNotAssetOwner
|
return nil, ErrNotAssetOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,12 +115,12 @@ func (svc *Service) CreateMapfix(ctx context.Context, request *internal.MapfixCr
|
|||||||
ID: 0,
|
ID: 0,
|
||||||
DisplayName: request.DisplayName,
|
DisplayName: request.DisplayName,
|
||||||
Creator: request.Creator,
|
Creator: request.Creator,
|
||||||
GameID: GameID,
|
GameID: request.GameID,
|
||||||
Submitter: Submitter,
|
Submitter: request.AssetOwner,
|
||||||
AssetID: AssetID,
|
AssetID: request.AssetID,
|
||||||
AssetVersion: AssetVersion,
|
AssetVersion: request.AssetVersion,
|
||||||
Completed: false,
|
Completed: false,
|
||||||
TargetAssetID: TargetAssetID,
|
TargetAssetID: request.TargetAssetID,
|
||||||
StatusID: model.MapfixStatusUnderConstruction,
|
StatusID: model.MapfixStatusUnderConstruction,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
api "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
"git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,13 +49,13 @@ func (svc *Service) ListScriptPolicy(ctx context.Context, params api.ListScriptP
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
filter.Add("from_script_hash", int64(hash)) // No type safety!
|
filter.AddNotNil("from_script_hash", int64(hash)) // No type safety!
|
||||||
}
|
}
|
||||||
if params.ToScriptID.IsSet(){
|
if params.ToScriptID.IsSet(){
|
||||||
filter.Add("to_script_id", params.ToScriptID.Value)
|
filter.AddNotNil("to_script_id", params.ToScriptID.Value)
|
||||||
}
|
}
|
||||||
if params.Policy.IsSet(){
|
if params.Policy.IsSet(){
|
||||||
filter.Add("policy", params.Policy.Value)
|
filter.AddNotNil("policy", params.Policy.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
api "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
"git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
"git.itzana.me/strafesnet/maps-service/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,19 +44,19 @@ func (svc *Service) ListScripts(ctx context.Context, params api.ListScriptsParam
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
filter.Add("hash", int64(hash)) // No type safety!
|
filter.AddNotNil("hash", int64(hash)) // No type safety!
|
||||||
}
|
}
|
||||||
if params.Name.IsSet(){
|
if params.Name.IsSet(){
|
||||||
filter.Add("name", params.Name.Value)
|
filter.AddNotNil("name", params.Name.Value)
|
||||||
}
|
}
|
||||||
if params.Source.IsSet(){
|
if params.Source.IsSet(){
|
||||||
filter.Add("source", params.Source.Value)
|
filter.AddNotNil("source", params.Source.Value)
|
||||||
}
|
}
|
||||||
if params.ResourceType.IsSet(){
|
if params.ResourceType.IsSet(){
|
||||||
filter.Add("resource_type", params.ResourceType.Value)
|
filter.AddNotNil("resource_type", params.ResourceType.Value)
|
||||||
}
|
}
|
||||||
if params.ResourceID.IsSet(){
|
if params.ResourceID.IsSet(){
|
||||||
filter.Add("resource_id", params.ResourceID.Value)
|
filter.AddNotNil("resource_id", params.ResourceID.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.Scripts().List(ctx, filter, model.Page{
|
items, err := svc.DB.Scripts().List(ctx, filter, model.Page{
|
||||||
|
|||||||
@@ -3,21 +3,12 @@ package service_internal
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"math"
|
|
||||||
|
|
||||||
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||||||
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
ValidtorUserID uint64 = uint64(math.MaxInt64)
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrNegativeID = errors.New("A negative ID was provided")
|
|
||||||
)
|
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
DB datastore.Datastore
|
DB datastore.Datastore
|
||||||
Nats nats.JetStreamContext
|
Nats nats.JetStreamContext
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package service_internal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ var(
|
|||||||
model.SubmissionStatusUploading,
|
model.SubmissionStatusUploading,
|
||||||
model.SubmissionStatusValidated,
|
model.SubmissionStatusValidated,
|
||||||
model.SubmissionStatusValidating,
|
model.SubmissionStatusValidating,
|
||||||
model.SubmissionStatusAcceptedUnvalidated,
|
model.SubmissionStatusAccepted,
|
||||||
model.SubmissionStatusChangesRequested,
|
model.SubmissionStatusChangesRequested,
|
||||||
model.SubmissionStatusSubmitted,
|
model.SubmissionStatusSubmitted,
|
||||||
model.SubmissionStatusUnderConstruction,
|
model.SubmissionStatusUnderConstruction,
|
||||||
@@ -34,82 +33,13 @@ var(
|
|||||||
//
|
//
|
||||||
// POST /submissions/{SubmissionID}/validated-model
|
// POST /submissions/{SubmissionID}/validated-model
|
||||||
func (svc *Service) UpdateSubmissionValidatedModel(ctx context.Context, params internal.UpdateSubmissionValidatedModelParams) error {
|
func (svc *Service) UpdateSubmissionValidatedModel(ctx context.Context, params internal.UpdateSubmissionValidatedModelParams) error {
|
||||||
ValidatedModelID := uint64(params.ValidatedModelID)
|
|
||||||
ValidatedModelVersion := uint64(params.ValidatedModelVersion)
|
|
||||||
|
|
||||||
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
// check if Status is ChangesRequested|Submitted|UnderConstruction
|
||||||
pmap := datastore.Optional()
|
pmap := datastore.Optional()
|
||||||
pmap.Add("validated_asset_id", ValidatedModelID)
|
pmap.AddNotNil("validated_asset_id", params.ValidatedModelID)
|
||||||
pmap.Add("validated_asset_version", ValidatedModelVersion)
|
pmap.AddNotNil("validated_asset_version", params.ValidatedModelVersion)
|
||||||
// DO NOT reset completed when validated model is updated
|
// DO NOT reset completed when validated model is updated
|
||||||
// pmap.Add("completed", false)
|
// pmap.Add("completed", false)
|
||||||
err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, pmap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, pmap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataChangeValidatedModel{
|
|
||||||
ValidatedModelID: ValidatedModelID,
|
|
||||||
ValidatedModelVersion: ValidatedModelVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeChangeValidatedModel,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
|
||||||
//
|
|
||||||
// Role Validator changes status from Submitting -> Submitted.
|
|
||||||
//
|
|
||||||
// POST /submissions/{SubmissionID}/status/validator-submitted
|
|
||||||
func (svc *Service) ActionSubmissionSubmitted(ctx context.Context, params internal.ActionSubmissionSubmittedParams) error {
|
|
||||||
// transaction
|
|
||||||
target_status := model.SubmissionStatusSubmitted
|
|
||||||
smap := datastore.Optional()
|
|
||||||
smap.Add("status_id", target_status)
|
|
||||||
err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusSubmitting}, smap)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
||||||
@@ -119,36 +49,9 @@ func (svc *Service) ActionSubmissionSubmitted(ctx context.Context, params intern
|
|||||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||||
func (svc *Service) ActionSubmissionValidated(ctx context.Context, params internal.ActionSubmissionValidatedParams) error {
|
func (svc *Service) ActionSubmissionValidated(ctx context.Context, params internal.ActionSubmissionValidatedParams) error {
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusValidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusValidated)
|
||||||
err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionAccepted implements actionSubmissionAccepted operation.
|
// ActionSubmissionAccepted implements actionSubmissionAccepted operation.
|
||||||
@@ -158,37 +61,10 @@ func (svc *Service) ActionSubmissionValidated(ctx context.Context, params intern
|
|||||||
// POST /submissions/{SubmissionID}/status/validator-failed
|
// POST /submissions/{SubmissionID}/status/validator-failed
|
||||||
func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params internal.ActionSubmissionAcceptedParams) error {
|
func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params internal.ActionSubmissionAcceptedParams) error {
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusAcceptedUnvalidated
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusAccepted)
|
||||||
smap.Add("status_message", params.StatusMessage)
|
smap.Add("status_message", params.StatusMessage)
|
||||||
err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusValidating}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
// ActionSubmissionUploaded implements actionSubmissionUploaded operation.
|
||||||
@@ -198,53 +74,14 @@ func (svc *Service) ActionSubmissionAccepted(ctx context.Context, params interna
|
|||||||
// POST /submissions/{SubmissionID}/status/validator-uploaded
|
// POST /submissions/{SubmissionID}/status/validator-uploaded
|
||||||
func (svc *Service) ActionSubmissionUploaded(ctx context.Context, params internal.ActionSubmissionUploadedParams) error {
|
func (svc *Service) ActionSubmissionUploaded(ctx context.Context, params internal.ActionSubmissionUploadedParams) error {
|
||||||
// transaction
|
// transaction
|
||||||
target_status := model.SubmissionStatusUploaded
|
|
||||||
smap := datastore.Optional()
|
smap := datastore.Optional()
|
||||||
smap.Add("status_id", target_status)
|
smap.Add("status_id", model.SubmissionStatusUploaded)
|
||||||
smap.Add("uploaded_asset_id", params.UploadedAssetID)
|
smap.Add("uploaded_asset_id", params.UploadedAssetID)
|
||||||
err := svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUploading}, smap)
|
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.SubmissionStatus{model.SubmissionStatusUploading}, smap)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
event_data := model.AuditEventDataAction{
|
|
||||||
TargetStatus: uint32(target_status),
|
|
||||||
}
|
|
||||||
|
|
||||||
EventData, err := json.Marshal(event_data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = svc.DB.AuditEvents().Create(ctx, model.AuditEvent{
|
|
||||||
ID: 0,
|
|
||||||
User: ValidtorUserID,
|
|
||||||
ResourceType: model.ResourceSubmission,
|
|
||||||
ResourceID: params.SubmissionID,
|
|
||||||
EventType: model.AuditEventTypeAction,
|
|
||||||
EventData: EventData,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST /submissions
|
// POST /submissions
|
||||||
func (svc *Service) CreateSubmission(ctx context.Context, request *internal.SubmissionCreate) (*internal.SubmissionID, error) {
|
func (svc *Service) CreateSubmission(ctx context.Context, request *internal.SubmissionCreate) (*internal.SubmissionID, error) {
|
||||||
// sanitization
|
|
||||||
if request.GameID<0||
|
|
||||||
request.AssetOwner<0||
|
|
||||||
request.AssetID<0||
|
|
||||||
request.AssetVersion<0{
|
|
||||||
return nil, ErrNegativeID
|
|
||||||
}
|
|
||||||
var GameID=uint32(request.GameID);
|
|
||||||
var Submitter=uint64(request.AssetOwner);
|
|
||||||
var AssetID=uint64(request.AssetID);
|
|
||||||
var AssetVersion=uint64(request.AssetVersion);
|
|
||||||
|
|
||||||
// Check if an active submission with the same asset id exists
|
// Check if an active submission with the same asset id exists
|
||||||
{
|
{
|
||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
@@ -270,7 +107,7 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *internal.Subm
|
|||||||
|
|
||||||
// check if user owns asset
|
// check if user owns asset
|
||||||
// TODO: allow bypass by admin
|
// TODO: allow bypass by admin
|
||||||
if operation.Owner != Submitter {
|
if operation.Owner != request.AssetOwner {
|
||||||
return nil, ErrNotAssetOwner
|
return nil, ErrNotAssetOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,10 +115,10 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *internal.Subm
|
|||||||
ID: 0,
|
ID: 0,
|
||||||
DisplayName: request.DisplayName,
|
DisplayName: request.DisplayName,
|
||||||
Creator: request.Creator,
|
Creator: request.Creator,
|
||||||
GameID: GameID,
|
GameID: request.GameID,
|
||||||
Submitter: Submitter,
|
Submitter: request.AssetOwner,
|
||||||
AssetID: AssetID,
|
AssetID: request.AssetID,
|
||||||
AssetVersion: AssetVersion,
|
AssetVersion: request.AssetVersion,
|
||||||
Completed: false,
|
Completed: false,
|
||||||
StatusID: model.SubmissionStatusUnderConstruction,
|
StatusID: model.SubmissionStatusUnderConstruction,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ edition = "2021"
|
|||||||
submissions-api = { path = "api", features = ["internal"], default-features = false, registry = "strafesnet" }
|
submissions-api = { path = "api", features = ["internal"], default-features = false, registry = "strafesnet" }
|
||||||
async-nats = "0.40.0"
|
async-nats = "0.40.0"
|
||||||
futures = "0.3.31"
|
futures = "0.3.31"
|
||||||
rbx_asset = { version = "0.4.3", registry = "strafesnet" }
|
rbx_asset = { version = "0.3.3", registry = "strafesnet" }
|
||||||
rbx_binary = { version = "0.7.4", registry = "strafesnet"}
|
rbx_binary = { version = "0.7.4", registry = "strafesnet"}
|
||||||
rbx_dom_weak = { version = "2.9.0", registry = "strafesnet"}
|
rbx_dom_weak = { version = "2.9.0", registry = "strafesnet"}
|
||||||
rbx_reflection_database = { version = "0.2.12", registry = "strafesnet"}
|
rbx_reflection_database = { version = "0.2.12", registry = "strafesnet"}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Using the `rust-musl-builder` as base image, instead of
|
# Using the `rust-musl-builder` as base image, instead of
|
||||||
# the official Rust toolchain
|
# the official Rust toolchain
|
||||||
FROM registry.itzana.me/docker-proxy/clux/muslrust:1.86.0-stable AS chef
|
FROM docker.io/clux/muslrust:stable AS chef
|
||||||
USER root
|
USER root
|
||||||
RUN cargo install cargo-chef
|
RUN cargo install cargo-chef
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -17,7 +17,7 @@ RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path r
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo build --release --target x86_64-unknown-linux-musl --bin maps-validation
|
RUN cargo build --release --target x86_64-unknown-linux-musl --bin maps-validation
|
||||||
|
|
||||||
FROM registry.itzana.me/docker-proxy/alpine:3.21 AS runtime
|
FROM docker.io/alpine:latest AS runtime
|
||||||
RUN addgroup -S myuser && adduser -S myuser -G myuser
|
RUN addgroup -S myuser && adduser -S myuser -G myuser
|
||||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/maps-validation /usr/local/bin/
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/maps-validation /usr/local/bin/
|
||||||
USER myuser
|
USER myuser
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "submissions-api"
|
name = "submissions-api"
|
||||||
version = "0.7.0"
|
version = "0.6.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = ["strafesnet"]
|
publish = ["strafesnet"]
|
||||||
repository = "https://git.itzana.me/StrafesNET/maps-service"
|
repository = "https://git.itzana.me/StrafesNET/maps-service"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ macro_rules! query_pairs{
|
|||||||
macro_rules! action{
|
macro_rules! action{
|
||||||
($system:expr,$fname:ident,$config:ident,$config_type:ident,$action:expr,$config_submission_id:expr,$(($param:expr,$value:expr))*)=>{
|
($system:expr,$fname:ident,$config:ident,$config_type:ident,$action:expr,$config_submission_id:expr,$(($param:expr,$value:expr))*)=>{
|
||||||
pub async fn $fname(&self,$config:$config_type)->Result<(),Error>{
|
pub async fn $fname(&self,$config:$config_type)->Result<(),Error>{
|
||||||
let url_raw=format!(concat!("{}/",$system,"/{}/",$action),self.0.base_url,$config_submission_id);
|
let url_raw=format!(concat!("{}/",$system,"/{}/status/",$action),self.0.base_url,$config_submission_id);
|
||||||
let url=query_pairs!(reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?,$(($param,$value))*);
|
let url=query_pairs!(reqwest::Url::parse(url_raw.as_str()).map_err(Error::Parse)?,$(($param,$value))*);
|
||||||
|
|
||||||
response_ok(
|
response_ok(
|
||||||
@@ -162,15 +162,15 @@ impl Context{
|
|||||||
.json().await.map_err(Error::ReqwestJson)
|
.json().await.map_err(Error::ReqwestJson)
|
||||||
}
|
}
|
||||||
// simple submission endpoints
|
// simple submission endpoints
|
||||||
action!("submissions",action_submission_validated,config,SubmissionID,"status/validator-validated",config.0,);
|
action!("submissions",action_submission_validated,config,SubmissionID,"validator-validated",config.0,);
|
||||||
action!("submissions",update_submission_validated_model,config,UpdateSubmissionModelRequest,"validated-model",config.SubmissionID,
|
action!("submissions",update_submission_validated_model,config,UpdateSubmissionModelRequest,"validated-model",config.SubmissionID,
|
||||||
("ValidatedModelID",config.ModelID.to_string().as_str())
|
("ValidatedModelID",config.ModelID.to_string().as_str())
|
||||||
("ValidatedModelVersion",config.ModelVersion.to_string().as_str())
|
("ValidatedModelVersion",config.ModelVersion.to_string().as_str())
|
||||||
);
|
);
|
||||||
action!("submissions",action_submission_uploaded,config,ActionSubmissionUploadedRequest,"status/validator-uploaded",config.SubmissionID,
|
action!("submissions",action_submission_uploaded,config,ActionSubmissionUploadedRequest,"validator-uploaded",config.SubmissionID,
|
||||||
("UploadedAssetID",config.UploadedAssetID.to_string().as_str())
|
("UploadedAssetID",config.UploadedAssetID.to_string().as_str())
|
||||||
);
|
);
|
||||||
action!("submissions",action_submission_accepted,config,ActionSubmissionAcceptedRequest,"status/validator-failed",config.SubmissionID,
|
action!("submissions",action_submission_accepted,config,ActionSubmissionAcceptedRequest,"validator-failed",config.SubmissionID,
|
||||||
("StatusMessage",config.StatusMessage.as_str())
|
("StatusMessage",config.StatusMessage.as_str())
|
||||||
);
|
);
|
||||||
pub async fn create_mapfix<'a>(&self,config:CreateMapfixRequest<'a>)->Result<MapfixIDResponse,Error>{
|
pub async fn create_mapfix<'a>(&self,config:CreateMapfixRequest<'a>)->Result<MapfixIDResponse,Error>{
|
||||||
@@ -185,17 +185,17 @@ impl Context{
|
|||||||
.json().await.map_err(Error::ReqwestJson)
|
.json().await.map_err(Error::ReqwestJson)
|
||||||
}
|
}
|
||||||
// simple mapfixes endpoints
|
// simple mapfixes endpoints
|
||||||
action!("mapfixes",action_mapfix_validated,config,MapfixID,"status/validator-validated",config.0,);
|
action!("mapfixes",action_mapfix_validated,config,MapfixID,"validator-validated",config.0,);
|
||||||
action!("mapfixes",update_mapfix_validated_model,config,UpdateMapfixModelRequest,"validated-model",config.MapfixID,
|
action!("mapfixes",update_mapfix_validated_model,config,UpdateMapfixModelRequest,"validated-model",config.MapfixID,
|
||||||
("ValidatedModelID",config.ModelID.to_string().as_str())
|
("ValidatedModelID",config.ModelID.to_string().as_str())
|
||||||
("ValidatedModelVersion",config.ModelVersion.to_string().as_str())
|
("ValidatedModelVersion",config.ModelVersion.to_string().as_str())
|
||||||
);
|
);
|
||||||
action!("mapfixes",action_mapfix_uploaded,config,ActionMapfixUploadedRequest,"status/validator-uploaded",config.MapfixID,);
|
action!("mapfixes",action_mapfix_uploaded,config,ActionMapfixUploadedRequest,"validator-uploaded",config.MapfixID,);
|
||||||
action!("mapfixes",action_mapfix_accepted,config,ActionMapfixAcceptedRequest,"status/validator-failed",config.MapfixID,
|
action!("mapfixes",action_mapfix_accepted,config,ActionMapfixAcceptedRequest,"validator-failed",config.MapfixID,
|
||||||
("StatusMessage",config.StatusMessage.as_str())
|
("StatusMessage",config.StatusMessage.as_str())
|
||||||
);
|
);
|
||||||
// simple operation endpoint
|
// simple operation endpoint
|
||||||
action!("operations",action_operation_failed,config,ActionOperationFailedRequest,"status/operation-failed",config.OperationID,
|
action!("operations",action_operation_failed,config,ActionOperationFailedRequest,"operation-failed",config.OperationID,
|
||||||
("StatusMessage",config.StatusMessage.as_str())
|
("StatusMessage",config.StatusMessage.as_str())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ use crate::rbx_util::{get_mapinfo,read_dom,MapInfo,ReadDomError,GetMapInfoError,
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum Error{
|
||||||
CreatorTypeMustBeUser,
|
ModelVersionsPage(rbx_asset::cookie::PageError),
|
||||||
ModelInfoDownload(rbx_asset::cloud::GetError),
|
EmptyVersionsPage,
|
||||||
ModelLocationDownload(rbx_asset::cloud::GetError),
|
CreatorTypeMustBeUser(rbx_asset::cookie::CreatorType),
|
||||||
NonFreeModel,
|
ModelDetails(rbx_asset::cookie::GetError),
|
||||||
ModelFileDownload(rbx_asset::cloud::GetError),
|
ModelInfoDownload(rbx_asset::cookie::GetAssetV2Error),
|
||||||
ParseUserID(core::num::ParseIntError),
|
ModelFileDownload(rbx_asset::cookie::GetError),
|
||||||
ParseModelVersion(core::num::ParseIntError),
|
NoLocations,
|
||||||
ModelFileDecode(ReadDomError),
|
ModelFileDecode(ReadDomError),
|
||||||
GetMapInfo(GetMapInfoError),
|
GetMapInfo(GetMapInfoError),
|
||||||
ParseGameID(ParseGameIDError),
|
ParseGameID(ParseGameIDError),
|
||||||
@@ -35,36 +35,34 @@ pub struct CreateResult{
|
|||||||
}
|
}
|
||||||
impl crate::message_handler::MessageHandler{
|
impl crate::message_handler::MessageHandler{
|
||||||
pub async fn create_inner(&self,create_info:CreateRequest)->Result<CreateResult,Error>{
|
pub async fn create_inner(&self,create_info:CreateRequest)->Result<CreateResult,Error>{
|
||||||
// discover asset creator and latest version
|
// discover asset creator
|
||||||
let info=self.cloud_context.get_asset_info(
|
let creator_fut=async{
|
||||||
rbx_asset::cloud::GetAssetLatestRequest{asset_id:create_info.ModelID}
|
self.cookie_context.get_asset_details(
|
||||||
).await.map_err(Error::ModelInfoDownload)?;
|
rbx_asset::cookie::GetAssetDetailsRequest{asset_id:create_info.ModelID}
|
||||||
|
).await.map_err(Error::ModelDetails)
|
||||||
// reject models created by a group
|
|
||||||
let rbx_asset::cloud::Creator::userId(user_id_string)=info.creationContext.creator else{
|
|
||||||
return Err(Error::CreatorTypeMustBeUser);
|
|
||||||
};
|
|
||||||
|
|
||||||
// parse user string and model version string
|
|
||||||
let user_id:u64=user_id_string.parse().map_err(Error::ParseUserID)?;
|
|
||||||
let asset_version=info.revisionId.parse().map_err(Error::ParseModelVersion)?;
|
|
||||||
|
|
||||||
// download the location of the map model
|
|
||||||
let location=self.cloud_context.get_asset_version_location(rbx_asset::cloud::GetAssetVersionRequest{
|
|
||||||
asset_id:create_info.ModelID,
|
|
||||||
version:asset_version,
|
|
||||||
}).await.map_err(Error::ModelLocationDownload)?;
|
|
||||||
|
|
||||||
// if the location does not exist, you are not allowed to donwload it
|
|
||||||
let Some(location)=location.location else{
|
|
||||||
return Err(Error::NonFreeModel);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// download the map model
|
// download the map model
|
||||||
let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::ModelFileDownload)?;
|
let asset_fut=async{
|
||||||
|
let asset_info=self.cookie_context.get_asset_v2(rbx_asset::cookie::GetAssetRequest{
|
||||||
|
asset_id:create_info.ModelID,
|
||||||
|
version:None,
|
||||||
|
}).await.map_err(Error::ModelInfoDownload)?;
|
||||||
|
|
||||||
|
let location=asset_info.info.locations.first().ok_or(Error::NoLocations)?;
|
||||||
|
let data=self.cookie_context.get_asset_v2_download(location).await.map_err(Error::ModelFileDownload)?;
|
||||||
|
|
||||||
|
Ok((asset_info.version,data))
|
||||||
|
};
|
||||||
|
|
||||||
|
let (details,(asset_version,model_data))=tokio::try_join!(creator_fut,asset_fut)?;
|
||||||
|
|
||||||
|
if details.Creator.CreatorType!=rbx_asset::cookie::CreatorType::User{
|
||||||
|
return Err(Error::CreatorTypeMustBeUser(details.Creator.CreatorType));
|
||||||
|
}
|
||||||
|
|
||||||
// decode dom (slow!)
|
// decode dom (slow!)
|
||||||
let dom=read_dom(std::io::Cursor::new(model_data)).map_err(Error::ModelFileDecode)?;
|
let dom=read_dom(&mut std::io::Cursor::new(model_data)).map_err(Error::ModelFileDecode)?;
|
||||||
|
|
||||||
// parse create fields out of asset
|
// parse create fields out of asset
|
||||||
let MapInfo{
|
let MapInfo{
|
||||||
@@ -76,7 +74,7 @@ impl crate::message_handler::MessageHandler{
|
|||||||
let game_id=game_id.map_err(Error::ParseGameID)?;
|
let game_id=game_id.map_err(Error::ParseGameID)?;
|
||||||
|
|
||||||
Ok(CreateResult{
|
Ok(CreateResult{
|
||||||
AssetOwner:user_id as i64,
|
AssetOwner:details.Creator.Id as i64,
|
||||||
DisplayName:display_name.unwrap_or_default().to_owned(),
|
DisplayName:display_name.unwrap_or_default().to_owned(),
|
||||||
Creator:creator.unwrap_or_default().to_owned(),
|
Creator:creator.unwrap_or_default().to_owned(),
|
||||||
GameID:game_id as i32,
|
GameID:game_id as i32,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ pub enum StartupError{
|
|||||||
NatsConnect(async_nats::ConnectError),
|
NatsConnect(async_nats::ConnectError),
|
||||||
NatsGetStream(async_nats::jetstream::context::GetStreamError),
|
NatsGetStream(async_nats::jetstream::context::GetStreamError),
|
||||||
NatsConsumer(async_nats::jetstream::stream::ConsumerError),
|
NatsConsumer(async_nats::jetstream::stream::ConsumerError),
|
||||||
NatsConsumerUpdate(async_nats::jetstream::stream::ConsumerUpdateError),
|
|
||||||
NatsStream(async_nats::jetstream::consumer::StreamError),
|
NatsStream(async_nats::jetstream::consumer::StreamError),
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for StartupError{
|
impl std::fmt::Display for StartupError{
|
||||||
@@ -42,12 +41,9 @@ async fn main()->Result<(),StartupError>{
|
|||||||
Err(e)=>Err(e).expect("ROBLOX_GROUP_ID env required"),
|
Err(e)=>Err(e).expect("ROBLOX_GROUP_ID env required"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// create / upload models through STRAFESNET_CI2 account
|
// talk to roblox through STRAFESNET_CI2 account
|
||||||
let cookie=std::env::var("RBXCOOKIE").expect("RBXCOOKIE env required");
|
let cookie=std::env::var("RBXCOOKIE").expect("RBXCOOKIE env required");
|
||||||
let cookie_context=rbx_asset::cookie::Context::new(rbx_asset::cookie::Cookie::new(cookie));
|
let cookie_context=rbx_asset::cookie::CookieContext::new(rbx_asset::cookie::Cookie::new(cookie));
|
||||||
// download models through cloud api
|
|
||||||
let api_key=std::env::var("RBX_API_KEY").expect("RBX_API_KEY env required");
|
|
||||||
let cloud_context=rbx_asset::cloud::Context::new(rbx_asset::cloud::ApiKey::new(api_key));
|
|
||||||
|
|
||||||
// maps-service api
|
// maps-service api
|
||||||
let api_host_internal=std::env::var("API_HOST_INTERNAL").expect("API_HOST_INTERNAL env required");
|
let api_host_internal=std::env::var("API_HOST_INTERNAL").expect("API_HOST_INTERNAL env required");
|
||||||
@@ -56,35 +52,20 @@ async fn main()->Result<(),StartupError>{
|
|||||||
// nats
|
// nats
|
||||||
let nats_host=std::env::var("NATS_HOST").expect("NATS_HOST env required");
|
let nats_host=std::env::var("NATS_HOST").expect("NATS_HOST env required");
|
||||||
let nats_fut=async{
|
let nats_fut=async{
|
||||||
const STREAM_NAME:&str="maptest";
|
|
||||||
const DURABLE_NAME:&str="validation";
|
|
||||||
const FILTER_SUBJECT:&str="maptest.>";
|
|
||||||
|
|
||||||
let nats_config=async_nats::jetstream::consumer::pull::Config{
|
|
||||||
name:Some(DURABLE_NAME.to_owned()),
|
|
||||||
durable_name:Some(DURABLE_NAME.to_owned()),
|
|
||||||
filter_subject:FILTER_SUBJECT.to_owned(),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let nasty=async_nats::connect(nats_host).await.map_err(StartupError::NatsConnect)?;
|
let nasty=async_nats::connect(nats_host).await.map_err(StartupError::NatsConnect)?;
|
||||||
|
|
||||||
// use nats jetstream
|
// use nats jetstream
|
||||||
let stream=async_nats::jetstream::new(nasty)
|
async_nats::jetstream::new(nasty)
|
||||||
.get_stream(STREAM_NAME).await.map_err(StartupError::NatsGetStream)?;
|
.get_stream("maptest").await.map_err(StartupError::NatsGetStream)?
|
||||||
|
.get_or_create_consumer("validation",async_nats::jetstream::consumer::pull::Config{
|
||||||
let consumer=stream.get_or_create_consumer(DURABLE_NAME,nats_config.clone()).await.map_err(StartupError::NatsConsumer)?;
|
name:Some("validation".to_owned()),
|
||||||
|
durable_name:Some("validation".to_owned()),
|
||||||
// check if config matches expected config
|
filter_subject:"maptest.>".to_owned(),
|
||||||
if consumer.cached_info().config.filter_subject!=FILTER_SUBJECT{
|
..Default::default()
|
||||||
stream.update_consumer(nats_config).await.map_err(StartupError::NatsConsumerUpdate)?;
|
}).await.map_err(StartupError::NatsConsumer)?
|
||||||
}
|
.messages().await.map_err(StartupError::NatsStream)
|
||||||
|
|
||||||
// only need messages
|
|
||||||
consumer.messages().await.map_err(StartupError::NatsStream)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let message_handler=message_handler::MessageHandler::new(cloud_context,cookie_context,group_id,api);
|
let message_handler=message_handler::MessageHandler::new(cookie_context,group_id,api);
|
||||||
|
|
||||||
// Create a signal listener for SIGTERM
|
// Create a signal listener for SIGTERM
|
||||||
let mut sig_term=tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()).expect("Failed to create SIGTERM signal listener");
|
let mut sig_term=tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()).expect("Failed to create SIGTERM signal listener");
|
||||||
|
|||||||
@@ -26,21 +26,18 @@ fn from_slice<'a,T:serde::de::Deserialize<'a>>(slice:&'a [u8])->Result<T,HandleM
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct MessageHandler{
|
pub struct MessageHandler{
|
||||||
pub(crate) cloud_context:rbx_asset::cloud::Context,
|
pub(crate) cookie_context:rbx_asset::cookie::CookieContext,
|
||||||
pub(crate) cookie_context:rbx_asset::cookie::Context,
|
|
||||||
pub(crate) group_id:Option<u64>,
|
pub(crate) group_id:Option<u64>,
|
||||||
pub(crate) api:submissions_api::internal::Context,
|
pub(crate) api:submissions_api::internal::Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MessageHandler{
|
impl MessageHandler{
|
||||||
pub fn new(
|
pub fn new(
|
||||||
cloud_context:rbx_asset::cloud::Context,
|
cookie_context:rbx_asset::cookie::CookieContext,
|
||||||
cookie_context:rbx_asset::cookie::Context,
|
|
||||||
group_id:Option<u64>,
|
group_id:Option<u64>,
|
||||||
api:submissions_api::internal::Context,
|
api:submissions_api::internal::Context,
|
||||||
)->Self{
|
)->Self{
|
||||||
Self{
|
Self{
|
||||||
cloud_context,
|
|
||||||
cookie_context,
|
cookie_context,
|
||||||
group_id,
|
group_id,
|
||||||
api,
|
api,
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ impl std::fmt::Display for ReadDomError{
|
|||||||
}
|
}
|
||||||
impl std::error::Error for ReadDomError{}
|
impl std::error::Error for ReadDomError{}
|
||||||
|
|
||||||
pub fn read_dom<R:std::io::Read+std::io::Seek>(mut input:R)->Result<rbx_dom_weak::WeakDom,ReadDomError>{
|
pub fn read_dom<R:std::io::Read+std::io::Seek>(input:&mut R)->Result<rbx_dom_weak::WeakDom,ReadDomError>{
|
||||||
let mut first_8=[0u8;8];
|
let mut first_8=[0u8;8];
|
||||||
std::io::Read::read_exact(&mut input,&mut first_8).map_err(ReadDomError::Read)?;
|
std::io::Read::read_exact(input,&mut first_8).map_err(ReadDomError::Read)?;
|
||||||
std::io::Seek::rewind(&mut input).map_err(ReadDomError::Seek)?;
|
std::io::Seek::rewind(input).map_err(ReadDomError::Seek)?;
|
||||||
match &first_8[0..4]{
|
match &first_8[0..4]{
|
||||||
b"<rob"=>{
|
b"<rob"=>{
|
||||||
match &first_8[4..8]{
|
match &first_8[4..8]{
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ use crate::nats_types::UploadMapfixRequest;
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum Error{
|
||||||
GetLocation(rbx_asset::cloud::GetError),
|
Get(rbx_asset::cookie::GetError),
|
||||||
NonFreeModel,
|
|
||||||
Get(rbx_asset::cloud::GetError),
|
|
||||||
Json(serde_json::Error),
|
Json(serde_json::Error),
|
||||||
Upload(rbx_asset::cookie::UploadError),
|
Upload(rbx_asset::cookie::UploadError),
|
||||||
ApiActionMapfixUploaded(submissions_api::Error),
|
ApiActionMapfixUploaded(submissions_api::Error),
|
||||||
@@ -19,19 +17,11 @@ impl std::error::Error for Error{}
|
|||||||
|
|
||||||
impl crate::message_handler::MessageHandler{
|
impl crate::message_handler::MessageHandler{
|
||||||
pub async fn upload_mapfix(&self,upload_info:UploadMapfixRequest)->Result<(),Error>{
|
pub async fn upload_mapfix(&self,upload_info:UploadMapfixRequest)->Result<(),Error>{
|
||||||
// download the location of the map model
|
// download the map model version
|
||||||
let location=self.cloud_context.get_asset_version_location(rbx_asset::cloud::GetAssetVersionRequest{
|
let model_data=self.cookie_context.get_asset(rbx_asset::cookie::GetAssetRequest{
|
||||||
asset_id:upload_info.ModelID,
|
asset_id:upload_info.ModelID,
|
||||||
version:upload_info.ModelVersion,
|
version:Some(upload_info.ModelVersion),
|
||||||
}).await.map_err(Error::GetLocation)?;
|
}).await.map_err(Error::Get)?;
|
||||||
|
|
||||||
// if the location does not exist, you are not allowed to donwload it
|
|
||||||
let Some(location)=location.location else{
|
|
||||||
return Err(Error::NonFreeModel);
|
|
||||||
};
|
|
||||||
|
|
||||||
// download the map model
|
|
||||||
let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::Get)?;
|
|
||||||
|
|
||||||
// upload the map to the strafesnet group
|
// upload the map to the strafesnet group
|
||||||
let _upload_response=self.cookie_context.upload(rbx_asset::cookie::UploadRequest{
|
let _upload_response=self.cookie_context.upload(rbx_asset::cookie::UploadRequest{
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ use crate::nats_types::UploadSubmissionRequest;
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum Error{
|
||||||
GetLocation(rbx_asset::cloud::GetError),
|
Get(rbx_asset::cookie::GetError),
|
||||||
NonFreeModel,
|
|
||||||
Get(rbx_asset::cloud::GetError),
|
|
||||||
Json(serde_json::Error),
|
Json(serde_json::Error),
|
||||||
Create(rbx_asset::cookie::CreateError),
|
Create(rbx_asset::cookie::CreateError),
|
||||||
SystemTime(std::time::SystemTimeError),
|
SystemTime(std::time::SystemTimeError),
|
||||||
@@ -20,19 +18,11 @@ impl std::error::Error for Error{}
|
|||||||
|
|
||||||
impl crate::message_handler::MessageHandler{
|
impl crate::message_handler::MessageHandler{
|
||||||
pub async fn upload_submission(&self,upload_info:UploadSubmissionRequest)->Result<(),Error>{
|
pub async fn upload_submission(&self,upload_info:UploadSubmissionRequest)->Result<(),Error>{
|
||||||
// download the location of the map model
|
// download the map model version
|
||||||
let location=self.cloud_context.get_asset_version_location(rbx_asset::cloud::GetAssetVersionRequest{
|
let model_data=self.cookie_context.get_asset(rbx_asset::cookie::GetAssetRequest{
|
||||||
asset_id:upload_info.ModelID,
|
asset_id:upload_info.ModelID,
|
||||||
version:upload_info.ModelVersion,
|
version:Some(upload_info.ModelVersion),
|
||||||
}).await.map_err(Error::GetLocation)?;
|
}).await.map_err(Error::Get)?;
|
||||||
|
|
||||||
// if the location does not exist, you are not allowed to donwload it
|
|
||||||
let Some(location)=location.location else{
|
|
||||||
return Err(Error::NonFreeModel);
|
|
||||||
};
|
|
||||||
|
|
||||||
// download the map model
|
|
||||||
let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::Get)?;
|
|
||||||
|
|
||||||
// upload the map to the strafesnet group
|
// upload the map to the strafesnet group
|
||||||
let upload_response=self.cookie_context.create(rbx_asset::cookie::CreateRequest{
|
let upload_response=self.cookie_context.create(rbx_asset::cookie::CreateRequest{
|
||||||
|
|||||||
@@ -32,13 +32,11 @@ fn hash_source(source:&str)->String{
|
|||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum ValidateError{
|
||||||
ScriptFlaggedIllegalKeyword(String),
|
ScriptFlaggedIllegalKeyword(String),
|
||||||
ScriptBlocked(Option<submissions_api::types::ScriptID>),
|
ScriptBlocked(Option<submissions_api::types::ScriptID>),
|
||||||
ScriptNotYetReviewed(Option<submissions_api::types::ScriptID>),
|
ScriptNotYetReviewed(Option<submissions_api::types::ScriptID>),
|
||||||
ModelLocationDownload(rbx_asset::cloud::GetError),
|
ModelFileDownload(rbx_asset::cookie::GetError),
|
||||||
NonFreeModel,
|
|
||||||
ModelFileDownload(rbx_asset::cloud::GetError),
|
|
||||||
ModelFileDecode(ReadDomError),
|
ModelFileDecode(ReadDomError),
|
||||||
ApiGetScriptPolicyFromHash(submissions_api::types::SingleItemError),
|
ApiGetScriptPolicyFromHash(submissions_api::types::SingleItemError),
|
||||||
ApiGetScript(submissions_api::Error),
|
ApiGetScript(submissions_api::Error),
|
||||||
@@ -53,12 +51,12 @@ pub enum Error{
|
|||||||
AssetUpload(rbx_asset::cookie::UploadError),
|
AssetUpload(rbx_asset::cookie::UploadError),
|
||||||
AssetCreate(rbx_asset::cookie::CreateError),
|
AssetCreate(rbx_asset::cookie::CreateError),
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for Error{
|
impl std::fmt::Display for ValidateError{
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||||
write!(f,"{self:?}")
|
write!(f,"{self:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::error::Error for Error{}
|
impl std::error::Error for ValidateError{}
|
||||||
|
|
||||||
#[allow(nonstandard_style)]
|
#[allow(nonstandard_style)]
|
||||||
pub struct ValidateRequest{
|
pub struct ValidateRequest{
|
||||||
@@ -90,23 +88,15 @@ impl From<crate::nats_types::ValidateSubmissionRequest> for ValidateRequest{
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl crate::message_handler::MessageHandler{
|
impl crate::message_handler::MessageHandler{
|
||||||
pub async fn validate_inner(&self,validate_info:ValidateRequest)->Result<(),Error>{
|
pub async fn validate_inner(&self,validate_info:ValidateRequest)->Result<(),ValidateError>{
|
||||||
// download the location of the map model
|
// download map
|
||||||
let location=self.cloud_context.get_asset_version_location(rbx_asset::cloud::GetAssetVersionRequest{
|
let data=self.cookie_context.get_asset(rbx_asset::cookie::GetAssetRequest{
|
||||||
asset_id:validate_info.ModelID,
|
asset_id:validate_info.ModelID,
|
||||||
version:validate_info.ModelVersion,
|
version:Some(validate_info.ModelVersion),
|
||||||
}).await.map_err(Error::ModelLocationDownload)?;
|
}).await.map_err(ValidateError::ModelFileDownload)?;
|
||||||
|
|
||||||
// if the location does not exist, you are not allowed to donwload it
|
|
||||||
let Some(location)=location.location else{
|
|
||||||
return Err(Error::NonFreeModel);
|
|
||||||
};
|
|
||||||
|
|
||||||
// download the map model
|
|
||||||
let model_data=self.cloud_context.get_asset(&location).await.map_err(Error::ModelFileDownload)?;
|
|
||||||
|
|
||||||
// decode dom (slow!)
|
// decode dom (slow!)
|
||||||
let mut dom=read_dom(std::io::Cursor::new(model_data)).map_err(Error::ModelFileDecode)?;
|
let mut dom=read_dom(&mut std::io::Cursor::new(data)).map_err(ValidateError::ModelFileDecode)?;
|
||||||
|
|
||||||
/* VALIDATE MAP */
|
/* VALIDATE MAP */
|
||||||
|
|
||||||
@@ -121,7 +111,7 @@ impl crate::message_handler::MessageHandler{
|
|||||||
// immediately abort
|
// immediately abort
|
||||||
// grab path to offending script
|
// grab path to offending script
|
||||||
let path=get_partial_path(&dom,script);
|
let path=get_partial_path(&dom,script);
|
||||||
return Err(Error::ScriptFlaggedIllegalKeyword(path));
|
return Err(ValidateError::ScriptFlaggedIllegalKeyword(path));
|
||||||
}
|
}
|
||||||
// associate a name and policy with the source code
|
// associate a name and policy with the source code
|
||||||
// policy will be fetched from the database to replace the default policy
|
// policy will be fetched from the database to replace the default policy
|
||||||
@@ -142,7 +132,7 @@ impl crate::message_handler::MessageHandler{
|
|||||||
// fetch the script policy
|
// fetch the script policy
|
||||||
let script_policy=self.api.get_script_policy_from_hash(submissions_api::types::HashRequest{
|
let script_policy=self.api.get_script_policy_from_hash(submissions_api::types::HashRequest{
|
||||||
hash:hash.as_str(),
|
hash:hash.as_str(),
|
||||||
}).await.map_err(Error::ApiGetScriptPolicyFromHash)?;
|
}).await.map_err(ValidateError::ApiGetScriptPolicyFromHash)?;
|
||||||
|
|
||||||
// write the policy to the script_map, fetching the replacement code if necessary
|
// write the policy to the script_map, fetching the replacement code if necessary
|
||||||
if let Some(script_policy)=script_policy{
|
if let Some(script_policy)=script_policy{
|
||||||
@@ -154,7 +144,7 @@ impl crate::message_handler::MessageHandler{
|
|||||||
submissions_api::types::Policy::Replace=>{
|
submissions_api::types::Policy::Replace=>{
|
||||||
let script=self.api.get_script(submissions_api::types::GetScriptRequest{
|
let script=self.api.get_script(submissions_api::types::GetScriptRequest{
|
||||||
ScriptID:script_policy.ToScriptID,
|
ScriptID:script_policy.ToScriptID,
|
||||||
}).await.map_err(Error::ApiGetScript)?;
|
}).await.map_err(ValidateError::ApiGetScript)?;
|
||||||
Policy::Replace(script.Source)
|
Policy::Replace(script.Source)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -170,14 +160,14 @@ impl crate::message_handler::MessageHandler{
|
|||||||
Source:source.as_str(),
|
Source:source.as_str(),
|
||||||
ResourceType:resource_type,
|
ResourceType:resource_type,
|
||||||
ResourceID:Some(resource_id),
|
ResourceID:Some(resource_id),
|
||||||
}).await.map_err(Error::ApiCreateScript)?;
|
}).await.map_err(ValidateError::ApiCreateScript)?;
|
||||||
|
|
||||||
// create a None policy (pending review by yours truly)
|
// create a None policy (pending review by yours truly)
|
||||||
self.api.create_script_policy(submissions_api::types::CreateScriptPolicyRequest{
|
self.api.create_script_policy(submissions_api::types::CreateScriptPolicyRequest{
|
||||||
ToScriptID:script.ScriptID,
|
ToScriptID:script.ScriptID,
|
||||||
FromScriptID:script.ScriptID,
|
FromScriptID:script.ScriptID,
|
||||||
Policy:submissions_api::types::Policy::None,
|
Policy:submissions_api::types::Policy::None,
|
||||||
}).await.map_err(Error::ApiCreateScriptPolicy)?;
|
}).await.map_err(ValidateError::ApiCreateScriptPolicy)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -185,7 +175,7 @@ impl crate::message_handler::MessageHandler{
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// make the replacements
|
// make the replacements
|
||||||
let mut modified=false;
|
let mut modified=true;
|
||||||
for &script_ref in &script_refs{
|
for &script_ref in &script_refs{
|
||||||
if let Some(script)=dom.get_by_ref_mut(script_ref){
|
if let Some(script)=dom.get_by_ref_mut(script_ref){
|
||||||
if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get_mut("Source"){
|
if let Some(rbx_dom_weak::types::Variant::String(source))=script.properties.get_mut("Source"){
|
||||||
@@ -194,8 +184,8 @@ impl crate::message_handler::MessageHandler{
|
|||||||
let hash=hash_source(source.as_str());
|
let hash=hash_source(source.as_str());
|
||||||
let script=self.api.get_script_from_hash(submissions_api::types::HashRequest{
|
let script=self.api.get_script_from_hash(submissions_api::types::HashRequest{
|
||||||
hash:hash.as_str(),
|
hash:hash.as_str(),
|
||||||
}).await.map_err(Error::ApiGetScriptFromHash)?;
|
}).await.map_err(ValidateError::ApiGetScriptFromHash)?;
|
||||||
return Err(Error::ScriptBlocked(script.map(|s|s.ID)));
|
return Err(ValidateError::ScriptBlocked(script.map(|s|s.ID)));
|
||||||
},
|
},
|
||||||
None
|
None
|
||||||
|Some(Policy::None)
|
|Some(Policy::None)
|
||||||
@@ -203,8 +193,8 @@ impl crate::message_handler::MessageHandler{
|
|||||||
let hash=hash_source(source.as_str());
|
let hash=hash_source(source.as_str());
|
||||||
let script=self.api.get_script_from_hash(submissions_api::types::HashRequest{
|
let script=self.api.get_script_from_hash(submissions_api::types::HashRequest{
|
||||||
hash:hash.as_str(),
|
hash:hash.as_str(),
|
||||||
}).await.map_err(Error::ApiGetScriptFromHash)?;
|
}).await.map_err(ValidateError::ApiGetScriptFromHash)?;
|
||||||
return Err(Error::ScriptNotYetReviewed(script.map(|s|s.ID)));
|
return Err(ValidateError::ScriptNotYetReviewed(script.map(|s|s.ID)));
|
||||||
},
|
},
|
||||||
Some(Policy::Allowed)=>(),
|
Some(Policy::Allowed)=>(),
|
||||||
Some(Policy::Delete)=>{
|
Some(Policy::Delete)=>{
|
||||||
@@ -221,17 +211,19 @@ impl crate::message_handler::MessageHandler{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("[Validator] Forcing model upload! modified=true");
|
||||||
|
|
||||||
// if the model was validated, the submission must be changed to use the modified model
|
// if the model was validated, the submission must be changed to use the modified model
|
||||||
let (validated_model_id,validated_model_version)=if modified{
|
if modified{
|
||||||
// serialize model (slow!)
|
// serialize model (slow!)
|
||||||
let mut data=Vec::new();
|
let mut data=Vec::new();
|
||||||
let &[map_ref]=dom.root().children()else{
|
let &[map_ref]=dom.root().children()else{
|
||||||
return Err(Error::ModelFileRootMustHaveOneChild);
|
return Err(ValidateError::ModelFileRootMustHaveOneChild);
|
||||||
};
|
};
|
||||||
rbx_binary::to_writer(&mut data,&dom,&[map_ref]).map_err(Error::ModelFileEncode)?;
|
rbx_binary::to_writer(&mut data,&dom,&[map_ref]).map_err(ValidateError::ModelFileEncode)?;
|
||||||
|
|
||||||
// upload a model lol
|
// upload a model lol
|
||||||
if let Some(model_id)=validate_info.ValidatedModelID{
|
let model_id=if let Some(model_id)=validate_info.ValidatedModelID{
|
||||||
// upload to existing id
|
// upload to existing id
|
||||||
let response=self.cookie_context.upload(rbx_asset::cookie::UploadRequest{
|
let response=self.cookie_context.upload(rbx_asset::cookie::UploadRequest{
|
||||||
assetid:model_id,
|
assetid:model_id,
|
||||||
@@ -240,13 +232,13 @@ impl crate::message_handler::MessageHandler{
|
|||||||
ispublic:None,
|
ispublic:None,
|
||||||
allowComments:None,
|
allowComments:None,
|
||||||
groupId:None,
|
groupId:None,
|
||||||
},data).await.map_err(Error::AssetUpload)?;
|
},data).await.map_err(ValidateError::AssetUpload)?;
|
||||||
|
|
||||||
(response.AssetId,response.AssetVersion)
|
response.AssetId
|
||||||
}else{
|
}else{
|
||||||
// grab the map instance from the map ref
|
// grab the map instance from the map re
|
||||||
let Some(map_instance)=dom.get_by_ref(map_ref)else{
|
let Some(map_instance)=dom.get_by_ref(map_ref)else{
|
||||||
return Err(Error::ModelFileChildRefIsNil);
|
return Err(ValidateError::ModelFileChildRefIsNil);
|
||||||
};
|
};
|
||||||
// create new model
|
// create new model
|
||||||
let response=self.cookie_context.create(rbx_asset::cookie::CreateRequest{
|
let response=self.cookie_context.create(rbx_asset::cookie::CreateRequest{
|
||||||
@@ -255,31 +247,29 @@ impl crate::message_handler::MessageHandler{
|
|||||||
ispublic:true,
|
ispublic:true,
|
||||||
allowComments:true,
|
allowComments:true,
|
||||||
groupId:None,
|
groupId:None,
|
||||||
},data).await.map_err(Error::AssetCreate)?;
|
},data).await.map_err(ValidateError::AssetCreate)?;
|
||||||
|
|
||||||
(response.AssetId,response.AssetVersion)
|
response.AssetId
|
||||||
|
};
|
||||||
|
|
||||||
|
match validate_info.ResourceID{
|
||||||
|
ResourceID::Mapfix(mapfix_id)=>{
|
||||||
|
// update the mapfix to use the validated model
|
||||||
|
self.api.update_mapfix_validated_model(submissions_api::types::UpdateMapfixModelRequest{
|
||||||
|
MapfixID:mapfix_id,
|
||||||
|
ModelID:model_id,
|
||||||
|
ModelVersion:1, //TODO
|
||||||
|
}).await.map_err(ValidateError::ApiUpdateMapfixModel)?;
|
||||||
|
},
|
||||||
|
ResourceID::Submission(submission_id)=>{
|
||||||
|
// update the submission to use the validated model
|
||||||
|
self.api.update_submission_validated_model(submissions_api::types::UpdateSubmissionModelRequest{
|
||||||
|
SubmissionID:submission_id,
|
||||||
|
ModelID:model_id,
|
||||||
|
ModelVersion:1, //TODO
|
||||||
|
}).await.map_err(ValidateError::ApiUpdateSubmissionModel)?;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
(validate_info.ModelID,validate_info.ModelVersion)
|
|
||||||
};
|
|
||||||
|
|
||||||
match validate_info.ResourceID{
|
|
||||||
ResourceID::Mapfix(mapfix_id)=>{
|
|
||||||
// update the mapfix to use the validated model
|
|
||||||
self.api.update_mapfix_validated_model(submissions_api::types::UpdateMapfixModelRequest{
|
|
||||||
MapfixID:mapfix_id,
|
|
||||||
ModelID:validated_model_id,
|
|
||||||
ModelVersion:validated_model_version,
|
|
||||||
}).await.map_err(Error::ApiUpdateMapfixModel)?;
|
|
||||||
},
|
|
||||||
ResourceID::Submission(submission_id)=>{
|
|
||||||
// update the submission to use the validated model
|
|
||||||
self.api.update_submission_validated_model(submissions_api::types::UpdateSubmissionModelRequest{
|
|
||||||
SubmissionID:submission_id,
|
|
||||||
ModelID:validated_model_id,
|
|
||||||
ModelVersion:validated_model_version,
|
|
||||||
}).await.map_err(Error::ApiUpdateSubmissionModel)?;
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM registry.itzana.me/docker-proxy/oven/bun:1.2.8
|
FROM oven/bun:latest
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -10,4 +10,4 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||||||
|
|
||||||
RUN bun install
|
RUN bun install
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
ENTRYPOINT ["bun", "run", "start"]
|
ENTRYPOINT ["bun", "run", "start"]
|
||||||
@@ -12,7 +12,7 @@ interface SubmissionCardProps {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SubmissionCard(props: SubmissionCardProps) {
|
export default function SubmissionCard(props: SubmissionCardProps) {
|
||||||
return (
|
return (
|
||||||
<Link href={`/submissions/${props.id}`}>
|
<Link href={`/submissions/${props.id}`}>
|
||||||
<div className="submissionCard">
|
<div className="submissionCard">
|
||||||
@@ -40,32 +40,3 @@ export function SubmissionCard(props: SubmissionCardProps) {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MapfixCard(props: SubmissionCardProps) {
|
|
||||||
return (
|
|
||||||
<Link href={`/mapfixes/${props.id}`}>
|
|
||||||
<div className="MapfixCard">
|
|
||||||
<div className="content">
|
|
||||||
<div className="map-image">
|
|
||||||
{/* TODO: Grab image of model */}
|
|
||||||
<Image width={230} height={230} layout="fixed" priority={true} src={`/thumbnails/asset/${props.assetId}`} alt={props.displayName} />
|
|
||||||
</div>
|
|
||||||
<div className="details">
|
|
||||||
<div className="header">
|
|
||||||
<span className="displayName">{props.displayName}</span>
|
|
||||||
<div className="rating">
|
|
||||||
<Rating value={props.rating} readOnly size="small" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="footer">
|
|
||||||
<div className="author">
|
|
||||||
<Image className="avatar" width={28} height={28} priority={true} src={`/thumbnails/user/${props.authorId}`} alt={props.author}/>
|
|
||||||
<span>{props.author}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ interface CreatorAndReviewStatus {
|
|||||||
creator: MapfixInfo["DisplayName"],
|
creator: MapfixInfo["DisplayName"],
|
||||||
review: MapfixInfo["StatusID"],
|
review: MapfixInfo["StatusID"],
|
||||||
status_message: MapfixInfo["StatusMessage"],
|
status_message: MapfixInfo["StatusMessage"],
|
||||||
submitter: MapfixInfo["Submitter"],
|
|
||||||
target_asset_id: MapfixInfo["TargetAssetID"],
|
|
||||||
comments: Comment[],
|
comments: Comment[],
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|||||||
14
web/src/app/mapfixes/[mapfixId]/_map.tsx
Normal file
14
web/src/app/mapfixes/[mapfixId]/_map.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { MapfixInfo } from "@/app/ts/Mapfix"
|
||||||
|
|
||||||
|
interface AssetID {
|
||||||
|
id: MapfixInfo["AssetID"]
|
||||||
|
}
|
||||||
|
|
||||||
|
function MapImage() {
|
||||||
|
return <p>Fetching map image...</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
type AssetID,
|
||||||
|
MapImage
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import Image from "next/image";
|
|
||||||
import { MapfixInfo } from "@/app/ts/Mapfix"
|
|
||||||
|
|
||||||
interface AssetID {
|
|
||||||
id: MapfixInfo["AssetID"]
|
|
||||||
}
|
|
||||||
|
|
||||||
function MapImage({ id }: AssetID) {
|
|
||||||
if (!id) {
|
|
||||||
return <p>Missing asset ID</p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const imageUrl = `/thumbnails/asset/${id}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
src={imageUrl}
|
|
||||||
alt="Map Thumbnail"
|
|
||||||
layout="responsive"
|
|
||||||
width={512}
|
|
||||||
height={512}
|
|
||||||
priority={true}
|
|
||||||
className="map-image"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
type AssetID,
|
|
||||||
MapImage
|
|
||||||
}
|
|
||||||
@@ -1,38 +1,21 @@
|
|||||||
import { Roles, RolesConstants } from "@/app/ts/Roles";
|
|
||||||
import { MapfixStatus } from "@/app/ts/Mapfix";
|
|
||||||
import { Button, ButtonOwnProps } from "@mui/material";
|
import { Button, ButtonOwnProps } from "@mui/material";
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
|
|
||||||
interface ReviewAction {
|
type Actions = "Completed" | "Submit" | "Reject" | "Revoke"
|
||||||
name: string,
|
type ApiActions = Lowercase<Actions> | "trigger-validate" | "retry-validate" | "trigger-upload" | "reset-uploading" | "reset-validating"
|
||||||
action: string,
|
type Review = Actions | "Accept" | "Validate" | "Upload" | "Reset Uploading (fix softlocked status)" | "Reset Validating (fix softlocked status)" | "Request Changes"
|
||||||
}
|
|
||||||
|
|
||||||
const ReviewActions = {
|
|
||||||
Submit: {name:"Submit",action:"trigger-submit"} as ReviewAction,
|
|
||||||
Revoke: {name:"Revoke",action:"revoke"} as ReviewAction,
|
|
||||||
Accept: {name:"Accept",action:"trigger-validate"} as ReviewAction,
|
|
||||||
Reject: {name:"Reject",action:"reject"} as ReviewAction,
|
|
||||||
Validate: {name:"Validate",action:"retry-validate"} as ReviewAction,
|
|
||||||
ResetValidating: {name:"Reset Validating (fix softlocked status)",action:"reset-validating"} as ReviewAction,
|
|
||||||
RequestChanges: {name:"Request Changes",action:"request-changes"} as ReviewAction,
|
|
||||||
Upload: {name:"Upload",action:"trigger-upload"} as ReviewAction,
|
|
||||||
ResetUploading: {name:"Reset Uploading (fix softlocked status)",action:"reset-uploading"} as ReviewAction,
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ReviewButton {
|
interface ReviewButton {
|
||||||
action: ReviewAction,
|
name: Review,
|
||||||
|
action: ApiActions,
|
||||||
mapfixId: string,
|
mapfixId: string,
|
||||||
color: ButtonOwnProps["color"]
|
color: ButtonOwnProps["color"]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ReviewId {
|
interface ReviewId {
|
||||||
mapfixId: string,
|
mapfixId: string
|
||||||
mapfixStatus: number,
|
|
||||||
mapfixSubmitter: number,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ReviewButtonClicked(action: string, mapfixId: string) {
|
async function ReviewButtonClicked(action: ApiActions, mapfixId: string) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/mapfixes/${mapfixId}/status/${action}`, {
|
const response = await fetch(`/api/mapfixes/${mapfixId}/status/${action}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -58,10 +41,11 @@ function ReviewButton(props: ReviewButton) {
|
|||||||
return <Button
|
return <Button
|
||||||
color={props.color}
|
color={props.color}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={() => { ReviewButtonClicked(props.action.action, props.mapfixId) }}>{props.action.name}</Button>
|
onClick={() => { ReviewButtonClicked(props.action, props.mapfixId) }}>{props.name}</Button>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ReviewButtons(props: ReviewId) {
|
export default function ReviewButtons(props: ReviewId) {
|
||||||
|
const mapfixId = props.mapfixId
|
||||||
// When is each button visible?
|
// When is each button visible?
|
||||||
// Multiple buttons can be visible at once.
|
// Multiple buttons can be visible at once.
|
||||||
// Action | Role | When Current Status is One of:
|
// Action | Role | When Current Status is One of:
|
||||||
@@ -75,86 +59,16 @@ export default function ReviewButtons(props: ReviewId) {
|
|||||||
// RequestChanges | Reviewer | Validated, Accepted, Submitted
|
// RequestChanges | Reviewer | Validated, Accepted, Submitted
|
||||||
// Upload | MapAdmin | Validated
|
// Upload | MapAdmin | Validated
|
||||||
// ResetUploading | MapAdmin | Uploading
|
// ResetUploading | MapAdmin | Uploading
|
||||||
const { mapfixId, mapfixStatus } = props;
|
|
||||||
const [user, setUser] = useState<number|null>(null);
|
|
||||||
const [roles, setRoles] = useState<Roles>(RolesConstants.Empty);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function fetchData() {
|
|
||||||
try {
|
|
||||||
const [rolesData, userData] = await Promise.all([
|
|
||||||
fetch("/api/session/roles").then(rolesResponse => rolesResponse.json()),
|
|
||||||
fetch("/api/session/user").then(userResponse => userResponse.json())
|
|
||||||
]);
|
|
||||||
|
|
||||||
setRoles(rolesData.Roles);
|
|
||||||
setUser(userData.UserID);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching data:", error);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchData();
|
|
||||||
}, [mapfixId]);
|
|
||||||
|
|
||||||
if (loading) return <p>Loading...</p>;
|
|
||||||
|
|
||||||
const visibleButtons: ReviewButton[] = [];
|
|
||||||
|
|
||||||
const is_submitter = user === props.mapfixSubmitter;
|
|
||||||
if (is_submitter) {
|
|
||||||
if ([MapfixStatus.UnderConstruction, MapfixStatus.ChangesRequested].includes(mapfixStatus!)) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Submit, color: "info", mapfixId });
|
|
||||||
}
|
|
||||||
if ([MapfixStatus.Submitted, MapfixStatus.ChangesRequested].includes(mapfixStatus!)) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Revoke, color: "info", mapfixId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roles&RolesConstants.MapfixReview) {
|
|
||||||
// you can't review your own mapfix!
|
|
||||||
// note that this means there needs to be more than one person with MapfixReview
|
|
||||||
if (!is_submitter && mapfixStatus === MapfixStatus.Submitted) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Accept, color: "info", mapfixId });
|
|
||||||
visibleButtons.push({ action: ReviewActions.Reject, color: "error", mapfixId });
|
|
||||||
}
|
|
||||||
if (mapfixStatus === MapfixStatus.AcceptedUnvalidated) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Validate, color: "info", mapfixId });
|
|
||||||
}
|
|
||||||
if (mapfixStatus === MapfixStatus.Validating) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.ResetValidating, color: "error", mapfixId });
|
|
||||||
}
|
|
||||||
// this button serves the same purpose as Revoke if you are both
|
|
||||||
// the map submitter and have MapfixReview when status is Submitted
|
|
||||||
if (
|
|
||||||
[MapfixStatus.Validated, MapfixStatus.AcceptedUnvalidated].includes(mapfixStatus!)
|
|
||||||
|| !is_submitter && mapfixStatus == MapfixStatus.Submitted
|
|
||||||
) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.RequestChanges, color: "error", mapfixId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roles&RolesConstants.MapfixUpload) {
|
|
||||||
if (mapfixStatus === MapfixStatus.Validated) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Upload, color: "info", mapfixId });
|
|
||||||
}
|
|
||||||
if (mapfixStatus === MapfixStatus.Uploading) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.ResetUploading, color: "error", mapfixId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="review-set">
|
<section className="review-set">
|
||||||
{visibleButtons.length === 0 ? (
|
<ReviewButton color="info" name="Submit" action="submit" mapfixId={mapfixId}/>
|
||||||
<p>No available actions</p>
|
<ReviewButton color="info" name="Revoke" action="revoke" mapfixId={mapfixId}/>
|
||||||
) : (
|
<ReviewButton color="info" name="Accept" action="trigger-validate" mapfixId={mapfixId}/>
|
||||||
visibleButtons.map((btn) => (
|
<ReviewButton color="info" name="Validate" action="retry-validate" mapfixId={mapfixId}/>
|
||||||
<ReviewButton key={btn.action.action} {...btn} />
|
<ReviewButton color="error" name="Reject" action="reject" mapfixId={mapfixId}/>
|
||||||
))
|
<ReviewButton color="info" name="Upload" action="trigger-upload" mapfixId={mapfixId}/>
|
||||||
)}
|
<ReviewButton color="error" name="Reset Uploading (fix softlocked status)" action="reset-uploading" mapfixId={mapfixId}/>
|
||||||
|
<ReviewButton color="error" name="Reset Validating (fix softlocked status)" action="reset-validating" mapfixId={mapfixId}/>
|
||||||
</section>
|
</section>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,38 +2,51 @@
|
|||||||
|
|
||||||
import { MapfixInfo, MapfixStatusToString } from "@/app/ts/Mapfix";
|
import { MapfixInfo, MapfixStatusToString } from "@/app/ts/Mapfix";
|
||||||
import type { CreatorAndReviewStatus } from "./_comments";
|
import type { CreatorAndReviewStatus } from "./_comments";
|
||||||
import { MapImage } from "./_mapImage";
|
import { MapImage } from "./_map";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import ReviewButtons from "./_reviewButtons";
|
import ReviewButtons from "./_reviewButtons";
|
||||||
|
import { Rating } from "@mui/material";
|
||||||
import Comments from "./_comments";
|
import Comments from "./_comments";
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
|
import Window from "./_window";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
import "./(styles)/page.scss";
|
import "./(styles)/page.scss";
|
||||||
|
|
||||||
interface ReviewId {
|
interface ReviewId {
|
||||||
mapfixId: string,
|
mapfixId: string
|
||||||
mapfixStatus: number,
|
}
|
||||||
mapfixSubmitter: number,
|
|
||||||
mapfixAssetId: number,
|
function Ratings() {
|
||||||
mapfixTargetAssetId: number,
|
return (
|
||||||
|
<Window className="rating-window" title="Rating">
|
||||||
|
<section className="rating-type">
|
||||||
|
<aside className="rating-left">
|
||||||
|
<p>Quality</p>
|
||||||
|
<p>Difficulty</p>
|
||||||
|
<p>Fun</p>
|
||||||
|
<p>Length</p>
|
||||||
|
</aside>
|
||||||
|
<aside className="rating-right">
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
</Window>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function RatingArea(mapfix: ReviewId) {
|
function RatingArea(mapfix: ReviewId) {
|
||||||
return (
|
return (
|
||||||
<aside className="review-area">
|
<aside className="review-area">
|
||||||
<section className="map-image-area">
|
<section className="map-image-area">
|
||||||
<div>
|
<MapImage/>
|
||||||
<p className="this-mapfix">This Mapfix:</p>
|
|
||||||
<MapImage id={mapfix.mapfixAssetId}/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="target-map">Target Map Being Fixed:</p>
|
|
||||||
<MapImage id={mapfix.mapfixTargetAssetId}/>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
<ReviewButtons mapfixId={mapfix.mapfixId} mapfixStatus={mapfix.mapfixStatus} mapfixSubmitter={mapfix.mapfixSubmitter}/>
|
<Ratings/>
|
||||||
|
<ReviewButtons mapfixId={mapfix.mapfixId}/>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -51,9 +64,7 @@ function TitleAndComments(stats: CreatorAndReviewStatus) {
|
|||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
<p className="by-creator">by <Link href="" target="_blank">{stats.creator}</Link></p>
|
<p className="by-creator">by <Link href="" target="_blank">{stats.creator}</Link></p>
|
||||||
<p className="submitter">Submitter {stats.submitter}</p>
|
|
||||||
<p className="asset-id">Model Asset ID {stats.asset_id}</p>
|
<p className="asset-id">Model Asset ID {stats.asset_id}</p>
|
||||||
<p className="target-asset-id">Target Asset ID {stats.target_asset_id}</p>
|
|
||||||
<p className="status-message">Validation Error: {stats.status_message}</p>
|
<p className="status-message">Validation Error: {stats.status_message}</p>
|
||||||
<span className="spacer"></span>
|
<span className="spacer"></span>
|
||||||
<Comments comments_data={stats}/>
|
<Comments comments_data={stats}/>
|
||||||
@@ -85,8 +96,8 @@ export default function MapfixInfoPage() {
|
|||||||
<Webpage>
|
<Webpage>
|
||||||
<main className="map-page-main">
|
<main className="map-page-main">
|
||||||
<section className="review-section">
|
<section className="review-section">
|
||||||
<RatingArea mapfixId={dynamicId.mapfixId} mapfixStatus={mapfix.StatusID} mapfixSubmitter={mapfix.Submitter} mapfixAssetId={mapfix.AssetID} mapfixTargetAssetId={mapfix.TargetAssetID} />
|
<RatingArea mapfixId={dynamicId.mapfixId}/>
|
||||||
<TitleAndComments name={mapfix.DisplayName} creator={mapfix.Creator} review={mapfix.StatusID} status_message={mapfix.StatusMessage} asset_id={mapfix.AssetID} submitter={mapfix.Submitter} target_asset_id={mapfix.TargetAssetID} comments={[]}/>
|
<TitleAndComments name={mapfix.DisplayName} creator={mapfix.Creator} review={mapfix.StatusID} status_message={mapfix.StatusMessage} asset_id={mapfix.AssetID} comments={[]}/>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</Webpage>
|
</Webpage>
|
||||||
|
|||||||
@@ -1,42 +1,41 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { MapfixList } from "../ts/Mapfix";
|
import { MapfixInfo } from "../ts/Mapfix";
|
||||||
import { MapfixCard } from "../_components/mapCard";
|
import MapfixCard from "../_components/mapCard";
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
|
|
||||||
// TODO: MAKE MAPFIX & SUBMISSIONS USE THE SAME COMPONENTS :angry: (currently too lazy)
|
// TODO: MAKE MAPFIX & SUBMISSIONS USE THE SAME COMPONENTS :angry: (currently too lazy)
|
||||||
|
|
||||||
import "./(styles)/page.scss";
|
import "./(styles)/page.scss";
|
||||||
import { ListSortConstants } from "../ts/Sort";
|
|
||||||
|
|
||||||
export default function MapfixInfoPage() {
|
export default function MapfixInfoPage() {
|
||||||
const [mapfixes, setMapfixes] = useState<MapfixList>({Total:0,Mapfixes:[]})
|
const [mapfixes, setMapfixes] = useState<MapfixInfo[]>([])
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
const cardsPerPage = 24; // built to fit on a 1920x1080 monitor
|
const cardsPerPage = 24; // built to fit on a 1920x1080 monitor
|
||||||
|
|
||||||
const totalPages = Math.ceil(mapfixes.Total / cardsPerPage);
|
const totalPages = Math.ceil(mapfixes.length / cardsPerPage);
|
||||||
|
|
||||||
const currentCards = mapfixes.Mapfixes.slice(
|
const currentCards = mapfixes.slice(
|
||||||
(currentPage - 1) * cardsPerPage,
|
currentPage * cardsPerPage,
|
||||||
currentPage * cardsPerPage
|
(currentPage + 1) * cardsPerPage
|
||||||
);
|
);
|
||||||
|
|
||||||
const nextPage = () => {
|
const nextPage = () => {
|
||||||
if (currentPage < totalPages) {
|
if (currentPage < totalPages - 1) {
|
||||||
setCurrentPage(currentPage + 1);
|
setCurrentPage(currentPage + 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const prevPage = () => {
|
const prevPage = () => {
|
||||||
if (currentPage > 1) {
|
if (currentPage > 0) {
|
||||||
setCurrentPage(currentPage - 1);
|
setCurrentPage(currentPage - 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchMapfixes() {
|
async function fetchMapfixes() {
|
||||||
const res = await fetch(`/api/mapfixes?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`)
|
const res = await fetch('/api/mapfixes?Page=1&Limit=100')
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
setMapfixes(await res.json())
|
setMapfixes(await res.json())
|
||||||
}
|
}
|
||||||
@@ -45,7 +44,7 @@ export default function MapfixInfoPage() {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fetchMapfixes()
|
fetchMapfixes()
|
||||||
}, 50);
|
}, 50);
|
||||||
}, [currentPage])
|
}, [])
|
||||||
|
|
||||||
if (!mapfixes) {
|
if (!mapfixes) {
|
||||||
return <Webpage>
|
return <Webpage>
|
||||||
@@ -55,7 +54,7 @@ export default function MapfixInfoPage() {
|
|||||||
</Webpage>
|
</Webpage>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapfixes && mapfixes.Total == 0) {
|
if (mapfixes && mapfixes.length == 0) {
|
||||||
return <Webpage>
|
return <Webpage>
|
||||||
<main>
|
<main>
|
||||||
Mapfixes list is empty.
|
Mapfixes list is empty.
|
||||||
@@ -83,17 +82,17 @@ export default function MapfixInfoPage() {
|
|||||||
{Array.from({ length: totalPages }).map((_, index) => (
|
{Array.from({ length: totalPages }).map((_, index) => (
|
||||||
<span
|
<span
|
||||||
key={index}
|
key={index}
|
||||||
className={`dot ${index+1 === currentPage ? 'active' : ''}`}
|
className={`dot ${index === currentPage ? 'active' : ''}`}
|
||||||
onClick={() => setCurrentPage(index+1)}
|
onClick={() => setCurrentPage(index)}
|
||||||
></span>
|
></span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="pagination">
|
<div className="pagination">
|
||||||
<button onClick={prevPage} disabled={currentPage === 1}><</button>
|
<button onClick={prevPage} disabled={currentPage === 0}><</button>
|
||||||
<span>
|
<span>
|
||||||
Page {currentPage} of {totalPages}
|
Page {currentPage + 1} of {totalPages}
|
||||||
</span>
|
</span>
|
||||||
<button onClick={nextPage} disabled={currentPage === totalPages}>></button>
|
<button onClick={nextPage} disabled={currentPage === totalPages - 1}>></button>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid">
|
<div className="grid">
|
||||||
{currentCards.map((mapfix) => (
|
{currentCards.map((mapfix) => (
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
import Image from "next/image";
|
|
||||||
import { MapInfo } from "@/app/ts/Map";
|
|
||||||
|
|
||||||
interface AssetID {
|
|
||||||
id: MapInfo["ID"];
|
|
||||||
}
|
|
||||||
|
|
||||||
function MapImage({ id }: AssetID) {
|
|
||||||
if (!id) {
|
|
||||||
return <p>Missing asset ID</p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const imageUrl = `/thumbnails/asset/${id}`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
src={imageUrl}
|
|
||||||
alt="Map Thumbnail"
|
|
||||||
layout="responsive"
|
|
||||||
width={512}
|
|
||||||
height={512}
|
|
||||||
priority={true}
|
|
||||||
className="map-image"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { type AssetID, MapImage };
|
|
||||||
@@ -13,7 +13,7 @@ interface MapfixPayload {
|
|||||||
TargetAssetID: number;
|
TargetAssetID: number;
|
||||||
}
|
}
|
||||||
interface IdResponse {
|
interface IdResponse {
|
||||||
OperationID: number;
|
ID: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MapfixInfoPage() {
|
export default function MapfixInfoPage() {
|
||||||
@@ -53,7 +53,7 @@ export default function MapfixInfoPage() {
|
|||||||
const id_response:IdResponse = await response.json();
|
const id_response:IdResponse = await response.json();
|
||||||
|
|
||||||
// navigate to newly created mapfix
|
// navigate to newly created mapfix
|
||||||
window.location.assign(`/operations/${id_response.OperationID}`)
|
window.location.assign(`/mapfixes/${id_response.ID}`)
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting data:", error);
|
console.error("Error submitting data:", error);
|
||||||
|
|||||||
@@ -1,103 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { MapInfo } from "@/app/ts/Map";
|
|
||||||
import { MapImage } from "./_mapImage";
|
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
// MUI Components
|
|
||||||
import {
|
|
||||||
Typography,
|
|
||||||
Box,
|
|
||||||
Button as MuiButton,
|
|
||||||
Card,
|
|
||||||
CardContent,
|
|
||||||
Skeleton,
|
|
||||||
ThemeProvider,
|
|
||||||
createTheme,
|
|
||||||
CssBaseline
|
|
||||||
} from "@mui/material";
|
|
||||||
|
|
||||||
interface ButtonProps {
|
|
||||||
name: string;
|
|
||||||
href: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Button({ name, href }: ButtonProps) {
|
|
||||||
return (
|
|
||||||
<Link href={href} passHref>
|
|
||||||
<MuiButton variant="contained" color="primary" sx={{ mt: 2 }}>
|
|
||||||
{name}
|
|
||||||
</MuiButton>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const darkTheme = createTheme({
|
|
||||||
palette: {
|
|
||||||
mode: "dark",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function Map() {
|
export default function Map() {
|
||||||
const { mapId } = useParams();
|
const { mapId } = useParams<{mapId: string}>()
|
||||||
const [map, setMap] = useState<MapInfo | null>(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
return (
|
||||||
async function getMap() {
|
<Webpage>
|
||||||
const res = await fetch(`/api/maps/${mapId}`);
|
<p>map { mapId }</p>
|
||||||
if (res.ok) {
|
</Webpage>
|
||||||
setMap(await res.json());
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
getMap();
|
|
||||||
}, [mapId]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ThemeProvider theme={darkTheme}>
|
|
||||||
<CssBaseline />
|
|
||||||
<Webpage>
|
|
||||||
{!map ? (
|
|
||||||
<Card>
|
|
||||||
<CardContent>
|
|
||||||
<Skeleton variant="text" width={200} height={40} />
|
|
||||||
<Skeleton variant="text" width={300} />
|
|
||||||
<Skeleton variant="rectangular" height={200} />
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
) : (
|
|
||||||
<Box display="flex" flexDirection={{ xs: "column", md: "row" }} gap={4}>
|
|
||||||
<Box flex={1}>
|
|
||||||
<Card>
|
|
||||||
<CardContent>
|
|
||||||
<Typography variant="h5" gutterBottom>
|
|
||||||
Map Info
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="body1"><strong>Map ID:</strong> {mapId}</Typography>
|
|
||||||
<Typography variant="body1"><strong>Display Name:</strong> {map.DisplayName}</Typography>
|
|
||||||
<Typography variant="body1"><strong>Creator:</strong> {map.Creator}</Typography>
|
|
||||||
<Typography variant="body1"><strong>Game ID:</strong> {map.GameID}</Typography>
|
|
||||||
<Typography variant="body1"><strong>Release Date:</strong> {new Date(map.Date * 1000).toLocaleString()}</Typography>
|
|
||||||
<Button name="Submit A Mapfix For This Map" href={`/maps/${mapId}/fix`} />
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box flex={1}>
|
|
||||||
<Card>
|
|
||||||
<CardContent>
|
|
||||||
<Typography variant="h6" gutterBottom>
|
|
||||||
Map Preview
|
|
||||||
</Typography>
|
|
||||||
<MapImage id={map.ID} />
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Webpage>
|
|
||||||
</ThemeProvider>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
import { CircularProgress, Typography, Card, CardContent, Button } from "@mui/material";
|
import { CircularProgress, Typography, Card, CardContent, Button } from "@mui/material";
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
@@ -17,31 +17,23 @@ interface Operation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function OperationStatusPage() {
|
export default function OperationStatusPage() {
|
||||||
const router = useRouter();
|
|
||||||
const { operationId } = useParams();
|
const { operationId } = useParams();
|
||||||
|
const router = useRouter();
|
||||||
|
const [operation, setOperation] = useState<Operation | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [operation, setOperation] = useState<Operation | null>(null);
|
|
||||||
|
|
||||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!operationId) return;
|
if (!operationId) return;
|
||||||
|
|
||||||
const fetchOperation = async () => {
|
const fetchOperation = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/operations/${operationId}`);
|
const response = await fetch(`/api/operations/${operationId}`);
|
||||||
|
|
||||||
if (!response.ok) throw new Error("Failed to fetch operation");
|
if (!response.ok) throw new Error("Failed to fetch operation");
|
||||||
|
|
||||||
const data: Operation = await response.json();
|
const data = await response.json();
|
||||||
setOperation(data);
|
setOperation(data);
|
||||||
|
|
||||||
if (data.Status !== 0 && intervalRef.current) {
|
|
||||||
clearInterval(intervalRef.current);
|
|
||||||
intervalRef.current = null;
|
|
||||||
}
|
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
if (err instanceof Error) {
|
if (err instanceof Error) {
|
||||||
setError(err.message);
|
setError(err.message);
|
||||||
@@ -52,34 +44,39 @@ export default function OperationStatusPage() {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchOperation();
|
fetchOperation();
|
||||||
if (!intervalRef.current) {
|
const interval = setInterval(fetchOperation, 5000);
|
||||||
intervalRef.current = setInterval(fetchOperation, 1000);
|
|
||||||
}
|
return () => clearInterval(interval);
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (intervalRef.current) {
|
|
||||||
clearInterval(intervalRef.current);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, [operationId]);
|
}, [operationId]);
|
||||||
|
|
||||||
const getStatusText = (status: number) => {
|
const getStatusClass = (status: number) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0:
|
case 0:
|
||||||
return "Created";
|
return "created";
|
||||||
case 1:
|
case 1:
|
||||||
return "Completed";
|
return "completed";
|
||||||
case 2:
|
case 2:
|
||||||
return "Failed";
|
return "failed";
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusClass = (status: number) => getStatusText(status).toLowerCase();
|
const getStatusText = (status: number) => {
|
||||||
|
switch (status) {
|
||||||
|
case 0:
|
||||||
|
return "Created";
|
||||||
|
case 1:
|
||||||
|
return "Completed";
|
||||||
|
case 2:
|
||||||
|
return "Failed";
|
||||||
|
default:
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Webpage>
|
<Webpage>
|
||||||
<main className="operation-status">
|
<main className="operation-status">
|
||||||
@@ -99,13 +96,13 @@ export default function OperationStatusPage() {
|
|||||||
<Typography>Owner: {operation.Owner}</Typography>
|
<Typography>Owner: {operation.Owner}</Typography>
|
||||||
<Typography>Date: {new Date(operation.Date * 1000).toLocaleString()}</Typography>
|
<Typography>Date: {new Date(operation.Date * 1000).toLocaleString()}</Typography>
|
||||||
<Typography>Path: {operation.Path}</Typography>
|
<Typography>Path: {operation.Path}</Typography>
|
||||||
|
|
||||||
{operation.Status === 1 && (
|
{operation.Status === 1 && (
|
||||||
<div className="submission-button">
|
<div className="submission-button">
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="success"
|
color="success"
|
||||||
onClick={() => router.push(operation.Path)}
|
onClick={() => router.push(`/submissions/${operation.OperationID}`)}
|
||||||
>
|
>
|
||||||
View Submission
|
View Submission
|
||||||
</Button>
|
</Button>
|
||||||
@@ -119,4 +116,4 @@ export default function OperationStatusPage() {
|
|||||||
</main>
|
</main>
|
||||||
</Webpage>
|
</Webpage>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -13,8 +13,6 @@ interface CreatorAndReviewStatus {
|
|||||||
creator: SubmissionInfo["DisplayName"],
|
creator: SubmissionInfo["DisplayName"],
|
||||||
review: SubmissionInfo["StatusID"],
|
review: SubmissionInfo["StatusID"],
|
||||||
status_message: SubmissionInfo["StatusMessage"],
|
status_message: SubmissionInfo["StatusMessage"],
|
||||||
submitter: SubmissionInfo["Submitter"],
|
|
||||||
uploaded_asset_id: SubmissionInfo["UploadedAssetID"],
|
|
||||||
comments: Comment[],
|
comments: Comment[],
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,21 @@
|
|||||||
import { Roles, RolesConstants } from "@/app/ts/Roles";
|
|
||||||
import { SubmissionStatus } from "@/app/ts/Submission";
|
|
||||||
import { Button, ButtonOwnProps } from "@mui/material";
|
import { Button, ButtonOwnProps } from "@mui/material";
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
|
|
||||||
interface ReviewAction {
|
type Actions = "Completed" | "Submit" | "Reject" | "Revoke"
|
||||||
name: string,
|
type ApiActions = Lowercase<Actions> | "trigger-validate" | "retry-validate" | "trigger-upload" | "reset-uploading" | "reset-validating"
|
||||||
action: string,
|
type Review = Actions | "Accept" | "Validate" | "Upload" | "Reset Uploading (fix softlocked status)" | "Reset Validating (fix softlocked status)" | "Request Changes"
|
||||||
}
|
|
||||||
|
|
||||||
const ReviewActions = {
|
|
||||||
Submit: {name:"Submit",action:"trigger-submit"} as ReviewAction,
|
|
||||||
Revoke: {name:"Revoke",action:"revoke"} as ReviewAction,
|
|
||||||
Accept: {name:"Accept",action:"trigger-validate"} as ReviewAction,
|
|
||||||
Reject: {name:"Reject",action:"reject"} as ReviewAction,
|
|
||||||
Validate: {name:"Validate",action:"retry-validate"} as ReviewAction,
|
|
||||||
ResetValidating: {name:"Reset Validating (fix softlocked status)",action:"reset-validating"} as ReviewAction,
|
|
||||||
RequestChanges: {name:"Request Changes",action:"request-changes"} as ReviewAction,
|
|
||||||
Upload: {name:"Upload",action:"trigger-upload"} as ReviewAction,
|
|
||||||
ResetUploading: {name:"Reset Uploading (fix softlocked status)",action:"reset-uploading"} as ReviewAction,
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ReviewButton {
|
interface ReviewButton {
|
||||||
action: ReviewAction,
|
name: Review,
|
||||||
|
action: ApiActions,
|
||||||
submissionId: string,
|
submissionId: string,
|
||||||
color: ButtonOwnProps["color"]
|
color: ButtonOwnProps["color"]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ReviewId {
|
interface ReviewId {
|
||||||
submissionId: string,
|
submissionId: string
|
||||||
submissionStatus: number,
|
|
||||||
submissionSubmitter: number,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ReviewButtonClicked(action: string, submissionId: string) {
|
async function ReviewButtonClicked(action: ApiActions, submissionId: string) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/submissions/${submissionId}/status/${action}`, {
|
const response = await fetch(`/api/submissions/${submissionId}/status/${action}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -58,10 +41,11 @@ function ReviewButton(props: ReviewButton) {
|
|||||||
return <Button
|
return <Button
|
||||||
color={props.color}
|
color={props.color}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={() => { ReviewButtonClicked(props.action.action, props.submissionId) }}>{props.action.name}</Button>
|
onClick={() => { ReviewButtonClicked(props.action, props.submissionId) }}>{props.name}</Button>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ReviewButtons(props: ReviewId) {
|
export default function ReviewButtons(props: ReviewId) {
|
||||||
|
const submissionId = props.submissionId
|
||||||
// When is each button visible?
|
// When is each button visible?
|
||||||
// Multiple buttons can be visible at once.
|
// Multiple buttons can be visible at once.
|
||||||
// Action | Role | When Current Status is One of:
|
// Action | Role | When Current Status is One of:
|
||||||
@@ -75,87 +59,16 @@ export default function ReviewButtons(props: ReviewId) {
|
|||||||
// RequestChanges | Reviewer | Validated, Accepted, Submitted
|
// RequestChanges | Reviewer | Validated, Accepted, Submitted
|
||||||
// Upload | MapAdmin | Validated
|
// Upload | MapAdmin | Validated
|
||||||
// ResetUploading | MapAdmin | Uploading
|
// ResetUploading | MapAdmin | Uploading
|
||||||
const { submissionId, submissionStatus } = props;
|
|
||||||
const [user, setUser] = useState<number|null>(null);
|
|
||||||
const [roles, setRoles] = useState<Roles>(RolesConstants.Empty);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function fetchData() {
|
|
||||||
try {
|
|
||||||
const [rolesData, userData] = await Promise.all([
|
|
||||||
fetch("/api/session/roles").then(rolesResponse => rolesResponse.json()),
|
|
||||||
fetch("/api/session/user").then(userResponse => userResponse.json())
|
|
||||||
]);
|
|
||||||
|
|
||||||
setRoles(rolesData.Roles);
|
|
||||||
setUser(userData.UserID);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching data:", error);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchData();
|
|
||||||
}, [submissionId]);
|
|
||||||
|
|
||||||
if (loading) return <p>Loading...</p>;
|
|
||||||
|
|
||||||
const visibleButtons: ReviewButton[] = [];
|
|
||||||
|
|
||||||
const is_submitter = user === props.submissionSubmitter;
|
|
||||||
if (is_submitter) {
|
|
||||||
if ([SubmissionStatus.UnderConstruction, SubmissionStatus.ChangesRequested].includes(submissionStatus!)) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Submit, color: "info", submissionId });
|
|
||||||
}
|
|
||||||
if ([SubmissionStatus.Submitted, SubmissionStatus.ChangesRequested].includes(submissionStatus!)) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Revoke, color: "info", submissionId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roles&RolesConstants.SubmissionReview) {
|
|
||||||
// you can't review your own submission!
|
|
||||||
// note that this means there needs to be more than one person with SubmissionReview
|
|
||||||
if (!is_submitter && submissionStatus === SubmissionStatus.Submitted) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Accept, color: "info", submissionId });
|
|
||||||
visibleButtons.push({ action: ReviewActions.Reject, color: "error", submissionId });
|
|
||||||
}
|
|
||||||
if (submissionStatus === SubmissionStatus.AcceptedUnvalidated) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Validate, color: "info", submissionId });
|
|
||||||
}
|
|
||||||
if (submissionStatus === SubmissionStatus.Validating) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.ResetValidating, color: "error", submissionId });
|
|
||||||
}
|
|
||||||
// this button serves the same purpose as Revoke if you are both
|
|
||||||
// the map submitter and have SubmissionReview when status is Submitted
|
|
||||||
if (
|
|
||||||
[SubmissionStatus.Validated, SubmissionStatus.AcceptedUnvalidated].includes(submissionStatus!)
|
|
||||||
|| !is_submitter && submissionStatus == SubmissionStatus.Submitted
|
|
||||||
) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.RequestChanges, color: "error", submissionId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roles&RolesConstants.SubmissionUpload) {
|
|
||||||
if (submissionStatus === SubmissionStatus.Validated) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.Upload, color: "info", submissionId });
|
|
||||||
}
|
|
||||||
// TODO: hide Reset buttons for 10 seconds
|
|
||||||
if (submissionStatus === SubmissionStatus.Uploading) {
|
|
||||||
visibleButtons.push({ action: ReviewActions.ResetUploading, color: "error", submissionId });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="review-set">
|
<section className="review-set">
|
||||||
{visibleButtons.length === 0 ? (
|
<ReviewButton color="info" name="Submit" action="submit" submissionId={submissionId}/>
|
||||||
<p>No available actions</p>
|
<ReviewButton color="info" name="Revoke" action="revoke" submissionId={submissionId}/>
|
||||||
) : (
|
<ReviewButton color="info" name="Accept" action="trigger-validate" submissionId={submissionId}/>
|
||||||
visibleButtons.map((btn) => (
|
<ReviewButton color="info" name="Validate" action="retry-validate" submissionId={submissionId}/>
|
||||||
<ReviewButton key={btn.action.action} {...btn} />
|
<ReviewButton color="error" name="Reject" action="reject" submissionId={submissionId}/>
|
||||||
))
|
<ReviewButton color="info" name="Upload" action="trigger-upload" submissionId={submissionId}/>
|
||||||
)}
|
<ReviewButton color="error" name="Reset Uploading (fix softlocked status)" action="reset-uploading" submissionId={submissionId}/>
|
||||||
|
<ReviewButton color="error" name="Reset Validating (fix softlocked status)" action="reset-validating" submissionId={submissionId}/>
|
||||||
</section>
|
</section>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import type { CreatorAndReviewStatus } from "./_comments";
|
|||||||
import { MapImage } from "./_mapImage";
|
import { MapImage } from "./_mapImage";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import ReviewButtons from "./_reviewButtons";
|
import ReviewButtons from "./_reviewButtons";
|
||||||
|
import { Rating } from "@mui/material";
|
||||||
import Comments from "./_comments";
|
import Comments from "./_comments";
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
|
import Window from "./_window";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
@@ -15,8 +17,27 @@ import "./(styles)/page.scss";
|
|||||||
interface ReviewId {
|
interface ReviewId {
|
||||||
submissionId: string;
|
submissionId: string;
|
||||||
assetId: number;
|
assetId: number;
|
||||||
submissionStatus: number;
|
}
|
||||||
submissionSubmitter: number,
|
|
||||||
|
function Ratings() {
|
||||||
|
return (
|
||||||
|
<Window className="rating-window" title="Rating">
|
||||||
|
<section className="rating-type">
|
||||||
|
<aside className="rating-left">
|
||||||
|
<p>Quality</p>
|
||||||
|
<p>Difficulty</p>
|
||||||
|
<p>Fun</p>
|
||||||
|
<p>Length</p>
|
||||||
|
</aside>
|
||||||
|
<aside className="rating-right">
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
<Rating defaultValue={2.5} precision={0.5}/>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
</Window>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function RatingArea(submission: ReviewId) {
|
function RatingArea(submission: ReviewId) {
|
||||||
@@ -25,7 +46,8 @@ function RatingArea(submission: ReviewId) {
|
|||||||
<section className="map-image-area">
|
<section className="map-image-area">
|
||||||
<MapImage id={submission.assetId}/>
|
<MapImage id={submission.assetId}/>
|
||||||
</section>
|
</section>
|
||||||
<ReviewButtons submissionId={submission.submissionId} submissionStatus={submission.submissionStatus} submissionSubmitter={submission.submissionSubmitter}/>
|
<Ratings/>
|
||||||
|
<ReviewButtons submissionId={submission.submissionId}/>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -43,9 +65,7 @@ function TitleAndComments(stats: CreatorAndReviewStatus) {
|
|||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
<p className="by-creator">by <Link href="" target="_blank">{stats.creator}</Link></p>
|
<p className="by-creator">by <Link href="" target="_blank">{stats.creator}</Link></p>
|
||||||
<p className="submitter">Submitter {stats.submitter}</p>
|
|
||||||
<p className="asset-id">Model Asset ID {stats.asset_id}</p>
|
<p className="asset-id">Model Asset ID {stats.asset_id}</p>
|
||||||
<p className="uploaded-asset-id">Uploaded Asset ID {stats.uploaded_asset_id}</p>
|
|
||||||
<p className="status-message">Validation Error: {stats.status_message}</p>
|
<p className="status-message">Validation Error: {stats.status_message}</p>
|
||||||
<span className="spacer"></span>
|
<span className="spacer"></span>
|
||||||
<Comments comments_data={stats}/>
|
<Comments comments_data={stats}/>
|
||||||
@@ -77,8 +97,8 @@ export default function SubmissionInfoPage() {
|
|||||||
<Webpage>
|
<Webpage>
|
||||||
<main className="map-page-main">
|
<main className="map-page-main">
|
||||||
<section className="review-section">
|
<section className="review-section">
|
||||||
<RatingArea assetId={submission.AssetID} submissionId={dynamicId.submissionId} submissionStatus={submission.StatusID} submissionSubmitter={submission.Submitter}/>
|
<RatingArea assetId={submission.AssetID} submissionId={dynamicId.submissionId}/>
|
||||||
<TitleAndComments name={submission.DisplayName} creator={submission.Creator} review={submission.StatusID} status_message={submission.StatusMessage} asset_id={submission.AssetID} submitter={submission.Submitter} uploaded_asset_id={submission.UploadedAssetID} comments={[]}/>
|
<TitleAndComments name={submission.DisplayName} creator={submission.Creator} review={submission.StatusID} status_message={submission.StatusMessage} asset_id={submission.AssetID} comments={[]}/>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</Webpage>
|
</Webpage>
|
||||||
|
|||||||
@@ -1,40 +1,39 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { SubmissionList } from "../ts/Submission";
|
import { SubmissionInfo } from "../ts/Submission";
|
||||||
import { SubmissionCard } from "../_components/mapCard";
|
import SubmissionCard from "../_components/mapCard";
|
||||||
import Webpage from "@/app/_components/webpage";
|
import Webpage from "@/app/_components/webpage";
|
||||||
|
|
||||||
import "./(styles)/page.scss";
|
import "./(styles)/page.scss";
|
||||||
import { ListSortConstants } from "../ts/Sort";
|
|
||||||
|
|
||||||
export default function SubmissionInfoPage() {
|
export default function SubmissionInfoPage() {
|
||||||
const [submissions, setSubmissions] = useState<SubmissionList>({Total:0,Submissions:[]})
|
const [submissions, setSubmissions] = useState<SubmissionInfo[]>([])
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
const cardsPerPage = 24; // built to fit on a 1920x1080 monitor
|
const cardsPerPage = 24; // built to fit on a 1920x1080 monitor
|
||||||
|
|
||||||
const totalPages = Math.ceil(submissions.Total / cardsPerPage);
|
const totalPages = Math.ceil(submissions.length / cardsPerPage);
|
||||||
|
|
||||||
const currentCards = submissions.Submissions.slice(
|
const currentCards = submissions.slice(
|
||||||
(currentPage - 1) * cardsPerPage,
|
currentPage * cardsPerPage,
|
||||||
currentPage * cardsPerPage
|
(currentPage + 1) * cardsPerPage
|
||||||
);
|
);
|
||||||
|
|
||||||
const nextPage = () => {
|
const nextPage = () => {
|
||||||
if (currentPage < totalPages) {
|
if (currentPage < totalPages - 1) {
|
||||||
setCurrentPage(currentPage + 1);
|
setCurrentPage(currentPage + 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const prevPage = () => {
|
const prevPage = () => {
|
||||||
if (currentPage > 1) {
|
if (currentPage > 0) {
|
||||||
setCurrentPage(currentPage - 1);
|
setCurrentPage(currentPage - 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchSubmissions() {
|
async function fetchSubmissions() {
|
||||||
const res = await fetch(`/api/submissions?Page=${currentPage}&Limit=${cardsPerPage}&Sort=${ListSortConstants.ListSortDateDescending}`)
|
const res = await fetch('/api/submissions?Page=1&Limit=100')
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
setSubmissions(await res.json())
|
setSubmissions(await res.json())
|
||||||
}
|
}
|
||||||
@@ -43,7 +42,7 @@ export default function SubmissionInfoPage() {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fetchSubmissions()
|
fetchSubmissions()
|
||||||
}, 50);
|
}, 50);
|
||||||
}, [currentPage])
|
}, [])
|
||||||
|
|
||||||
if (!submissions) {
|
if (!submissions) {
|
||||||
return <Webpage>
|
return <Webpage>
|
||||||
@@ -53,7 +52,7 @@ export default function SubmissionInfoPage() {
|
|||||||
</Webpage>
|
</Webpage>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submissions && submissions.Total == 0) {
|
if (submissions && submissions.length == 0) {
|
||||||
return <Webpage>
|
return <Webpage>
|
||||||
<main>
|
<main>
|
||||||
Submissions list is empty.
|
Submissions list is empty.
|
||||||
@@ -81,17 +80,17 @@ export default function SubmissionInfoPage() {
|
|||||||
{Array.from({ length: totalPages }).map((_, index) => (
|
{Array.from({ length: totalPages }).map((_, index) => (
|
||||||
<span
|
<span
|
||||||
key={index}
|
key={index}
|
||||||
className={`dot ${index+1 === currentPage ? 'active' : ''}`}
|
className={`dot ${index === currentPage ? 'active' : ''}`}
|
||||||
onClick={() => setCurrentPage(index+1)}
|
onClick={() => setCurrentPage(index)}
|
||||||
></span>
|
></span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="pagination">
|
<div className="pagination">
|
||||||
<button onClick={prevPage} disabled={currentPage === 1}><</button>
|
<button onClick={prevPage} disabled={currentPage === 0}><</button>
|
||||||
<span>
|
<span>
|
||||||
Page {currentPage} of {totalPages}
|
Page {currentPage + 1} of {totalPages}
|
||||||
</span>
|
</span>
|
||||||
<button onClick={nextPage} disabled={currentPage === totalPages}>></button>
|
<button onClick={nextPage} disabled={currentPage === totalPages - 1}>></button>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid">
|
<div className="grid">
|
||||||
{currentCards.map((submission) => (
|
{currentCards.map((submission) => (
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
interface MapInfo {
|
|
||||||
readonly ID: number,
|
|
||||||
readonly DisplayName: string,
|
|
||||||
readonly Creator: string,
|
|
||||||
readonly GameID: number,
|
|
||||||
readonly Date: number,
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
type MapInfo
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
const enum MapfixStatus {
|
const enum MapfixStatus {
|
||||||
UnderConstruction = 0,
|
UnderConstruction = 0,
|
||||||
ChangesRequested = 1,
|
Submitted = 1,
|
||||||
Submitting = 2,
|
ChangesRequested = 2,
|
||||||
Submitted = 3,
|
Accepted = 3,
|
||||||
AcceptedUnvalidated = 4,
|
Validating = 4,
|
||||||
Validating = 5,
|
Validated = 5,
|
||||||
Validated = 6,
|
Uploading = 6,
|
||||||
Uploading = 7,
|
Uploaded = 7,
|
||||||
Uploaded = 8,
|
Rejected = 8,
|
||||||
Rejected = 9,
|
|
||||||
// MapfixStatus does not have a Released state
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MapfixInfo {
|
interface MapfixInfo {
|
||||||
@@ -29,15 +27,10 @@ interface MapfixInfo {
|
|||||||
readonly StatusMessage: string,
|
readonly StatusMessage: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MapfixList {
|
|
||||||
readonly Total: number,
|
|
||||||
readonly Mapfixes: MapfixInfo[],
|
|
||||||
}
|
|
||||||
|
|
||||||
function MapfixStatusToString(mapfix_status: MapfixStatus): string {
|
function MapfixStatusToString(mapfix_status: MapfixStatus): string {
|
||||||
switch (mapfix_status) {
|
switch (mapfix_status) {
|
||||||
case MapfixStatus.Rejected:
|
case MapfixStatus.Rejected:
|
||||||
return "REJECTED"
|
return "REJECTED"
|
||||||
case MapfixStatus.Uploading:
|
case MapfixStatus.Uploading:
|
||||||
return "UPLOADING"
|
return "UPLOADING"
|
||||||
case MapfixStatus.Uploaded:
|
case MapfixStatus.Uploaded:
|
||||||
@@ -46,14 +39,12 @@ function MapfixStatusToString(mapfix_status: MapfixStatus): string {
|
|||||||
return "VALIDATED"
|
return "VALIDATED"
|
||||||
case MapfixStatus.Validating:
|
case MapfixStatus.Validating:
|
||||||
return "VALIDATING"
|
return "VALIDATING"
|
||||||
case MapfixStatus.AcceptedUnvalidated:
|
case MapfixStatus.Accepted:
|
||||||
return "ACCEPTED, NOT VALIDATED"
|
return "ACCEPTED"
|
||||||
case MapfixStatus.ChangesRequested:
|
case MapfixStatus.ChangesRequested:
|
||||||
return "CHANGES REQUESTED"
|
return "CHANGES REQUESTED"
|
||||||
case MapfixStatus.Submitted:
|
case MapfixStatus.Submitted:
|
||||||
return "SUBMITTED"
|
return "SUBMITTED"
|
||||||
case MapfixStatus.Submitting:
|
|
||||||
return "SUBMITTING"
|
|
||||||
case MapfixStatus.UnderConstruction:
|
case MapfixStatus.UnderConstruction:
|
||||||
return "UNDER CONSTRUCTION"
|
return "UNDER CONSTRUCTION"
|
||||||
default:
|
default:
|
||||||
@@ -64,6 +55,5 @@ function MapfixStatusToString(mapfix_status: MapfixStatus): string {
|
|||||||
export {
|
export {
|
||||||
MapfixStatus,
|
MapfixStatus,
|
||||||
MapfixStatusToString,
|
MapfixStatusToString,
|
||||||
type MapfixInfo,
|
type MapfixInfo
|
||||||
type MapfixList,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
type Roles = number;
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
const RolesConstants = {
|
|
||||||
All: -1 as Roles,
|
|
||||||
SubmissionUpload: 1 << 6 as Roles,
|
|
||||||
SubmissionReview: 1 << 5 as Roles,
|
|
||||||
SubmissionRelease: 1 << 4 as Roles,
|
|
||||||
ScriptWrite: 1 << 3 as Roles,
|
|
||||||
MapfixUpload: 1 << 2 as Roles,
|
|
||||||
MapfixReview: 1 << 1 as Roles,
|
|
||||||
MapDownload: 1 << 0 as Roles,
|
|
||||||
Empty: 0 as Roles,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
function hasRole(flags: Roles, role: Roles): boolean {
|
|
||||||
return (flags & role) === role;
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
type Roles,
|
|
||||||
RolesConstants,
|
|
||||||
hasRole,
|
|
||||||
};
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
type ListSort = number;
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
const ListSortConstants = {
|
|
||||||
ListSortDisabled: 0,
|
|
||||||
ListSortDisplayNameAscending: 1,
|
|
||||||
ListSortDisplayNameDescending: 2,
|
|
||||||
ListSortDateAscending: 3,
|
|
||||||
ListSortDateDescending: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
type ListSort,
|
|
||||||
ListSortConstants,
|
|
||||||
};
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
const enum SubmissionStatus {
|
const enum SubmissionStatus {
|
||||||
UnderConstruction = 0,
|
UnderConstruction = 0,
|
||||||
ChangesRequested = 1,
|
Submitted = 1,
|
||||||
Submitting = 2,
|
ChangesRequested = 2,
|
||||||
Submitted = 3,
|
Accepted = 3,
|
||||||
AcceptedUnvalidated = 4,
|
Validating = 4,
|
||||||
Validating = 5,
|
Validated = 5,
|
||||||
Validated = 6,
|
Uploading = 6,
|
||||||
Uploading = 7,
|
Uploaded = 7,
|
||||||
Uploaded = 8,
|
Rejected = 8,
|
||||||
Rejected = 9,
|
Released = 9,
|
||||||
Released = 10,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SubmissionInfo {
|
interface SubmissionInfo {
|
||||||
@@ -29,17 +28,12 @@ interface SubmissionInfo {
|
|||||||
readonly StatusMessage: string,
|
readonly StatusMessage: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SubmissionList {
|
|
||||||
readonly Total: number,
|
|
||||||
readonly Submissions: SubmissionInfo[],
|
|
||||||
}
|
|
||||||
|
|
||||||
function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
||||||
switch (submission_status) {
|
switch (submission_status) {
|
||||||
case SubmissionStatus.Released:
|
case SubmissionStatus.Released:
|
||||||
return "RELEASED"
|
return "RELEASED"
|
||||||
case SubmissionStatus.Rejected:
|
case SubmissionStatus.Rejected:
|
||||||
return "REJECTED"
|
return "REJECTED"
|
||||||
case SubmissionStatus.Uploading:
|
case SubmissionStatus.Uploading:
|
||||||
return "UPLOADING"
|
return "UPLOADING"
|
||||||
case SubmissionStatus.Uploaded:
|
case SubmissionStatus.Uploaded:
|
||||||
@@ -48,14 +42,12 @@ function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
|||||||
return "VALIDATED"
|
return "VALIDATED"
|
||||||
case SubmissionStatus.Validating:
|
case SubmissionStatus.Validating:
|
||||||
return "VALIDATING"
|
return "VALIDATING"
|
||||||
case SubmissionStatus.AcceptedUnvalidated:
|
case SubmissionStatus.Accepted:
|
||||||
return "ACCEPTED, NOT VALIDATED"
|
return "ACCEPTED"
|
||||||
case SubmissionStatus.ChangesRequested:
|
case SubmissionStatus.ChangesRequested:
|
||||||
return "CHANGES REQUESTED"
|
return "CHANGES REQUESTED"
|
||||||
case SubmissionStatus.Submitted:
|
case SubmissionStatus.Submitted:
|
||||||
return "SUBMITTED"
|
return "SUBMITTED"
|
||||||
case SubmissionStatus.Submitting:
|
|
||||||
return "SUBMITTING"
|
|
||||||
case SubmissionStatus.UnderConstruction:
|
case SubmissionStatus.UnderConstruction:
|
||||||
return "UNDER CONSTRUCTION"
|
return "UNDER CONSTRUCTION"
|
||||||
default:
|
default:
|
||||||
@@ -66,6 +58,5 @@ function SubmissionStatusToString(submission_status: SubmissionStatus): string {
|
|||||||
export {
|
export {
|
||||||
SubmissionStatus,
|
SubmissionStatus,
|
||||||
SubmissionStatusToString,
|
SubmissionStatusToString,
|
||||||
type SubmissionInfo,
|
type SubmissionInfo
|
||||||
type SubmissionList,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user