fix: member permissions now works correctly
This commit is contained in:
@ -64,6 +64,9 @@ type Querier interface {
|
||||
GetNotificationForNotificationID(ctx context.Context, notificationID uuid.UUID) (GetNotificationForNotificationIDRow, error)
|
||||
GetProjectByID(ctx context.Context, projectID uuid.UUID) (Project, error)
|
||||
GetProjectIDForTask(ctx context.Context, taskID uuid.UUID) (uuid.UUID, error)
|
||||
GetProjectIDForTaskChecklist(ctx context.Context, taskChecklistID uuid.UUID) (uuid.UUID, error)
|
||||
GetProjectIDForTaskChecklistItem(ctx context.Context, taskChecklistItemID uuid.UUID) (uuid.UUID, error)
|
||||
GetProjectIDForTaskGroup(ctx context.Context, taskGroupID uuid.UUID) (uuid.UUID, error)
|
||||
GetProjectLabelByID(ctx context.Context, projectLabelID uuid.UUID) (ProjectLabel, error)
|
||||
GetProjectLabelsForProject(ctx context.Context, projectID uuid.UUID) ([]ProjectLabel, error)
|
||||
GetProjectMembersForProjectID(ctx context.Context, projectID uuid.UUID) ([]ProjectMember, error)
|
||||
|
@ -25,4 +25,3 @@ WHERE n.notification_id = $1;
|
||||
-- name: CreateNotification :one
|
||||
INSERT INTO notification(notification_object_id, notifier_id)
|
||||
VALUES ($1, $2) RETURNING *;
|
||||
|
||||
|
@ -41,3 +41,16 @@ UPDATE task_checklist SET position = $2 WHERE task_checklist_id = $1 RETURNING *
|
||||
|
||||
-- name: UpdateTaskChecklistItemLocation :one
|
||||
UPDATE task_checklist_item SET position = $2, task_checklist_id = $3 WHERE task_checklist_item_id = $1 RETURNING *;
|
||||
|
||||
-- name: GetProjectIDForTaskChecklist :one
|
||||
SELECT project_id FROM task_checklist
|
||||
INNER JOIN task ON task.task_id = task_checklist.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE task_checklist.task_checklist_id = $1;
|
||||
|
||||
-- name: GetProjectIDForTaskChecklistItem :one
|
||||
SELECT project_id FROM task_checklist_item AS tci
|
||||
INNER JOIN task_checklist ON task_checklist.task_checklist_id = tci.task_checklist_id
|
||||
INNER JOIN task ON task.task_id = task_checklist.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE tci.task_checklist_item_id = $1;
|
||||
|
@ -5,6 +5,9 @@ INSERT INTO task_group (project_id, created_at, name, position)
|
||||
-- name: GetTaskGroupsForProject :many
|
||||
SELECT * FROM task_group WHERE project_id = $1;
|
||||
|
||||
-- name: GetProjectIDForTaskGroup :one
|
||||
SELECT project_id from task_group WHERE task_group_id = $1;
|
||||
|
||||
-- name: GetAllTaskGroups :many
|
||||
SELECT * FROM task_group;
|
||||
|
||||
|
@ -90,6 +90,35 @@ func (q *Queries) DeleteTaskChecklistItem(ctx context.Context, taskChecklistItem
|
||||
return err
|
||||
}
|
||||
|
||||
const getProjectIDForTaskChecklist = `-- name: GetProjectIDForTaskChecklist :one
|
||||
SELECT project_id FROM task_checklist
|
||||
INNER JOIN task ON task.task_id = task_checklist.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE task_checklist.task_checklist_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectIDForTaskChecklist(ctx context.Context, taskChecklistID uuid.UUID) (uuid.UUID, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectIDForTaskChecklist, taskChecklistID)
|
||||
var project_id uuid.UUID
|
||||
err := row.Scan(&project_id)
|
||||
return project_id, err
|
||||
}
|
||||
|
||||
const getProjectIDForTaskChecklistItem = `-- name: GetProjectIDForTaskChecklistItem :one
|
||||
SELECT project_id FROM task_checklist_item AS tci
|
||||
INNER JOIN task_checklist ON task_checklist.task_checklist_id = tci.task_checklist_id
|
||||
INNER JOIN task ON task.task_id = task_checklist.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE tci.task_checklist_item_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectIDForTaskChecklistItem(ctx context.Context, taskChecklistItemID uuid.UUID) (uuid.UUID, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectIDForTaskChecklistItem, taskChecklistItemID)
|
||||
var project_id uuid.UUID
|
||||
err := row.Scan(&project_id)
|
||||
return project_id, err
|
||||
}
|
||||
|
||||
const getTaskChecklistByID = `-- name: GetTaskChecklistByID :one
|
||||
SELECT task_checklist_id, task_id, created_at, name, position FROM task_checklist WHERE task_checklist_id = $1
|
||||
`
|
||||
|
@ -85,6 +85,17 @@ func (q *Queries) GetAllTaskGroups(ctx context.Context) ([]TaskGroup, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getProjectIDForTaskGroup = `-- name: GetProjectIDForTaskGroup :one
|
||||
SELECT project_id from task_group WHERE task_group_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectIDForTaskGroup(ctx context.Context, taskGroupID uuid.UUID) (uuid.UUID, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectIDForTaskGroup, taskGroupID)
|
||||
var project_id uuid.UUID
|
||||
err := row.Scan(&project_id)
|
||||
return project_id, err
|
||||
}
|
||||
|
||||
const getTaskGroupByID = `-- name: GetTaskGroupByID :one
|
||||
SELECT task_group_id, project_id, created_at, name, position FROM task_group WHERE task_group_id = $1
|
||||
`
|
||||
|
Reference in New Issue
Block a user