feat: allow nested relationships for locations and items (#102)

Basic implementation that allows organizing Locations and Items within each other.
This commit is contained in:
Hayden 2022-10-23 20:54:39 -08:00 committed by GitHub
parent fe6cd431a6
commit a4b4fe3454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 2329 additions and 126 deletions

View file

@ -845,6 +845,15 @@ const docTemplate = `{
"name": "id",
"in": "path",
"required": true
},
{
"description": "Location Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.LocationUpdate"
}
}
],
"responses": {
@ -1232,6 +1241,10 @@ const docTemplate = `{
},
"name": {
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true
}
}
},
@ -1270,6 +1283,12 @@ const docTemplate = `{
"$ref": "#/definitions/repo.ItemAttachment"
}
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
},
"createdAt": {
"type": "string"
},
@ -1277,7 +1296,6 @@ const docTemplate = `{
"type": "string"
},
"fields": {
"description": "Future",
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemField"
@ -1301,6 +1319,8 @@ const docTemplate = `{
},
"location": {
"description": "Edges",
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.LocationSummary"
},
"manufacturer": {
@ -1316,6 +1336,11 @@ const docTemplate = `{
"description": "Extras",
"type": "string"
},
"parent": {
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.ItemSummary"
},
"purchaseFrom": {
"type": "string"
},
@ -1381,6 +1406,8 @@ const docTemplate = `{
},
"location": {
"description": "Edges",
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.LocationSummary"
},
"name": {
@ -1439,6 +1466,11 @@ const docTemplate = `{
"description": "Extras",
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true,
"x-omitempty": true
},
"purchaseFrom": {
"type": "string"
},
@ -1553,6 +1585,12 @@ const docTemplate = `{
"repo.LocationOut": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.LocationSummary"
}
},
"createdAt": {
"type": "string"
},
@ -1571,6 +1609,9 @@ const docTemplate = `{
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/repo.LocationSummary"
},
"updatedAt": {
"type": "string"
}
@ -1619,6 +1660,24 @@ const docTemplate = `{
}
}
},
"repo.LocationUpdate": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {

View file

@ -837,6 +837,15 @@
"name": "id",
"in": "path",
"required": true
},
{
"description": "Location Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.LocationUpdate"
}
}
],
"responses": {
@ -1224,6 +1233,10 @@
},
"name": {
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true
}
}
},
@ -1262,6 +1275,12 @@
"$ref": "#/definitions/repo.ItemAttachment"
}
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemSummary"
}
},
"createdAt": {
"type": "string"
},
@ -1269,7 +1288,6 @@
"type": "string"
},
"fields": {
"description": "Future",
"type": "array",
"items": {
"$ref": "#/definitions/repo.ItemField"
@ -1293,6 +1311,8 @@
},
"location": {
"description": "Edges",
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.LocationSummary"
},
"manufacturer": {
@ -1308,6 +1328,11 @@
"description": "Extras",
"type": "string"
},
"parent": {
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.ItemSummary"
},
"purchaseFrom": {
"type": "string"
},
@ -1373,6 +1398,8 @@
},
"location": {
"description": "Edges",
"x-nullable": true,
"x-omitempty": true,
"$ref": "#/definitions/repo.LocationSummary"
},
"name": {
@ -1431,6 +1458,11 @@
"description": "Extras",
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true,
"x-omitempty": true
},
"purchaseFrom": {
"type": "string"
},
@ -1545,6 +1577,12 @@
"repo.LocationOut": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.LocationSummary"
}
},
"createdAt": {
"type": "string"
},
@ -1563,6 +1601,9 @@
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/repo.LocationSummary"
},
"updatedAt": {
"type": "string"
}
@ -1611,6 +1652,24 @@
}
}
},
"repo.LocationUpdate": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"parentId": {
"type": "string",
"x-nullable": true
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {

View file

@ -62,6 +62,9 @@ definitions:
type: string
name:
type: string
parentId:
type: string
x-nullable: true
type: object
repo.ItemField:
properties:
@ -86,12 +89,15 @@ definitions:
items:
$ref: '#/definitions/repo.ItemAttachment'
type: array
children:
items:
$ref: '#/definitions/repo.ItemSummary'
type: array
createdAt:
type: string
description:
type: string
fields:
description: Future
items:
$ref: '#/definitions/repo.ItemField'
type: array
@ -109,6 +115,8 @@ definitions:
location:
$ref: '#/definitions/repo.LocationSummary'
description: Edges
x-nullable: true
x-omitempty: true
manufacturer:
type: string
modelNumber:
@ -118,6 +126,10 @@ definitions:
notes:
description: Extras
type: string
parent:
$ref: '#/definitions/repo.ItemSummary'
x-nullable: true
x-omitempty: true
purchaseFrom:
type: string
purchasePrice:
@ -164,6 +176,8 @@ definitions:
location:
$ref: '#/definitions/repo.LocationSummary'
description: Edges
x-nullable: true
x-omitempty: true
name:
type: string
quantity:
@ -202,6 +216,10 @@ definitions:
notes:
description: Extras
type: string
parentId:
type: string
x-nullable: true
x-omitempty: true
purchaseFrom:
type: string
purchasePrice:
@ -278,6 +296,10 @@ definitions:
type: object
repo.LocationOut:
properties:
children:
items:
$ref: '#/definitions/repo.LocationSummary'
type: array
createdAt:
type: string
description:
@ -290,6 +312,8 @@ definitions:
type: array
name:
type: string
parent:
$ref: '#/definitions/repo.LocationSummary'
updatedAt:
type: string
type: object
@ -321,6 +345,18 @@ definitions:
updatedAt:
type: string
type: object
repo.LocationUpdate:
properties:
description:
type: string
id:
type: string
name:
type: string
parentId:
type: string
x-nullable: true
type: object
repo.PaginationResult-repo_ItemSummary:
properties:
items:
@ -976,6 +1012,12 @@ paths:
name: id
required: true
type: string
- description: Location Data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/repo.LocationUpdate'
produces:
- application/json
responses: