diff --git a/internal/docs/docs.go b/internal/docs/docs.go index 77d477f..8c74d54 100644 --- a/internal/docs/docs.go +++ b/internal/docs/docs.go @@ -3846,6 +3846,37 @@ const docTemplate = `{ } } }, + "constants.ATCRating": { + "type": "integer", + "enum": [ + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 7, + 8, + 10, + 11, + 12 + ], + "x-enum-varnames": [ + "InactiveRating", + "SuspendedRating", + "ObserverRating", + "Student1Rating", + "Student2Rating", + "Student3Rating", + "ControllerRating", + "SeniorControllerRating", + "InstructorRating", + "SeniorInstructorRating", + "SupervisorRating", + "AdministratorRating" + ] + }, "constants.FacilityID": { "type": "string", "enum": [ @@ -4351,7 +4382,11 @@ const docTemplate = `{ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "created_at": { @@ -4641,11 +4676,19 @@ const docTemplate = `{ "example": "1293257" }, "new_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 2 }, "old_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 } } @@ -4670,11 +4713,19 @@ const docTemplate = `{ "example": 1 }, "new_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 2 }, "old_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "updated_at": { @@ -4926,7 +4977,11 @@ const docTemplate = `{ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "discord_id": { @@ -4971,7 +5026,11 @@ const docTemplate = `{ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "created_at": { @@ -5205,9 +5264,9 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "0.1", - Host: "api.vatusa.local", + Host: "api.vatusa.dev", BasePath: "/internal/v1", - Schemes: []string{"http"}, + Schemes: []string{"https"}, Title: "VATUSA Internal", Description: "VATUSAs internal API for use by other internal VATUSA services.", InfoInstanceName: "swagger", diff --git a/internal/docs/swagger.json b/internal/docs/swagger.json index 450e754..7129e24 100644 --- a/internal/docs/swagger.json +++ b/internal/docs/swagger.json @@ -1,6 +1,6 @@ { "schemes": [ - "http" + "https" ], "swagger": "2.0", "info": { @@ -18,7 +18,7 @@ }, "version": "0.1" }, - "host": "api.vatusa.local", + "host": "api.vatusa.dev", "basePath": "/internal/v1", "paths": { "/documents": { @@ -3843,6 +3843,37 @@ } } }, + "constants.ATCRating": { + "type": "integer", + "enum": [ + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 7, + 8, + 10, + 11, + 12 + ], + "x-enum-varnames": [ + "InactiveRating", + "SuspendedRating", + "ObserverRating", + "Student1Rating", + "Student2Rating", + "Student3Rating", + "ControllerRating", + "SeniorControllerRating", + "InstructorRating", + "SeniorInstructorRating", + "SupervisorRating", + "AdministratorRating" + ] + }, "constants.FacilityID": { "type": "string", "enum": [ @@ -4348,7 +4379,11 @@ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "created_at": { @@ -4638,11 +4673,19 @@ "example": "1293257" }, "new_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 2 }, "old_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 } } @@ -4667,11 +4710,19 @@ "example": 1 }, "new_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 2 }, "old_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "updated_at": { @@ -4923,7 +4974,11 @@ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "discord_id": { @@ -4968,7 +5023,11 @@ "example": 1293257 }, "controller_rating": { - "type": "integer", + "allOf": [ + { + "$ref": "#/definitions/constants.ATCRating" + } + ], "example": 1 }, "created_at": { diff --git a/internal/docs/swagger.yaml b/internal/docs/swagger.yaml index 751e077..69d32f7 100644 --- a/internal/docs/swagger.yaml +++ b/internal/docs/swagger.yaml @@ -32,6 +32,34 @@ definitions: example: '''1234567'' or ''System''' type: string type: object + constants.ATCRating: + enum: + - -1 + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + - 7 + - 8 + - 10 + - 11 + - 12 + type: integer + x-enum-varnames: + - InactiveRating + - SuspendedRating + - ObserverRating + - Student1Rating + - Student2Rating + - Student3Rating + - ControllerRating + - SeniorControllerRating + - InstructorRating + - SeniorInstructorRating + - SupervisorRating + - AdministratorRating constants.FacilityID: enum: - ZAE @@ -418,8 +446,9 @@ definitions: example: 1293257 type: integer controller_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 1 - type: integer created_at: example: "2021-01-01T00:00:00Z" type: string @@ -625,11 +654,13 @@ definitions: example: "1293257" type: string new_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 2 - type: integer old_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 1 - type: integer required: - created_by_cid - new_rating @@ -650,11 +681,13 @@ definitions: example: 1 type: integer new_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 2 - type: integer old_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 1 - type: integer updated_at: example: "2021-01-01T00:00:00Z" type: string @@ -832,8 +865,9 @@ definitions: example: 1293257 type: integer controller_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 1 - type: integer discord_id: example: "1234567890" type: string @@ -872,8 +906,9 @@ definitions: example: 1293257 type: integer controller_rating: + allOf: + - $ref: '#/definitions/constants.ATCRating' example: 1 - type: integer created_at: example: "2021-01-01T00:00:00Z" type: string @@ -1030,7 +1065,7 @@ definitions: description: user-level status message type: string type: object -host: api.vatusa.local +host: api.vatusa.dev info: contact: email: vatusa6@vatusa.net @@ -3554,5 +3589,5 @@ paths: tags: - user-flag schemes: -- http +- https swagger: "2.0" diff --git a/internal/router.go b/internal/router.go index e4f9226..7cda8af 100644 --- a/internal/router.go +++ b/internal/router.go @@ -20,9 +20,9 @@ import ( // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @host api.vatusa.local +// @host api.vatusa.dev // @BasePath /internal/v1 -// @schemes http +// @schemes https func Router(r chi.Router, cfg *config.Config) { r.Route("/internal", func(r chi.Router) { diff --git a/pkg/go-chi/setup.go b/pkg/go-chi/setup.go index 11b18a2..03835a7 100644 --- a/pkg/go-chi/setup.go +++ b/pkg/go-chi/setup.go @@ -22,7 +22,7 @@ func New(cfg *config.Config) *chi.Mux { r.Route("/ping", func(r chi.Router) { r.Get("/", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("pong")) + render.Status(r, http.StatusNoContent) }) })