feat: new homepage statistic API's (#167)

* add date format and orDefault helpers

* introduce new statistics calculations queries

* rework statistics endpoints

* code generation

* fix styles on photo card

* label and location aggregation endpoints

* code-gen

* cleanup parser and defaults

* remove debug point

* setup E2E Testing

* linters

* formatting

* fmt plus name support on time series data

* code gen
This commit is contained in:
Hayden 2022-12-05 12:36:32 -09:00 committed by GitHub
parent de419dc37d
commit d6da63187b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 925 additions and 149 deletions

View file

@ -148,9 +148,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Group"
"Statistics"
],
"summary": "Get the current user's group",
"summary": "Get the current user's group statistics",
"responses": {
"200": {
"description": "OK",
@ -161,6 +161,98 @@ const docTemplate = `{
}
}
},
"/v1/groups/statistics/labels": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.TotalsByOrganizer"
}
}
}
}
}
},
"/v1/groups/statistics/locations": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.TotalsByOrganizer"
}
}
}
}
}
},
"/v1/groups/statistics/purchase-price": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Queries the changes overtime of the purchase price over time",
"parameters": [
{
"type": "string",
"description": "start date",
"name": "start",
"in": "query"
},
{
"type": "string",
"description": "end date",
"name": "end",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.ValueOverTime"
}
}
}
}
},
"/v1/items": {
"get": {
"security": [
@ -449,43 +541,6 @@ const docTemplate = `{
}
}
},
"/v1/items/{id}/attachments/download": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/octet-stream"
],
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"parameters": [
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Attachment token",
"name": "token",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/v1/items/{id}/attachments/{attachment_id}": {
"get": {
"security": [
@ -1237,6 +1292,9 @@ const docTemplate = `{
"repo.GroupStatistics": {
"type": "object",
"properties": {
"totalItemPrice": {
"type": "number"
},
"totalItems": {
"type": "integer"
},
@ -1248,6 +1306,9 @@ const docTemplate = `{
},
"totalUsers": {
"type": "integer"
},
"totalWithWarranty": {
"type": "integer"
}
}
},
@ -1784,6 +1845,20 @@ const docTemplate = `{
}
}
},
"repo.TotalsByOrganizer": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"total": {
"type": "number"
}
}
},
"repo.UserOut": {
"type": "object",
"properties": {
@ -1821,6 +1896,43 @@ const docTemplate = `{
}
}
},
"repo.ValueOverTime": {
"type": "object",
"properties": {
"end": {
"type": "string"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.ValueOverTimeEntry"
}
},
"start": {
"type": "string"
},
"valueAtEnd": {
"type": "number"
},
"valueAtStart": {
"type": "number"
}
}
},
"repo.ValueOverTimeEntry": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
},
"server.ErrorResponse": {
"type": "object",
"properties": {