From 2e65d071e0b5277d5b6980ad3bc323e86e87a583 Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Mon, 31 Mar 2025 15:16:10 -0700
Subject: [PATCH] openapi: mapfixes

---
 openapi-internal.yaml |  97 ++++++++++++
 openapi.yaml          | 344 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 441 insertions(+)

diff --git a/openapi-internal.yaml b/openapi-internal.yaml
index 91cf730..c47f030 100644
--- a/openapi-internal.yaml
+++ b/openapi-internal.yaml
@@ -4,9 +4,98 @@ info:
   description: Internal operations inaccessible from the public internet.
   version: 0.1.0
 tags:
+  - name: Mapfixes
+    description: Mapfix operations
   - name: Submissions
     description: Submission operations
 paths:
+  /mapfixes/{MapfixID}/validated-model:
+    post:
+      summary: Update validated model
+      operationId: updateMapfixValidatedModel
+      tags:
+        - Mapfixes
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+        - name: ValidatedModelID
+          in: query
+          required: true
+          schema:
+            type: integer
+            format: int64
+        - name: ValidatedModelVersion
+          in: query
+          required: true
+          schema:
+            type: integer
+            format: int64
+      responses:
+        "204":
+          description: Successful response
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /mapfixes/{MapfixID}/status/validator-validated:
+    post:
+      summary: (Internal endpoint) Role Validator changes status from Validating -> Validated
+      operationId: actionMapfixValidated
+      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/validator-failed:
+    post:
+      summary: (Internal endpoint) Role Validator changes status from Validating -> Accepted
+      operationId: actionMapfixAccepted
+      tags:
+        - Mapfixes
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+        - name: StatusMessage
+          in: query
+          required: true
+          schema:
+            type: string
+            minLength: 0
+            maxLength: 4096
+      responses:
+        "204":
+          description: Successful response
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /mapfixes/{MapfixID}/status/validator-uploaded:
+    post:
+      summary: (Internal endpoint) Role Validator changes status from Uploading -> Uploaded
+      operationId: actionMapfixUploaded
+      tags:
+        - Mapfixes
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+      responses:
+        "204":
+          description: Successful response
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
   /submissions/{SubmissionID}/validated-model:
     post:
       summary: Update validated model
@@ -261,6 +350,14 @@ paths:
                 $ref: "#/components/schemas/Error"
 components:
   parameters:
+    MapfixID:
+      name: MapfixID
+      in: path
+      required: true
+      description: The unique identifier for a submission.
+      schema:
+        type: integer
+        format: int64
     SubmissionID:
       name: SubmissionID
       in: path
diff --git a/openapi.yaml b/openapi.yaml
index 1fdfcea..1f94269 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -6,6 +6,8 @@ info:
 servers:
   - url: https://submissions.strafes.net/v1
 tags:
+  - name: Mapfixes
+    description: Mapfix operations
   - name: Session
     description: Session operations
   - name: Submissions
@@ -74,6 +76,281 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/Error"
+  /mapfixes:
+    get:
+      summary: Get list of mapfixes
+      operationId: listMapfixes
+      tags:
+        - Mapfixes
+      security: []
+      parameters:
+      - $ref: "#/components/parameters/Page"
+      - $ref: "#/components/parameters/Limit"
+      - name: Sort
+        in: query
+        schema:
+          type: integer
+          format: int32
+      responses:
+        "200":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: "#/components/schemas/Mapfix"
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+    post:
+      summary: Create new mapfix
+      operationId: createMapfix
+      tags:
+        - Mapfixes
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/MapfixCreate'
+      responses:
+        "201":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Id"
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /mapfixes/{MapfixID}:
+    get:
+      summary: Retrieve map with ID
+      operationId: getMapfix
+      tags:
+        - Mapfixes
+      security: []
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+      responses:
+        "200":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Mapfix"
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /mapfixes/{MapfixID}/model:
+    post:
+      summary: Update model following role restrictions
+      operationId: updateMapfixModel
+      tags:
+        - Mapfixes
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+        - name: ModelID
+          in: query
+          required: true
+          schema:
+            type: integer
+            format: int64
+        - name: VersionID
+          in: query
+          required: true
+          schema:
+            type: integer
+            format: int64
+      responses:
+        "204":
+          description: Successful response
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /mapfixes/{MapfixID}/completed:
+    post:
+      summary: Called by maptest when a player completes the map
+      operationId: setMapfixCompleted
+      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/submit:
+    post:
+      summary: Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
+      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/revoke:
+    post:
+      summary: Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction
+      operationId: actionMapfixRevoke
+      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/trigger-validate:
+    post:
+      summary: Role Reviewer triggers validation and changes status from Submitted -> Validating
+      operationId: actionMapfixTriggerValidate
+      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/retry-validate:
+    post:
+      summary: Role Reviewer re-runs validation and changes status from Accepted -> Validating
+      operationId: actionMapfixRetryValidate
+      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-validating:
+    post:
+      summary: Role Reviewer manually resets validating softlock and changes status from Validating -> Accepted
+      operationId: actionMapfixAccepted
+      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/reject:
+    post:
+      summary: Role Reviewer changes status from Submitted -> Rejected
+      operationId: actionMapfixReject
+      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/request-changes:
+    post:
+      summary: Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested
+      operationId: actionMapfixRequestChanges
+      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/trigger-upload:
+    post:
+      summary: Role Admin changes status from Validated -> Uploading
+      operationId: actionMapfixTriggerUpload
+      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-uploading:
+    post:
+      summary: Role Admin manually resets uploading softlock and changes status from Uploading -> Validated
+      operationId: actionMapfixValidated
+      tags:
+        - Mapfixes
+      parameters:
+        - $ref: '#/components/parameters/MapfixID'
+      responses:
+        "204":
+          description: Successful response
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
   /submissions:
     get:
       summary: Get list of submissions
@@ -656,6 +933,14 @@ components:
       in: cookie
       name: session_id
   parameters:
+    MapfixID:
+      name: MapfixID
+      in: path
+      required: true
+      description: The unique identifier for a mapfix.
+      schema:
+        type: integer
+        format: int64
     SubmissionID:
       name: SubmissionID
       in: path
@@ -730,6 +1015,65 @@ components:
         AvatarURL:
           type: string
           maxLength: 256
+    Mapfix:
+      required:
+      - ID
+      - CreatedAt
+      - UpdatedAt
+      - Submitter
+      - AssetID
+      - AssetVersion
+      - Completed
+      - TargetAssetID
+      - StatusID
+      - StatusMessage
+      type: object
+      properties:
+        ID:
+          type: integer
+          format: int64
+        CreatedAt:
+          type: integer
+          format: int64
+        UpdatedAt:
+          type: integer
+          format: int64
+        Submitter:
+          type: integer
+          format: int64
+        AssetID:
+          type: integer
+          format: int64
+        AssetVersion:
+          type: integer
+          format: int64
+        Completed:
+          type: boolean
+        TargetAssetID:
+          type: integer
+          format: int64
+        StatusID:
+          type: integer
+          format: int32
+        StatusMessage:
+          type: string
+          maxLength: 256
+    MapfixCreate:
+      required:
+      - AssetID
+      - AssetVersion
+      - TargetAssetID
+      type: object
+      properties:
+        AssetID:
+          type: integer
+          format: int64
+        AssetVersion:
+          type: integer
+          format: int64
+        TargetAssetID:
+          type: integer
+          format: int64
     Submission:
       required:
       - ID