Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mock data #22

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ repos:
rev: v3.13.0
hooks:
- id: commitizen
- id: commitizen-branch
stages: [push]
69 changes: 68 additions & 1 deletion backend/db/migrations/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ DROP TABLE IF EXISTS label;
DROP TABLE IF EXISTS task_labels;
DROP TABLE IF EXISTS files;


CREATE TYPE role AS ENUM ('PATIENT', 'PRIMARY', 'SECONDARY');
CREATE TYPE task_assignment_status AS ENUM ('ACCEPTED', 'DECLINED', 'NOTIFIED');
CREATE TYPE task_status AS ENUM ('INCOMPLETE', 'COMPLETE', 'PARTIAL');
Expand Down Expand Up @@ -113,6 +112,7 @@ CREATE TABLE IF NOT EXISTS files (
FOREIGN KEY (task_id) REFERENCES task (task_id)
);

----------------- SAMPLE DATA :) -----------------------

-- Insert sample data into "medication" table
INSERT INTO medication (medication_id, medication_name)
Expand All @@ -122,3 +122,70 @@ VALUES
(3, 'Medication C'),
(4, 'Medication D'),
(5, 'Medication E')
;

INSERT INTO care_group (group_name, date_created)
VALUES
('Smith Family', NOW()),
('Johnson Support Network', NOW()),
('Williams Care Team', NOW()),
('Brown Medical Group', NOW())
;

INSERT INTO users (user_id, first_name, last_name, email, phone, address)
VALUES
('user1', 'John', 'Smith', '[email protected]', '123-456-7890', '123 Main St'),
('user2', 'Jane', 'Doe', '[email protected]', '987-654-3210', '456 Elm St'),
('user3', 'Bob', 'Johnson', '[email protected]', NULL, NULL),
('user4', 'Emily', 'Garcia', '[email protected]', '555-1212', '789 Oak Ave')
;

INSERT INTO group_roles (group_id, user_id, role)
VALUES
(1, 'user1', 'PATIENT'),
(1, 'user2', 'PRIMARY'),
(2, 'user3', 'PRIMARY'),
(2, 'user4', 'SECONDARY'),
(3, 'user4', 'PATIENT'),
(4, 'user1', 'SECONDARY'),
(4, 'user3', 'SECONDARY')
;

INSERT INTO task (group_id, created_by, created_date, start_date, end_date, notes, task_status, task_type)
VALUES
(1, 'user2', '2024-02-03 10:45:00', '2024-02-05 10:00:00', '2024-02-05 11:00:00', 'Pick up medication from pharmacy', 'INCOMPLETE', 'med_mgmt'),
(2, 'user3', '2024-02-20 23:59:59', '2024-02-10 14:30:00', NULL, 'Schedule doctor appointment', 'INCOMPLETE', 'other'),
(3, 'user4', '2020-02-05 11:00:00', NULL, '2024-02-20 23:59:59', 'Submit insurance claim', 'PARTIAL', 'financial'),
(4, 'user1', '2006-01-02 15:04:05', NULL, NULL, 'Refill water pitcher', 'COMPLETE', 'other')
;

INSERT INTO task_assignees (task_id, user_id, assignment_status, assigned_by, assigned_date)
VALUES
(1, 'user1', 'ACCEPTED', 'user2', NOW()),
(2, 'user3', 'NOTIFIED', 'user3', NOW()),
(3, 'user4', 'DECLINED', 'user4', NOW()),
(4, 'user2', 'DECLINED', 'user1', NOW())
;

INSERT INTO label (group_id, label_name, label_color)
VALUES
(1, 'Medication', 'blue'),
(2, 'Appointments', 'green'),
(3, 'Financial', 'orange'),
(4, 'Household', 'purple')
;

INSERT INTO task_labels (task_id, group_id, label_name)
VALUES
(1, 1, 'Medication'),
(2, 2, 'Appointments'),
(3, 3, 'Financial'),
(4, 4, 'Household')
;

INSERT INTO files (file_id, file_name, group_id, upload_by, upload_date, file_size, task_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewcaplan1 we may not want to insert into this table? if we wanted file viewing I think this would be cool later but alot of this inserted stuff would need to come from stuff alr on aws

VALUES
(1, 'Medication list.pdf', 1, 'user2', NOW(), 123456, 1),
(2, 'Insurance form.docx', 3, 'user4', NOW(), 456789, 3),
(3, 'Water pitcher instructions.txt', 4, 'user1', NOW(), 1234, 4)
;
216 changes: 216 additions & 0 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,166 @@ const docTemplate = `{
}
}
}
},
"/tasks/{endDate}": {
"get": {
"description": "get all tasks by end date",
"tags": [
"tasks"
],
"summary": "Get All Tasks By End Date",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
},
"/tasks/{gid}": {
"get": {
"description": "get all tasks by group id",
"tags": [
"tasks"
],
"summary": "Get All Tasks By Group ID",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
},
"/tasks/{startDate}": {
"get": {
"description": "get all tasks by start date",
"tags": [
"tasks"
],
"summary": "Get All Tasks By Start Date",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
},
"/tasks/{status}": {
"get": {
"description": "get all tasks by status",
"tags": [
"tasks"
],
"summary": "Get All Tasks By Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
},
"/tasks/{tid}/assignees": {
"post": {
"description": "assign users to task",
"tags": [
"tasks"
],
"summary": "Assign Users To Task",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TaskUser"
}
}
}
}
}
},
"/tasks/{tid}/remove": {
"delete": {
"description": "remove users from task",
"tags": [
"tasks"
],
"summary": "Remove Users From Task",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TaskUser"
}
}
}
}
}
},
"/tasks/{type}": {
"get": {
"description": "get all tasks by type",
"tags": [
"tasks"
],
"summary": "Get All Tasks By Type",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
},
"/tasks/{uid}": {
"get": {
"description": "get all tasks by created by",
"tags": [
"tasks"
],
"summary": "Get All Tasks By Created By",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Task"
}
}
}
}
}
}
},
"definitions": {
Expand All @@ -61,6 +221,62 @@ const docTemplate = `{
"type": "string"
}
}
},
"models.Task": {
"type": "object",
"properties": {
"created_by": {
"description": "User ID",
"type": "string"
},
"created_date": {
"type": "string"
},
"end_date": {
"type": "string"
},
"group_id": {
"type": "integer"
},
"notes": {
"type": "string"
},
"repeating": {
"type": "boolean"
},
"repeating_end_date": {
"type": "string"
},
"repeating_interval": {
"type": "string"
},
"start_date": {
"type": "string"
},
"task_id": {
"type": "integer"
},
"task_info": {
"type": "string"
},
"task_status": {
"type": "string"
},
"task_type": {
"type": "string"
}
}
},
"models.TaskUser": {
"type": "object",
"properties": {
"taskID": {
"type": "integer"
},
"userID": {
"type": "string"
}
}
}
}
}`
Expand Down
Loading
Loading