Skip to content

Commit

Permalink
Add forms and API to manage daily measurements
Browse files Browse the repository at this point in the history
Signed-off-by: Jo Vandeginste <[email protected]>
  • Loading branch information
jovandeginste committed Feb 11, 2025
1 parent 0ec7adb commit 0ba7eed
Show file tree
Hide file tree
Showing 43 changed files with 4,524 additions and 75 deletions.
2 changes: 1 addition & 1 deletion assets/output.css

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,121 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/daily": {
"get": {
"produces": [
"application/json"
],
"summary": "List the daily measurements of the current user",
"parameters": [
{
"type": "integer",
"description": "Number of measurements to return; default 50; -1 is no limit",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/app.APIResponse"
},
{
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/database.Measurement"
}
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Update the daily measurement of the current user",
"parameters": [
{
"description": "Measurement data",
"name": "measurement",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/app.Measurement"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/app.APIResponse"
},
{
"type": "object",
"properties": {
"results": {
"$ref": "#/definitions/database.Measurement"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
}
}
}
},
"/import/{program}": {
"post": {
"produces": [
Expand Down Expand Up @@ -354,6 +469,9 @@ const docTemplate = `{
},
"/workouts/": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -669,6 +787,23 @@ const docTemplate = `{
}
}
},
"app.Measurement": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"height": {
"type": "integer"
},
"steps": {
"type": "integer"
},
"weight": {
"type": "number"
}
}
},
"database.BreakdownItem": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1166,6 +1301,40 @@ const docTemplate = `{
}
}
},
"database.Measurement": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"date": {
"description": "The date of the measurement",
"type": "string"
},
"height": {
"description": "The height of the user, in centimeter",
"type": "integer"
},
"id": {
"type": "integer"
},
"steps": {
"description": "The number of steps taken",
"type": "integer"
},
"updatedAt": {
"type": "string"
},
"userID": {
"description": "The ID of the user who owns the workout",
"type": "integer"
},
"weight": {
"description": "The weight of the user, in kilograms",
"type": "number"
}
}
},
"database.Profile": {
"type": "object",
"properties": {
Expand Down
169 changes: 169 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,121 @@
},
"basePath": "/api/v1",
"paths": {
"/daily": {
"get": {
"produces": [
"application/json"
],
"summary": "List the daily measurements of the current user",
"parameters": [
{
"type": "integer",
"description": "Number of measurements to return; default 50; -1 is no limit",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/app.APIResponse"
},
{
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/database.Measurement"
}
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Update the daily measurement of the current user",
"parameters": [
{
"description": "Measurement data",
"name": "measurement",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/app.Measurement"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/app.APIResponse"
},
{
"type": "object",
"properties": {
"results": {
"$ref": "#/definitions/database.Measurement"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/app.APIResponse"
}
}
}
}
},
"/import/{program}": {
"post": {
"produces": [
Expand Down Expand Up @@ -347,6 +462,9 @@
},
"/workouts/": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -662,6 +780,23 @@
}
}
},
"app.Measurement": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"height": {
"type": "integer"
},
"steps": {
"type": "integer"
},
"weight": {
"type": "number"
}
}
},
"database.BreakdownItem": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1159,6 +1294,40 @@
}
}
},
"database.Measurement": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"date": {
"description": "The date of the measurement",
"type": "string"
},
"height": {
"description": "The height of the user, in centimeter",
"type": "integer"
},
"id": {
"type": "integer"
},
"steps": {
"description": "The number of steps taken",
"type": "integer"
},
"updatedAt": {
"type": "string"
},
"userID": {
"description": "The ID of the user who owns the workout",
"type": "integer"
},
"weight": {
"description": "The weight of the user, in kilograms",
"type": "number"
}
}
},
"database.Profile": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 0ba7eed

Please sign in to comment.