diff --git a/internal/controllers/routes.go b/internal/controllers/routes.go index 271f9d0..7e5e873 100644 --- a/internal/controllers/routes.go +++ b/internal/controllers/routes.go @@ -7,7 +7,8 @@ func main() { router.GET("/test", runTest) // Search for item info - router.GET("/test", runTest) + router.GET("/claims/{barcode}", runTest) + router.DELETE("/claims/{barcode}", runTest) // Update item info router.GET("/test", runTest) // Add new item info diff --git a/internal/services/userService.go b/internal/services/userService.go index 4f5a7d8..090d4e5 100644 --- a/internal/services/userService.go +++ b/internal/services/userService.go @@ -5,4 +5,10 @@ func testService(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "message": "Hello World!" }) -} \ No newline at end of file +} + +func claimsByBarcode(c *gin.Context) { + system := c.DefaultQuery("system", "upc") + barcode := c.Query("barcode") +} + diff --git a/internal/swagger.yml b/internal/swagger.yml index e69de29..05a8408 100644 --- a/internal/swagger.yml +++ b/internal/swagger.yml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + title: Automated Claims API + version: 1.0.0 +paths: + /claims/{barcode}: + get: + summary: Get claims for a barcode and system + parameters: + - name: barcode + in: path + description: Barcode value + required: true + schema: + type: string + - name: system + in: query + description: Name of barcode standard + required: false + schema: + type: string + default: UPC + responses: + "200": + description: Claims found + content: + application/json: + type: array + items: + $ref: "#/components/schemas/Claim" + "204": + description: No claims found for product + "404": + description: Product not found + delete: + summary: Delete claims by user ID + parameters: + - name: id + in: path + description: ID of the claim to delete + required: true + schema: + type: long + responses: + "200": + description: Successful deletion + content: + application/json: + schema: + $ref: "#/components/schemas/Claim" + "404": + description: Claim not found + post: + summary: Make a new user claim + parameters: + - name: barcode + in: path + description: ID of the automated claim + required: true + schema: + type: integer + - name: claim + in: body + description: Claim information + required: true + schema: + $ref: "#/components/schemas/AutomatedClaim" + responses: + "200": + description: Successfully added + content: + schema: + $ref: "#/components/schemas/AutomatedClaim" + "400": + description: Missing information +components: + schemas: + Claim: + type: object + properties: + id: + type: long + product_id: + type: long + evidence_type: # only in user claims + type: string + enum: [image, link, text] + worker: # only in auto claims + type: string + enum: [barnivore] # TODO add other workers + evidence: + type: object + category: # single category claims + type: string + enum: + - ContainsMeat + - ContainsFish + - ContainsEggs + - ContainsMilk + - ContainsHoney + - ContainsWax + - ContainsFur + - ContainsLeather + - ContainsAnimalFibers + - ContainsWool + - ContainsFeathers + - AnimalTesting + - MonkeySlavery + polarity: # true means it does do the thing + type: boolean + created_at: + type: string + format: date-time + created_by: + type: string