feat: maintenance log (#170)

* remove repo for document tokens

* remove schema for doc tokens

* fix id template and generate cmd

* schema updates

* code gen

* bump dependencies

* fix broken migrations + add maintenance entry type

* spelling

* remove debug logger

* implement repository layer

* routes

* API client

* wip: maintenance log

* remove depreciated call
This commit is contained in:
Hayden 2022-12-09 20:57:57 -09:00 committed by GitHub
parent d6da63187b
commit 5bbb969763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 6320 additions and 4957 deletions

View file

@ -657,6 +657,117 @@ const docTemplate = `{
}
}
},
"/v1/items/{id}/maintenance": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Get Maintenance Log",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceLog"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Create Maintenance Entry",
"parameters": [
{
"description": "Entry Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntryCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
}
}
}
},
"/v1/items/{id}/maintenance/{entry_id}": {
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Update Maintenance Entry",
"parameters": [
{
"description": "Entry Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntryUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Delete Maintenance Entry",
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/labels": {
"get": {
"security": [
@ -1825,6 +1936,83 @@ const docTemplate = `{
}
}
},
"repo.MaintenanceEntry": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceEntryCreate": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceEntryUpdate": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceLog": {
"type": "object",
"properties": {
"costAverage": {
"type": "number"
},
"costTotal": {
"type": "number"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
},
"itemId": {
"type": "string"
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {

View file

@ -649,6 +649,117 @@
}
}
},
"/v1/items/{id}/maintenance": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Get Maintenance Log",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceLog"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Create Maintenance Entry",
"parameters": [
{
"description": "Entry Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntryCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
}
}
}
},
"/v1/items/{id}/maintenance/{entry_id}": {
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Update Maintenance Entry",
"parameters": [
{
"description": "Entry Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntryUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Maintenance"
],
"summary": "Delete Maintenance Entry",
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/labels": {
"get": {
"security": [
@ -1817,6 +1928,83 @@
}
}
},
"repo.MaintenanceEntry": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceEntryCreate": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceEntryUpdate": {
"type": "object",
"properties": {
"cost": {
"type": "string",
"example": "0"
},
"date": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"repo.MaintenanceLog": {
"type": "object",
"properties": {
"costAverage": {
"type": "number"
},
"costTotal": {
"type": "number"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.MaintenanceEntry"
}
},
"itemId": {
"type": "string"
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {

View file

@ -383,6 +383,57 @@ definitions:
type: string
x-nullable: true
type: object
repo.MaintenanceEntry:
properties:
cost:
example: "0"
type: string
date:
type: string
description:
type: string
id:
type: string
name:
type: string
type: object
repo.MaintenanceEntryCreate:
properties:
cost:
example: "0"
type: string
date:
type: string
description:
type: string
name:
type: string
type: object
repo.MaintenanceEntryUpdate:
properties:
cost:
example: "0"
type: string
date:
type: string
description:
type: string
name:
type: string
type: object
repo.MaintenanceLog:
properties:
costAverage:
type: number
costTotal:
type: number
entries:
items:
$ref: '#/definitions/repo.MaintenanceEntry'
type: array
itemId:
type: string
type: object
repo.PaginationResult-repo_ItemSummary:
properties:
items:
@ -938,6 +989,72 @@ paths:
summary: retrieves an attachment for an item
tags:
- Items Attachments
/v1/items/{id}/maintenance:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.MaintenanceLog'
security:
- Bearer: []
summary: Get Maintenance Log
tags:
- Maintenance
post:
parameters:
- description: Entry Data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/repo.MaintenanceEntryCreate'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.MaintenanceEntry'
security:
- Bearer: []
summary: Create Maintenance Entry
tags:
- Maintenance
/v1/items/{id}/maintenance/{entry_id}:
delete:
produces:
- application/json
responses:
"204":
description: No Content
security:
- Bearer: []
summary: Delete Maintenance Entry
tags:
- Maintenance
put:
parameters:
- description: Entry Data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/repo.MaintenanceEntryUpdate'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.MaintenanceEntry'
security:
- Bearer: []
summary: Update Maintenance Entry
tags:
- Maintenance
/v1/items/import:
post:
parameters: