-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from max-pfeiffer/bugfix/manage_database
Fixed manage command for installing backend database
- Loading branch information
Showing
5 changed files
with
13 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": {"/v1/schedule/{primary_key}": {"get": {"tags": ["schedule"], "summary": "Get Schedule", "description": "Get Schedule.", "operationId": "get_schedule_v1_schedule__primary_key__get", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"tags": ["schedule"], "summary": "Update Schedule", "description": "Update Schedule.", "operationId": "update_schedule_v1_schedule__primary_key__put", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["schedule"], "summary": "Delete Schedule", "description": "Delete Schedule.", "operationId": "delete_schedule_v1_schedule__primary_key__delete", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/schedule/": {"get": {"tags": ["schedule"], "summary": "Get Schedules", "description": "Get Schedules.", "operationId": "get_schedules_v1_schedule__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/ScheduleResponse"}, "type": "array", "title": "Response Get Schedules V1 Schedule Get"}}}}}}, "post": {"tags": ["schedule"], "summary": "Create Schedule", "description": "Create Schedule.", "operationId": "create_schedule_v1_schedule__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "integer", "title": "Response Create Schedule V1 Schedule Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "RelayBoardType": {"type": "string", "const": "waveshare_rpi_relay_board", "title": "RelayBoardType", "description": "Enumeration for repeat values."}, "Repeat": {"type": "string", "enum": ["every_day", "weekdays", "weekends", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], "title": "Repeat", "description": "Enumeration for repeat values."}, "ScheduleCreate": {"properties": {"start_time": {"type": "string", "format": "time", "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Duration", "description": "Duration in minutes"}, "repeat": {"allOf": [{"$ref": "#/components/schemas/Repeat"}], "description": "Specifies how the schedule is repeated"}, "active": {"type": "boolean", "title": "Active", "description": "Whether the schedule is active", "default": true}, "relay_board_type": {"allOf": [{"$ref": "#/components/schemas/RelayBoardType"}], "description": "Type of the relay board"}, "relay_position": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Relay Position", "description": "Position of the relay"}}, "type": "object", "required": ["start_time", "duration", "repeat", "relay_board_type", "relay_position"], "title": "ScheduleCreate", "description": "Creation schema for schedule."}, "ScheduleResponse": {"properties": {"id": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Id", "description": "Primary key"}, "start_time": {"type": "string", "format": "time", "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Duration", "description": "Duration in minutes"}, "repeat": {"allOf": [{"$ref": "#/components/schemas/Repeat"}], "description": "Specifies how the schedule is repeated"}, "active": {"type": "boolean", "title": "Active", "description": "Whether the schedule is active"}, "relay_board_type": {"allOf": [{"$ref": "#/components/schemas/RelayBoardType"}], "description": "Type of the relay board"}, "relay_position": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Relay Position", "description": "Position of the relay"}}, "type": "object", "required": ["id", "start_time", "duration", "repeat", "active", "relay_board_type", "relay_position"], "title": "ScheduleResponse", "description": "Response schema for schedule."}, "ScheduleUpdate": {"properties": {"start_time": {"anyOf": [{"type": "string", "format": "time"}, {"type": "null"}], "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"anyOf": [{"type": "integer", "exclusiveMinimum": 0.0}, {"type": "null"}], "title": "Duration", "description": "Duration in minutes"}, "repeat": {"anyOf": [{"$ref": "#/components/schemas/Repeat"}, {"type": "null"}], "description": "Specifies how the schedule is repeated"}, "active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Active", "description": "Whether the schedule is active"}, "relay_board_type": {"anyOf": [{"$ref": "#/components/schemas/RelayBoardType"}, {"type": "null"}], "description": "Type of the relay board"}, "relay_position": {"anyOf": [{"type": "integer", "exclusiveMinimum": 0.0}, {"type": "null"}], "title": "Relay Position", "description": "Position of the relay"}}, "type": "object", "title": "ScheduleUpdate", "description": "Update schema for schedule."}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}}} | ||
{"openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": {"/v1/schedule/{primary_key}": {"get": {"tags": ["Schedule"], "summary": "Get Schedule", "description": "Get Schedule.", "operationId": "get_schedule_v1_schedule__primary_key__get", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"tags": ["Schedule"], "summary": "Update Schedule", "description": "Update Schedule.", "operationId": "update_schedule_v1_schedule__primary_key__put", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["Schedule"], "summary": "Delete Schedule", "description": "Delete Schedule.", "operationId": "delete_schedule_v1_schedule__primary_key__delete", "parameters": [{"name": "primary_key", "in": "path", "required": true, "schema": {"type": "integer", "title": "Primary Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/schedule/": {"get": {"tags": ["Schedule"], "summary": "Get Schedules", "description": "Get Schedules.", "operationId": "get_schedules_v1_schedule__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/ScheduleResponse"}, "type": "array", "title": "Response Get Schedules V1 Schedule Get"}}}}}}, "post": {"tags": ["Schedule"], "summary": "Create Schedule", "description": "Create Schedule.", "operationId": "create_schedule_v1_schedule__post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ScheduleCreate"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "integer", "title": "Response Create Schedule V1 Schedule Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/relay/": {"get": {"tags": ["Relay"], "summary": "Get Relays", "description": "Get all relays.\n\n:return:", "operationId": "get_relays_v1_relay__get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Relay"}, "type": "array", "title": "Response Get Relays V1 Relay Get"}}}}}}}, "/v1/relay/{position}": {"get": {"tags": ["Relay"], "summary": "Get Relay", "description": "Get relay by position.\n\n:param position:\n:return:", "operationId": "get_relay_v1_relay__position__get", "parameters": [{"name": "position", "in": "path", "required": true, "schema": {"type": "integer", "title": "Position"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Relay"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "put": {"tags": ["Relay"], "summary": "Update Relay", "description": "Update relay by position.\n\n:param position:\n:param relay:\n:return:", "operationId": "update_relay_v1_relay__position__put", "parameters": [{"name": "position", "in": "path", "required": true, "schema": {"type": "integer", "title": "Position"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RelayUpdate"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "Relay": {"properties": {"position": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Position", "description": "Relay position on the board"}, "on": {"type": "boolean", "title": "On", "description": "Indicates if relay is switched on"}}, "type": "object", "required": ["position", "on"], "title": "Relay", "description": "Response schema for Relay object."}, "RelayUpdate": {"properties": {"on": {"type": "boolean", "title": "On", "description": "Indicates if relay is switched on"}}, "type": "object", "required": ["on"], "title": "RelayUpdate", "description": "Update schema for Relay object."}, "Repeat": {"type": "string", "enum": ["every_day", "weekdays", "weekends", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], "title": "Repeat", "description": "Enumeration for repeat values."}, "ScheduleCreate": {"properties": {"start_time": {"type": "string", "format": "time", "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Duration", "description": "Duration in minutes"}, "repeat": {"allOf": [{"$ref": "#/components/schemas/Repeat"}], "description": "Specifies how the schedule is repeated"}, "active": {"type": "boolean", "title": "Active", "description": "Whether the schedule is active", "default": true}, "relay_position": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Relay Position", "description": "Position of the relay"}}, "type": "object", "required": ["start_time", "duration", "repeat", "relay_position"], "title": "ScheduleCreate", "description": "Creation schema for schedule."}, "ScheduleResponse": {"properties": {"id": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Id", "description": "Primary key"}, "start_time": {"type": "string", "format": "time", "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"type": "integer", "exclusiveMinimum": 0.0, "title": "Duration", "description": "Duration in minutes"}, "repeat": {"allOf": [{"$ref": "#/components/schemas/Repeat"}], "description": "Specifies how the schedule is repeated"}, "active": {"type": "boolean", "title": "Active", "description": "Whether the schedule is active"}}, "type": "object", "required": ["id", "start_time", "duration", "repeat", "active"], "title": "ScheduleResponse", "description": "Response schema for schedule."}, "ScheduleUpdate": {"properties": {"start_time": {"anyOf": [{"type": "string", "format": "time"}, {"type": "null"}], "title": "Start Time", "description": "Start time of the schedule"}, "duration": {"anyOf": [{"type": "integer", "exclusiveMinimum": 0.0}, {"type": "null"}], "title": "Duration", "description": "Duration in minutes"}, "repeat": {"anyOf": [{"$ref": "#/components/schemas/Repeat"}, {"type": "null"}], "description": "Specifies how the schedule is repeated"}, "active": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Active", "description": "Whether the schedule is active"}, "relay_position": {"anyOf": [{"type": "integer", "exclusiveMinimum": 0.0}, {"type": "null"}], "title": "Relay Position", "description": "Position of the relay"}}, "type": "object", "title": "ScheduleUpdate", "description": "Update schema for schedule."}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
"""Export commands.""" | ||
from pathlib import Path | ||
|
||
import click | ||
|
||
from manage.utils import ( | ||
PROJECT_ROOT_PATH, | ||
BACKEND_PATH, | ||
VIRTUAL_ENVIRONMENT_PATH, | ||
activate_virtual_environment, | ||
run_subprocess, | ||
) | ||
|
||
|
||
@click.command() | ||
@click.command(name="backend-api-specs") | ||
def backend_api_specs(): | ||
"""Export backend API specification. | ||
:return: | ||
""" | ||
backend_path: Path = PROJECT_ROOT_PATH / "backend" | ||
virtual_environment_path: Path = PROJECT_ROOT_PATH / "backend" / ".venv" | ||
env: dict = activate_virtual_environment(virtual_environment_path) | ||
env: dict = activate_virtual_environment(VIRTUAL_ENVIRONMENT_PATH) | ||
run_subprocess( | ||
["python", "-m", "utilities.export_api_specification"], | ||
cwd=backend_path, | ||
cwd=BACKEND_PATH, | ||
env=env, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters