-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/task management and label crud routes #29
Conversation
* Intial card/button * Basic card and modal Basic card and modal skeleton * fixed card and popup to have the requirments fixed card and popup to have the requirments * wip for passing medication data into Card component * trying to get stuff workin * trying to get comps workin * stuff * Final Working Card + Popup --------- Co-authored-by: AdharshKan42 <[email protected]>
* feat: userContext stuff idk man * refactor: general all around fixes (removing unused imports, fixing navigation errors) * refactor: all over the place with this commit, but added swagger docs for file upload * refactor: make context more general * refactor: utilize card and popup in the medlist FE
* feat: added hot reloading for backend code
@@ -58,7 +57,7 @@ CREATE TABLE IF NOT EXISTS task ( | |||
start_date timestamp, | |||
end_date timestamp, | |||
notes varchar, | |||
repeating BOOLEAN, | |||
repeating BOOLEAN DEFAULT FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet!
Very nice so far! Yall are killing it!! |
// @success 200 {array} models.Task | ||
// @failure 400 {object} string | ||
// @router /tasks/filtered [get] | ||
func (pg *PgModel) GetFilteredTasks(c *gin.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewcaplan1 Should we make this route return the tasks between the given start and end time?
I think rn its returning the task if it exactly starts and ends at the given time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviaseds (i think your name was beside this one on the notion)
I agree with Matt, are you able to make this a inclusive range of tasks that fall between start and end task. I put a comment in the transactions file where you'd probs just need to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I will look into that
// Is there a better way to do this when we don't know which fields are being edited? | ||
editedName := data.LabelName | ||
if editedName == "" { | ||
editedName = labelName | ||
} | ||
|
||
var label = models.Label{ | ||
GroupID: groupIDInt, | ||
LabelName: editedName, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviaseds Does this mean we can only edit the label name if it is empty?? or am i just dumb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewcaplan1 You can edit the label color without editing the label name (so data.LabelName would be an empty string). In that case the "new" label name is the original label name. The if statement was my solution to not knowing whether name is being changed for the query into the database for label color (since the primary key for labels are name, which might change, and group ID, which won't change), but I do not doubt that there is a better way of solving that issue.
// @success 200 {array} models.Task | ||
// @failure 400 {object} string | ||
// @router /tasks/filtered [get] | ||
func (pg *PgModel) GetFilteredTasks(c *gin.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviaseds (i think your name was beside this one on the notion)
I agree with Matt, are you able to make this a inclusive range of tasks that fall between start and end task. I put a comment in the transactions file where you'd probs just need to change.
backend/schema/tasks/transactions.go
Outdated
field_names := []string{"group_id", "created_by", "task_status", "task_type", "start_date", "end_date"} | ||
var query string | ||
var args []interface{} | ||
|
||
for i, field := range query_fields { | ||
if field != "" { | ||
if query != "" { | ||
query += " AND " | ||
} | ||
query += fmt.Sprintf("%s = $%d", field_names[i], len(args)+1) | ||
args = append(args, field) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviaseds Here is a way to have inclusive date range when filtering the tasks. Also see other comment in this transaction file (I think we don't return the start/end date in this transaction)
field_names := []string{"group_id =", "created_by =", "task_status =", "task_type =", "start_date >=", "end_date <="}
var query string
var args []interface{}
for i, field := range query_fields {
if field != "" {
if query != "" {
query += " AND "
}
query += fmt.Sprintf("%s $%d", field_names[i], len(args)+1)
args = append(args, field)
}
}
backend/schema/tasks/transactions.go
Outdated
} | ||
} | ||
|
||
rows, err := pool.Query("SELECT task_id, group_id, created_by, created_date, task_status, task_type FROM task WHERE "+query, args...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add start/end date to SELECT statement. It will be in the WHERE query args but this doesn't return it like we probably should. You will also need to add it to the Scan below this
…com/GenerateNU/Care-Wallet into feature/task-management-crud-routes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Task Management Crud Routes
Task routes
Task label routes
How Has This Been Tested?
Tested with Swagger and locally with unit tests.
Checklist