chore: refactor api endpoints (#339)

* move typegen code

* update taskfile to fix code-gen caches and use 'dir' attribute

* enable dumping stack traces for errors

* log request start and stop

* set zerolog stack handler

* fix routes function

* refactor context adapters to use requests directly

* change some method signatures to support GID

* start requiring validation tags

* first pass on updating handlers to use adapters

* add errs package

* code gen

* tidy

* rework API to use external server package
This commit is contained in:
Hayden 2023-03-20 20:32:10 -08:00 committed by GitHub
parent 184b494fc3
commit db80f8a159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 806 additions and 1947 deletions

View file

@ -1,5 +1,14 @@
basePath: /api
definitions:
mid.ErrorResponse:
properties:
error:
type: string
fields:
additionalProperties:
type: string
type: object
type: object
repo.DocumentOut:
properties:
id:
@ -67,6 +76,8 @@ definitions:
repo.ItemCreate:
properties:
description:
maxLength: 1000
minLength: 1
type: string
labelIds:
items:
@ -76,10 +87,15 @@ definitions:
description: Edges
type: string
name:
maxLength: 255
minLength: 1
type: string
parentId:
type: string
x-nullable: true
required:
- description
- name
type: object
repo.ItemField:
properties:
@ -281,9 +297,14 @@ definitions:
color:
type: string
description:
maxLength: 255
type: string
name:
maxLength: 255
minLength: 1
type: string
required:
- name
type: object
repo.LabelOut:
properties:
@ -579,28 +600,6 @@ definitions:
value:
type: number
type: object
server.ErrorResponse:
properties:
error:
type: string
fields:
additionalProperties:
type: string
type: object
type: object
server.Result:
properties:
details: {}
error:
type: boolean
item: {}
message:
type: string
type: object
server.Results:
properties:
items: {}
type: object
services.UserRegistration:
properties:
email:
@ -666,7 +665,11 @@ definitions:
expiresAt:
type: string
uses:
maximum: 100
minimum: 1
type: integer
required:
- uses
type: object
v1.ItemAttachmentToken:
properties:
@ -682,6 +685,10 @@ definitions:
token:
type: string
type: object
v1.Wrapped:
properties:
item: {}
type: object
info:
contact:
name: Don't
@ -932,8 +939,8 @@ paths:
produces:
- application/json
responses:
"200":
description: OK
"201":
description: Created
schema:
$ref: '#/definitions/repo.ItemSummary'
security:
@ -1036,7 +1043,7 @@ paths:
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/server.ErrorResponse'
$ref: '#/definitions/mid.ErrorResponse'
security:
- Bearer: []
summary: Create Item Attachment
@ -1140,8 +1147,8 @@ paths:
produces:
- application/json
responses:
"200":
description: OK
"201":
description: Created
schema:
$ref: '#/definitions/repo.MaintenanceEntry'
security:
@ -1252,7 +1259,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- $ref: '#/definitions/v1.Wrapped'
- properties:
items:
items:
@ -1354,7 +1361,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- $ref: '#/definitions/v1.Wrapped'
- properties:
items:
items:
@ -1462,7 +1469,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- $ref: '#/definitions/v1.Wrapped'
- properties:
items:
items:
@ -1483,7 +1490,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- $ref: '#/definitions/v1.Wrapped'
- properties:
items:
items:
@ -1725,7 +1732,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Result'
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
$ref: '#/definitions/repo.UserOut'
@ -1750,7 +1757,7 @@ paths:
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Result'
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
$ref: '#/definitions/repo.UserUpdate'