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

@ -24,6 +24,8 @@ definitions:
type: object
repo.GroupStatistics:
properties:
totalItemPrice:
type: number
totalItems:
type: integer
totalLabels:
@ -32,6 +34,8 @@ definitions:
type: integer
totalUsers:
type: integer
totalWithWarranty:
type: integer
type: object
repo.GroupUpdate:
properties:
@ -392,6 +396,15 @@ definitions:
total:
type: integer
type: object
repo.TotalsByOrganizer:
properties:
id:
type: string
name:
type: string
total:
type: number
type: object
repo.UserOut:
properties:
email:
@ -416,6 +429,30 @@ definitions:
name:
type: string
type: object
repo.ValueOverTime:
properties:
end:
type: string
entries:
items:
$ref: '#/definitions/repo.ValueOverTimeEntry'
type: array
start:
type: string
valueAtEnd:
type: number
valueAtStart:
type: number
type: object
repo.ValueOverTimeEntry:
properties:
date:
type: string
name:
type: string
value:
type: number
type: object
server.ErrorResponse:
properties:
error:
@ -608,9 +645,64 @@ paths:
$ref: '#/definitions/repo.GroupStatistics'
security:
- Bearer: []
summary: Get the current user's group
summary: Get the current user's group statistics
tags:
- Group
- Statistics
/v1/groups/statistics/labels:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/repo.TotalsByOrganizer'
type: array
security:
- Bearer: []
summary: Get the current user's group statistics
tags:
- Statistics
/v1/groups/statistics/locations:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/repo.TotalsByOrganizer'
type: array
security:
- Bearer: []
summary: Get the current user's group statistics
tags:
- Statistics
/v1/groups/statistics/purchase-price:
get:
parameters:
- description: start date
in: query
name: start
type: string
- description: end date
in: query
name: end
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.ValueOverTime'
security:
- Bearer: []
summary: Queries the changes overtime of the purchase price over time
tags:
- Statistics
/v1/items:
get:
parameters:
@ -846,29 +938,6 @@ paths:
summary: retrieves an attachment for an item
tags:
- Items Attachments
/v1/items/{id}/attachments/download:
get:
parameters:
- description: Item ID
in: path
name: id
required: true
type: string
- description: Attachment token
in: query
name: token
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: OK
security:
- Bearer: []
summary: retrieves an attachment for an item
tags:
- Items Attachments
/v1/items/import:
post:
parameters: