tb/main #1

Open
terrabytten wants to merge 17 commits from tb/main into main
3 changed files with 124 additions and 2 deletions
Showing only changes of commit 0254ec2525 - Show all commits

View file

@ -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

View file

@ -5,4 +5,10 @@ func testService(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "Hello World!"
})
}
}
func claimsByBarcode(c *gin.Context) {
system := c.DefaultQuery("system", "upc")
barcode := c.Query("barcode")
}

View file

@ -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