Skip to content

Commit

Permalink
Feature/multiple equivalency table v2 (#198)
Browse files Browse the repository at this point in the history
* multiple equivalency table feature progress

* use unknown param and unit domains if not present

* fix PUT default param/unit id

* rolling sum over elevation ascending

* add timout to http.Client; set default search_path for local database

* route datalogger table error and previews; reference 'datalogger' name consistently

* fix dcsloader url logging

* correctly set encoded parameters to RawQuery before setting URL

* fix depth based instrument v2 migrations

* add statement timeout for runaway queries

* fix depth based instrument v2 migration

* fix slow GetHome sql query

* remove background context from pubsub service

* fix build error

* use dataloggerID for error rounting

* trigger repeatable migration to run after instruments view dropped

* update ipi fields; fix inconsistencies in depth instruments seed data

* fix bug with duplicate initial time in saa/ipi

* fix linting (type hinting) in python script

* add tests for datalogger and equivalency table

* fix unexported DataloggerTable struct fields

* fix preview url trailing space

* fix trailing spaces in urls

* fix telemetry api; fix urls in tests; fix wrong http res codes

* auto create/delete datalogger table on eq table creation/deletion

* respond with 404 when preview not found
  • Loading branch information
dennisgsmith authored Dec 13, 2023
1 parent 46ba4bf commit 822283e
Show file tree
Hide file tree
Showing 23 changed files with 1,166 additions and 274 deletions.
207 changes: 192 additions & 15 deletions api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,120 @@ const docTemplate = `{
}
},
"/datalogger/{datalogger_id}/equivalency_table": {
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"equivalency-table"
],
"summary": "creates an equivalency table for a datalogger and auto create data logger table if not exists",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "datalogger uuid",
"name": "datalogger_id",
"in": "path",
"required": true
},
{
"description": "equivalency table payload",
"name": "equivalency_table",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.EquivalencyTable"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
}
}
}
},
"/datalogger/{datalogger_id}/key": {
"put": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"datalogger"
],
"summary": "deletes and recreates a datalogger api key",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "datalogger uuid",
"name": "datalogger_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.DataloggerWithKey"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/echo.HTTPError"
}
}
}
}
},
"/datalogger/{datalogger_id}/tables/{datalogger_table_id}/equivalency_table": {
"get": {
"security": [
{
Expand All @@ -528,6 +642,14 @@ const docTemplate = `{
"name": "datalogger_id",
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "datalogger table uuid",
"name": "datalogger_table_id",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -582,6 +704,14 @@ const docTemplate = `{
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "datalogger table uuid",
"name": "datalogger_table_id",
"in": "path",
"required": true
},
{
"description": "equivalency table payload",
"name": "equivalency_table",
Expand Down Expand Up @@ -631,7 +761,7 @@ const docTemplate = `{
"tags": [
"equivalency-table"
],
"summary": "creates an equivalency table for a datalogger",
"summary": "creates an equivalency table for a datalogger and auto create data logger table if not exists",
"parameters": [
{
"type": "string",
Expand All @@ -641,6 +771,14 @@ const docTemplate = `{
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "datalogger table uuid",
"name": "datalogger_table_id",
"in": "path",
"required": true
},
{
"description": "equivalency table payload",
"name": "equivalency_table",
Expand Down Expand Up @@ -691,7 +829,7 @@ const docTemplate = `{
"tags": [
"equivalency-table"
],
"summary": "deletes an equivalency table",
"summary": "deletes an equivalency table and corresponding datalogger table",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -731,7 +869,7 @@ const docTemplate = `{
}
}
},
"/datalogger/{datalogger_id}/equivalency_table/row": {
"/datalogger/{datalogger_id}/tables/{datalogger_table_id}/equivalency_table/row/{row_id}": {
"delete": {
"security": [
{
Expand All @@ -758,8 +896,8 @@ const docTemplate = `{
"type": "string",
"format": "uuid",
"description": "equivalency table row uuid",
"name": "id",
"in": "query",
"name": "row_id",
"in": "path",
"required": true
}
],
Expand Down Expand Up @@ -792,7 +930,7 @@ const docTemplate = `{
}
}
},
"/datalogger/{datalogger_id}/key": {
"/datalogger/{datalogger_id}/tables/{datalogger_table_id}/name": {
"put": {
"security": [
{
Expand All @@ -805,7 +943,7 @@ const docTemplate = `{
"tags": [
"datalogger"
],
"summary": "deletes and recreates a datalogger api key",
"summary": "resets a datalogger table name to be renamed by incoming telemetry",
"parameters": [
{
"type": "string",
Expand All @@ -814,13 +952,21 @@ const docTemplate = `{
"name": "datalogger_id",
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "datalogger table uuid",
"name": "datalogger_table_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.DataloggerWithKey"
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.DataloggerPreview"
}
},
"400": {
Expand All @@ -844,7 +990,7 @@ const docTemplate = `{
}
}
},
"/datalogger/{datalogger_id}/preview": {
"/datalogger/{datalogger_id}/tables/{datalogger_table_id}/preview": {
"get": {
"security": [
{
Expand All @@ -866,6 +1012,14 @@ const docTemplate = `{
"name": "datalogger_id",
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "datalogger table uuid",
"name": "datalogger_table_id",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -7987,6 +8141,12 @@ const docTemplate = `{
"sn": {
"type": "string"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.DataloggerTable"
}
},
"update_date": {
"type": "string"
},
Expand All @@ -8001,19 +8161,24 @@ const docTemplate = `{
"github_com_USACE_instrumentation-api_api_internal_model.DataloggerPreview": {
"type": "object",
"properties": {
"datalogger_id": {
"type": "string"
},
"model": {
"datalogger_table_id": {
"type": "string"
},
"preview": {
"$ref": "#/definitions/pgtype.JSON"
},
"sn": {
"update_date": {
"type": "string"
}
}
},
"github_com_USACE_instrumentation-api_api_internal_model.DataloggerTable": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"update_date": {
"table_name": {
"type": "string"
}
}
Expand Down Expand Up @@ -8060,6 +8225,12 @@ const docTemplate = `{
"sn": {
"type": "string"
},
"tables": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_USACE_instrumentation-api_api_internal_model.DataloggerTable"
}
},
"update_date": {
"type": "string"
},
Expand Down Expand Up @@ -8172,6 +8343,12 @@ const docTemplate = `{
"datalogger_id": {
"type": "string"
},
"datalogger_table_id": {
"type": "string"
},
"datalogger_table_name": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
Expand Down
Loading

0 comments on commit 822283e

Please sign in to comment.