feat: change url structure to use short ids instead of full uuids
This commit is contained in:
@ -86,6 +86,7 @@ type Project struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Name string `json:"name"`
|
||||
PublicOn sql.NullTime `json:"public_on"`
|
||||
ShortID string `json:"short_id"`
|
||||
}
|
||||
|
||||
type ProjectLabel struct {
|
||||
@ -132,6 +133,7 @@ type Task struct {
|
||||
Complete bool `json:"complete"`
|
||||
CompletedAt sql.NullTime `json:"completed_at"`
|
||||
HasTime bool `json:"has_time"`
|
||||
ShortID string `json:"short_id"`
|
||||
}
|
||||
|
||||
type TaskActivity struct {
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const createPersonalProject = `-- name: CreatePersonalProject :one
|
||||
INSERT INTO project(team_id, created_at, name) VALUES (null, $1, $2) RETURNING project_id, team_id, created_at, name, public_on
|
||||
INSERT INTO project(team_id, created_at, name) VALUES (null, $1, $2) RETURNING project_id, team_id, created_at, name, public_on, short_id
|
||||
`
|
||||
|
||||
type CreatePersonalProjectParams struct {
|
||||
@ -29,6 +29,7 @@ func (q *Queries) CreatePersonalProject(ctx context.Context, arg CreatePersonalP
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -80,7 +81,7 @@ func (q *Queries) CreateProjectMember(ctx context.Context, arg CreateProjectMemb
|
||||
}
|
||||
|
||||
const createTeamProject = `-- name: CreateTeamProject :one
|
||||
INSERT INTO project(team_id, created_at, name) VALUES ($1, $2, $3) RETURNING project_id, team_id, created_at, name, public_on
|
||||
INSERT INTO project(team_id, created_at, name) VALUES ($1, $2, $3) RETURNING project_id, team_id, created_at, name, public_on, short_id
|
||||
`
|
||||
|
||||
type CreateTeamProjectParams struct {
|
||||
@ -98,6 +99,7 @@ func (q *Queries) CreateTeamProject(ctx context.Context, arg CreateTeamProjectPa
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -135,7 +137,7 @@ func (q *Queries) DeleteProjectMember(ctx context.Context, arg DeleteProjectMemb
|
||||
}
|
||||
|
||||
const getAllProjectsForTeam = `-- name: GetAllProjectsForTeam :many
|
||||
SELECT project_id, team_id, created_at, name, public_on FROM project WHERE team_id = $1
|
||||
SELECT project_id, team_id, created_at, name, public_on, short_id FROM project WHERE team_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetAllProjectsForTeam(ctx context.Context, teamID uuid.UUID) ([]Project, error) {
|
||||
@ -153,6 +155,7 @@ func (q *Queries) GetAllProjectsForTeam(ctx context.Context, teamID uuid.UUID) (
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -168,7 +171,7 @@ func (q *Queries) GetAllProjectsForTeam(ctx context.Context, teamID uuid.UUID) (
|
||||
}
|
||||
|
||||
const getAllTeamProjects = `-- name: GetAllTeamProjects :many
|
||||
SELECT project_id, team_id, created_at, name, public_on FROM project WHERE team_id IS NOT null
|
||||
SELECT project_id, team_id, created_at, name, public_on, short_id FROM project WHERE team_id IS NOT null
|
||||
`
|
||||
|
||||
func (q *Queries) GetAllTeamProjects(ctx context.Context) ([]Project, error) {
|
||||
@ -186,6 +189,7 @@ func (q *Queries) GetAllTeamProjects(ctx context.Context) ([]Project, error) {
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -201,7 +205,7 @@ func (q *Queries) GetAllTeamProjects(ctx context.Context) ([]Project, error) {
|
||||
}
|
||||
|
||||
const getAllVisibleProjectsForUserID = `-- name: GetAllVisibleProjectsForUserID :many
|
||||
SELECT project.project_id, project.team_id, project.created_at, project.name, project.public_on FROM project LEFT JOIN
|
||||
SELECT project.project_id, project.team_id, project.created_at, project.name, project.public_on, project.short_id FROM project LEFT JOIN
|
||||
project_member ON project_member.project_id = project.project_id WHERE project_member.user_id = $1
|
||||
`
|
||||
|
||||
@ -220,6 +224,7 @@ func (q *Queries) GetAllVisibleProjectsForUserID(ctx context.Context, userID uui
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -298,7 +303,7 @@ func (q *Queries) GetMemberProjectIDsForUserID(ctx context.Context, userID uuid.
|
||||
}
|
||||
|
||||
const getPersonalProjectsForUserID = `-- name: GetPersonalProjectsForUserID :many
|
||||
SELECT project.project_id, project.team_id, project.created_at, project.name, project.public_on FROM project
|
||||
SELECT project.project_id, project.team_id, project.created_at, project.name, project.public_on, project.short_id FROM project
|
||||
LEFT JOIN personal_project ON personal_project.project_id = project.project_id
|
||||
WHERE personal_project.user_id = $1
|
||||
`
|
||||
@ -318,6 +323,7 @@ func (q *Queries) GetPersonalProjectsForUserID(ctx context.Context, userID uuid.
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -333,7 +339,7 @@ func (q *Queries) GetPersonalProjectsForUserID(ctx context.Context, userID uuid.
|
||||
}
|
||||
|
||||
const getProjectByID = `-- name: GetProjectByID :one
|
||||
SELECT project_id, team_id, created_at, name, public_on FROM project WHERE project_id = $1
|
||||
SELECT project_id, team_id, created_at, name, public_on, short_id FROM project WHERE project_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectByID(ctx context.Context, projectID uuid.UUID) (Project, error) {
|
||||
@ -345,10 +351,22 @@ func (q *Queries) GetProjectByID(ctx context.Context, projectID uuid.UUID) (Proj
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getProjectIDByShortID = `-- name: GetProjectIDByShortID :one
|
||||
SELECT project_id FROM project WHERE short_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectIDByShortID(ctx context.Context, shortID string) (uuid.UUID, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectIDByShortID, shortID)
|
||||
var project_id uuid.UUID
|
||||
err := row.Scan(&project_id)
|
||||
return project_id, err
|
||||
}
|
||||
|
||||
const getProjectMemberInvitedIDByEmail = `-- name: GetProjectMemberInvitedIDByEmail :one
|
||||
SELECT email, invited_on, project_member_invited_id FROM user_account_invited AS uai
|
||||
inner join project_member_invited AS pmi
|
||||
@ -489,7 +507,7 @@ func (q *Queries) GetUserRolesForProject(ctx context.Context, arg GetUserRolesFo
|
||||
}
|
||||
|
||||
const setPublicOn = `-- name: SetPublicOn :one
|
||||
UPDATE project SET public_on = $2 WHERE project_id = $1 RETURNING project_id, team_id, created_at, name, public_on
|
||||
UPDATE project SET public_on = $2 WHERE project_id = $1 RETURNING project_id, team_id, created_at, name, public_on, short_id
|
||||
`
|
||||
|
||||
type SetPublicOnParams struct {
|
||||
@ -506,6 +524,7 @@ func (q *Queries) SetPublicOn(ctx context.Context, arg SetPublicOnParams) (Proje
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -535,7 +554,7 @@ func (q *Queries) UpdateProjectMemberRole(ctx context.Context, arg UpdateProject
|
||||
}
|
||||
|
||||
const updateProjectNameByID = `-- name: UpdateProjectNameByID :one
|
||||
UPDATE project SET name = $2 WHERE project_id = $1 RETURNING project_id, team_id, created_at, name, public_on
|
||||
UPDATE project SET name = $2 WHERE project_id = $1 RETURNING project_id, team_id, created_at, name, public_on, short_id
|
||||
`
|
||||
|
||||
type UpdateProjectNameByIDParams struct {
|
||||
@ -552,6 +571,7 @@ func (q *Queries) UpdateProjectNameByID(ctx context.Context, arg UpdateProjectNa
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.PublicOn,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ type Querier interface {
|
||||
GetNotifiedByID(ctx context.Context, notifiedID uuid.UUID) (GetNotifiedByIDRow, error)
|
||||
GetPersonalProjectsForUserID(ctx context.Context, userID uuid.UUID) ([]Project, error)
|
||||
GetProjectByID(ctx context.Context, projectID uuid.UUID) (Project, error)
|
||||
GetProjectIDByShortID(ctx context.Context, shortID string) (uuid.UUID, 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)
|
||||
@ -119,6 +120,7 @@ type Querier interface {
|
||||
GetTaskChecklistsForTask(ctx context.Context, taskID uuid.UUID) ([]TaskChecklist, error)
|
||||
GetTaskGroupByID(ctx context.Context, taskGroupID uuid.UUID) (TaskGroup, error)
|
||||
GetTaskGroupsForProject(ctx context.Context, projectID uuid.UUID) ([]TaskGroup, error)
|
||||
GetTaskIDByShortID(ctx context.Context, shortID string) (uuid.UUID, error)
|
||||
GetTaskLabelByID(ctx context.Context, taskLabelID uuid.UUID) (TaskLabel, error)
|
||||
GetTaskLabelForTaskByProjectLabelID(ctx context.Context, arg GetTaskLabelForTaskByProjectLabelIDParams) (TaskLabel, error)
|
||||
GetTaskLabelsForTaskID(ctx context.Context, taskID uuid.UUID) ([]TaskLabel, error)
|
||||
|
@ -1,6 +1,9 @@
|
||||
-- name: GetAllTeamProjects :many
|
||||
SELECT * FROM project WHERE team_id IS NOT null;
|
||||
|
||||
-- name: GetProjectIDByShortID :one
|
||||
SELECT project_id FROM project WHERE short_id = $1;
|
||||
|
||||
-- name: GetAllProjectsForTeam :many
|
||||
SELECT * FROM project WHERE team_id = $1;
|
||||
|
||||
|
@ -4,6 +4,9 @@ SELECT * FROM task_watcher WHERE user_id = $1 AND task_id = $2;
|
||||
-- name: CreateTaskWatcher :one
|
||||
INSERT INTO task_watcher (user_id, task_id, watched_at) VALUES ($1, $2, $3) RETURNING *;
|
||||
|
||||
-- name: GetTaskIDByShortID :one
|
||||
SELECT task_id FROM task WHERE short_id = $1;
|
||||
|
||||
-- name: DeleteTaskWatcher :exec
|
||||
DELETE FROM task_watcher WHERE user_id = $1 AND task_id = $2;
|
||||
|
||||
@ -54,7 +57,7 @@ SELECT project_id FROM task
|
||||
WHERE task_id = $1;
|
||||
|
||||
-- name: GetProjectInfoForTask :one
|
||||
SELECT project.project_id, project.name FROM task
|
||||
SELECT project.short_id AS project_short_id, project.name, task.short_id AS task_short_id FROM task
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
INNER JOIN project ON task_group.project_id = project.project_id
|
||||
WHERE task_id = $1;
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
|
||||
const createTask = `-- name: CreateTask :one
|
||||
INSERT INTO task (task_group_id, created_at, name, position)
|
||||
VALUES($1, $2, $3, $4) RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
VALUES($1, $2, $3, $4) RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type CreateTaskParams struct {
|
||||
@ -43,13 +43,14 @@ func (q *Queries) CreateTask(ctx context.Context, arg CreateTaskParams) (Task, e
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const createTaskAll = `-- name: CreateTaskAll :one
|
||||
INSERT INTO task (task_group_id, created_at, name, position, description, complete, due_date)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type CreateTaskAllParams struct {
|
||||
@ -84,6 +85,7 @@ func (q *Queries) CreateTaskAll(ctx context.Context, arg CreateTaskAllParams) (T
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -197,7 +199,7 @@ func (q *Queries) DeleteTasksByTaskGroupID(ctx context.Context, taskGroupID uuid
|
||||
}
|
||||
|
||||
const getAllTasks = `-- name: GetAllTasks :many
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time FROM task
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id FROM task
|
||||
`
|
||||
|
||||
func (q *Queries) GetAllTasks(ctx context.Context) ([]Task, error) {
|
||||
@ -220,6 +222,7 @@ func (q *Queries) GetAllTasks(ctx context.Context) ([]Task, error) {
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -235,7 +238,7 @@ func (q *Queries) GetAllTasks(ctx context.Context) ([]Task, error) {
|
||||
}
|
||||
|
||||
const getAssignedTasksDueDateForUserID = `-- name: GetAssignedTasksDueDateForUserID :many
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time FROM task_assigned
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time, task.short_id FROM task_assigned
|
||||
INNER JOIN task ON task.task_id = task_assigned.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE user_id = $1
|
||||
@ -279,6 +282,7 @@ func (q *Queries) GetAssignedTasksDueDateForUserID(ctx context.Context, arg GetA
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -294,7 +298,7 @@ func (q *Queries) GetAssignedTasksDueDateForUserID(ctx context.Context, arg GetA
|
||||
}
|
||||
|
||||
const getAssignedTasksProjectForUserID = `-- name: GetAssignedTasksProjectForUserID :many
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time FROM task_assigned
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time, task.short_id FROM task_assigned
|
||||
INNER JOIN task ON task.task_id = task_assigned.task_id
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE user_id = $1
|
||||
@ -338,6 +342,7 @@ func (q *Queries) GetAssignedTasksProjectForUserID(ctx context.Context, arg GetA
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -446,26 +451,27 @@ func (q *Queries) GetProjectIdMappings(ctx context.Context, dollar_1 []uuid.UUID
|
||||
}
|
||||
|
||||
const getProjectInfoForTask = `-- name: GetProjectInfoForTask :one
|
||||
SELECT project.project_id, project.name FROM task
|
||||
SELECT project.short_id AS project_short_id, project.name, task.short_id AS task_short_id FROM task
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
INNER JOIN project ON task_group.project_id = project.project_id
|
||||
WHERE task_id = $1
|
||||
`
|
||||
|
||||
type GetProjectInfoForTaskRow struct {
|
||||
ProjectID uuid.UUID `json:"project_id"`
|
||||
Name string `json:"name"`
|
||||
ProjectShortID string `json:"project_short_id"`
|
||||
Name string `json:"name"`
|
||||
TaskShortID string `json:"task_short_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectInfoForTask(ctx context.Context, taskID uuid.UUID) (GetProjectInfoForTaskRow, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectInfoForTask, taskID)
|
||||
var i GetProjectInfoForTaskRow
|
||||
err := row.Scan(&i.ProjectID, &i.Name)
|
||||
err := row.Scan(&i.ProjectShortID, &i.Name, &i.TaskShortID)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getRecentlyAssignedTaskForUserID = `-- name: GetRecentlyAssignedTaskForUserID :many
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time FROM task_assigned INNER JOIN
|
||||
SELECT task.task_id, task.task_group_id, task.created_at, task.name, task.position, task.description, task.due_date, task.complete, task.completed_at, task.has_time, task.short_id FROM task_assigned INNER JOIN
|
||||
task ON task.task_id = task_assigned.task_id WHERE user_id = $1
|
||||
AND $4::boolean = true OR (
|
||||
$4::boolean = false AND complete = $2 AND (
|
||||
@ -507,6 +513,7 @@ func (q *Queries) GetRecentlyAssignedTaskForUserID(ctx context.Context, arg GetR
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -522,7 +529,7 @@ func (q *Queries) GetRecentlyAssignedTaskForUserID(ctx context.Context, arg GetR
|
||||
}
|
||||
|
||||
const getTaskByID = `-- name: GetTaskByID :one
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time FROM task WHERE task_id = $1
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id FROM task WHERE task_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTaskByID(ctx context.Context, taskID uuid.UUID) (Task, error) {
|
||||
@ -539,10 +546,22 @@ func (q *Queries) GetTaskByID(ctx context.Context, taskID uuid.UUID) (Task, erro
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getTaskIDByShortID = `-- name: GetTaskIDByShortID :one
|
||||
SELECT task_id FROM task WHERE short_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTaskIDByShortID(ctx context.Context, shortID string) (uuid.UUID, error) {
|
||||
row := q.db.QueryRowContext(ctx, getTaskIDByShortID, shortID)
|
||||
var task_id uuid.UUID
|
||||
err := row.Scan(&task_id)
|
||||
return task_id, err
|
||||
}
|
||||
|
||||
const getTaskWatcher = `-- name: GetTaskWatcher :one
|
||||
SELECT task_watcher_id, task_id, user_id, watched_at FROM task_watcher WHERE user_id = $1 AND task_id = $2
|
||||
`
|
||||
@ -565,7 +584,7 @@ func (q *Queries) GetTaskWatcher(ctx context.Context, arg GetTaskWatcherParams)
|
||||
}
|
||||
|
||||
const getTasksForTaskGroupID = `-- name: GetTasksForTaskGroupID :many
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time FROM task WHERE task_group_id = $1
|
||||
SELECT task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id FROM task WHERE task_group_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTasksForTaskGroupID(ctx context.Context, taskGroupID uuid.UUID) ([]Task, error) {
|
||||
@ -588,6 +607,7 @@ func (q *Queries) GetTasksForTaskGroupID(ctx context.Context, taskGroupID uuid.U
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -603,7 +623,7 @@ func (q *Queries) GetTasksForTaskGroupID(ctx context.Context, taskGroupID uuid.U
|
||||
}
|
||||
|
||||
const setTaskComplete = `-- name: SetTaskComplete :one
|
||||
UPDATE task SET complete = $2, completed_at = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET complete = $2, completed_at = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type SetTaskCompleteParams struct {
|
||||
@ -626,6 +646,7 @@ func (q *Queries) SetTaskComplete(ctx context.Context, arg SetTaskCompleteParams
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -656,7 +677,7 @@ func (q *Queries) UpdateTaskComment(ctx context.Context, arg UpdateTaskCommentPa
|
||||
}
|
||||
|
||||
const updateTaskDescription = `-- name: UpdateTaskDescription :one
|
||||
UPDATE task SET description = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET description = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type UpdateTaskDescriptionParams struct {
|
||||
@ -678,12 +699,13 @@ func (q *Queries) UpdateTaskDescription(ctx context.Context, arg UpdateTaskDescr
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateTaskDueDate = `-- name: UpdateTaskDueDate :one
|
||||
UPDATE task SET due_date = $2, has_time = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET due_date = $2, has_time = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type UpdateTaskDueDateParams struct {
|
||||
@ -706,12 +728,13 @@ func (q *Queries) UpdateTaskDueDate(ctx context.Context, arg UpdateTaskDueDatePa
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateTaskLocation = `-- name: UpdateTaskLocation :one
|
||||
UPDATE task SET task_group_id = $2, position = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET task_group_id = $2, position = $3 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type UpdateTaskLocationParams struct {
|
||||
@ -734,12 +757,13 @@ func (q *Queries) UpdateTaskLocation(ctx context.Context, arg UpdateTaskLocation
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateTaskName = `-- name: UpdateTaskName :one
|
||||
UPDATE task SET name = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET name = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type UpdateTaskNameParams struct {
|
||||
@ -761,12 +785,13 @@ func (q *Queries) UpdateTaskName(ctx context.Context, arg UpdateTaskNameParams)
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateTaskPosition = `-- name: UpdateTaskPosition :one
|
||||
UPDATE task SET position = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time
|
||||
UPDATE task SET position = $2 WHERE task_id = $1 RETURNING task_id, task_group_id, created_at, name, position, description, due_date, complete, completed_at, has_time, short_id
|
||||
`
|
||||
|
||||
type UpdateTaskPositionParams struct {
|
||||
@ -788,6 +813,7 @@ func (q *Queries) UpdateTaskPosition(ctx context.Context, arg UpdateTaskPosition
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
&i.ShortID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
@ -359,6 +359,7 @@ type ComplexityRoot struct {
|
||||
Name func(childComplexity int) int
|
||||
Permission func(childComplexity int) int
|
||||
PublicOn func(childComplexity int) int
|
||||
ShortID func(childComplexity int) int
|
||||
TaskGroups func(childComplexity int) int
|
||||
Team func(childComplexity int) int
|
||||
}
|
||||
@ -436,6 +437,7 @@ type ComplexityRoot struct {
|
||||
Labels func(childComplexity int) int
|
||||
Name func(childComplexity int) int
|
||||
Position func(childComplexity int) int
|
||||
ShortID func(childComplexity int) int
|
||||
TaskGroup func(childComplexity int) int
|
||||
Watched func(childComplexity int) int
|
||||
}
|
||||
@ -680,11 +682,9 @@ type QueryResolver interface {
|
||||
Users(ctx context.Context) ([]db.UserAccount, error)
|
||||
InvitedUsers(ctx context.Context) ([]InvitedUserAccount, error)
|
||||
FindUser(ctx context.Context, input FindUser) (*db.UserAccount, error)
|
||||
FindProject(ctx context.Context, input FindProject) (*db.Project, error)
|
||||
FindTask(ctx context.Context, input FindTask) (*db.Task, error)
|
||||
Projects(ctx context.Context, input *ProjectsFilter) ([]db.Project, error)
|
||||
FindTeam(ctx context.Context, input FindTeam) (*db.Team, error)
|
||||
Teams(ctx context.Context) ([]db.Team, error)
|
||||
FindTeam(ctx context.Context, input FindTeam) (*db.Team, error)
|
||||
MyTasks(ctx context.Context, input MyTasks) (*MyTasksPayload, error)
|
||||
LabelColors(ctx context.Context) ([]db.LabelColor, error)
|
||||
TaskGroups(ctx context.Context) ([]db.TaskGroup, error)
|
||||
@ -692,6 +692,8 @@ type QueryResolver interface {
|
||||
Notifications(ctx context.Context) ([]Notified, error)
|
||||
Notified(ctx context.Context, input NotifiedInput) (*NotifiedResult, error)
|
||||
HasUnreadNotifications(ctx context.Context) (*HasUnreadNotificationsResult, error)
|
||||
FindProject(ctx context.Context, input FindProject) (*db.Project, error)
|
||||
FindTask(ctx context.Context, input FindTask) (*db.Task, error)
|
||||
SearchMembers(ctx context.Context, input MemberSearchFilter) ([]MemberSearchResult, error)
|
||||
}
|
||||
type SubscriptionResolver interface {
|
||||
@ -699,6 +701,7 @@ type SubscriptionResolver interface {
|
||||
}
|
||||
type TaskResolver interface {
|
||||
ID(ctx context.Context, obj *db.Task) (uuid.UUID, error)
|
||||
|
||||
TaskGroup(ctx context.Context, obj *db.Task) (*db.TaskGroup, error)
|
||||
|
||||
Description(ctx context.Context, obj *db.Task) (*string, error)
|
||||
@ -2264,6 +2267,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Project.PublicOn(childComplexity), true
|
||||
|
||||
case "Project.shortId":
|
||||
if e.complexity.Project.ShortID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Project.ShortID(childComplexity), true
|
||||
|
||||
case "Project.taskGroups":
|
||||
if e.complexity.Project.TaskGroups == nil {
|
||||
break
|
||||
@ -2654,6 +2664,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Task.Position(childComplexity), true
|
||||
|
||||
case "Task.shortId":
|
||||
if e.complexity.Task.ShortID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Task.ShortID(childComplexity), true
|
||||
|
||||
case "Task.taskGroup":
|
||||
if e.complexity.Task.TaskGroup == nil {
|
||||
break
|
||||
@ -3364,6 +3381,7 @@ type Notified {
|
||||
|
||||
type Project {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
team: Team
|
||||
@ -3503,6 +3521,15 @@ type UpdateProjectMemberRolePayload {
|
||||
member: Member!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
findProject(input: FindProject!): Project!
|
||||
}
|
||||
|
||||
input FindProject {
|
||||
projectID: UUID
|
||||
projectShortID: String
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createProject(input: NewProject!): Project! @hasRole(roles: [ADMIN], level: TEAM, type: TEAM)
|
||||
deleteProject(input: DeleteProject!):
|
||||
@ -3618,12 +3645,9 @@ type Query {
|
||||
users: [UserAccount!]!
|
||||
invitedUsers: [InvitedUserAccount!]!
|
||||
findUser(input: FindUser!): UserAccount!
|
||||
findProject(input: FindProject!):
|
||||
Project!
|
||||
findTask(input: FindTask!): Task!
|
||||
projects(input: ProjectsFilter): [Project!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
teams: [Team!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
myTasks(input: MyTasks!): MyTasksPayload!
|
||||
labelColors: [LabelColor!]!
|
||||
taskGroups: [TaskGroup!]!
|
||||
@ -3691,13 +3715,6 @@ input FindUser {
|
||||
userID: UUID!
|
||||
}
|
||||
|
||||
input FindProject {
|
||||
projectID: UUID!
|
||||
}
|
||||
|
||||
input FindTask {
|
||||
taskID: UUID!
|
||||
}
|
||||
|
||||
input FindTeam {
|
||||
teamID: UUID!
|
||||
@ -3727,6 +3744,7 @@ type TaskBadges {
|
||||
|
||||
type Task {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
taskGroup: TaskGroup!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
@ -4042,6 +4060,16 @@ type ToggleTaskLabelPayload {
|
||||
task: Task!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
findTask(input: FindTask!): Task!
|
||||
}
|
||||
|
||||
input FindTask {
|
||||
taskID: UUID
|
||||
taskShortID: String
|
||||
}
|
||||
|
||||
|
||||
extend type Mutation {
|
||||
createTask(input: NewTask!):
|
||||
Task! @hasRole(roles: [ADMIN, MEMBER], level: PROJECT, type: TASK_GROUP)
|
||||
@ -13300,6 +13328,41 @@ func (ec *executionContext) _Project_id(ctx context.Context, field graphql.Colle
|
||||
return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Project_shortId(ctx context.Context, field graphql.CollectedField, obj *db.Project) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Project",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.ShortID, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Project_createdAt(ctx context.Context, field graphql.CollectedField, obj *db.Project) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -14138,90 +14201,6 @@ func (ec *executionContext) _Query_findUser(ctx context.Context, field graphql.C
|
||||
return ec.marshalNUserAccount2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐUserAccount(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_findProject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
rawArgs := field.ArgumentMap(ec.Variables)
|
||||
args, err := ec.field_Query_findProject_args(ctx, rawArgs)
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
fc.Args = args
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().FindProject(rctx, args["input"].(FindProject))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*db.Project)
|
||||
fc.Result = res
|
||||
return ec.marshalNProject2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐProject(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_findTask(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
rawArgs := field.ArgumentMap(ec.Variables)
|
||||
args, err := ec.field_Query_findTask_args(ctx, rawArgs)
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
fc.Args = args
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().FindTask(rctx, args["input"].(FindTask))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*db.Task)
|
||||
fc.Result = res
|
||||
return ec.marshalNTask2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTask(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_projects(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -14264,6 +14243,41 @@ func (ec *executionContext) _Query_projects(ctx context.Context, field graphql.C
|
||||
return ec.marshalNProject2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐProjectᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().Teams(rctx)
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.([]db.Team)
|
||||
fc.Result = res
|
||||
return ec.marshalNTeam2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTeamᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_findTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -14306,41 +14320,6 @@ func (ec *executionContext) _Query_findTeam(ctx context.Context, field graphql.C
|
||||
return ec.marshalNTeam2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTeam(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().Teams(rctx)
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.([]db.Team)
|
||||
fc.Result = res
|
||||
return ec.marshalNTeam2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTeamᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_myTasks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -14597,6 +14576,90 @@ func (ec *executionContext) _Query_hasUnreadNotifications(ctx context.Context, f
|
||||
return ec.marshalNHasUnreadNotificationsResult2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐHasUnreadNotificationsResult(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_findProject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
rawArgs := field.ArgumentMap(ec.Variables)
|
||||
args, err := ec.field_Query_findProject_args(ctx, rawArgs)
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
fc.Args = args
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().FindProject(rctx, args["input"].(FindProject))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*db.Project)
|
||||
fc.Result = res
|
||||
return ec.marshalNProject2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐProject(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_findTask(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
rawArgs := field.ArgumentMap(ec.Variables)
|
||||
args, err := ec.field_Query_findTask_args(ctx, rawArgs)
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
fc.Args = args
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.Query().FindTask(rctx, args["input"].(FindTask))
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*db.Task)
|
||||
fc.Result = res
|
||||
return ec.marshalNTask2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTask(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_searchMembers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -14930,6 +14993,41 @@ func (ec *executionContext) _Task_id(ctx context.Context, field graphql.Collecte
|
||||
return ec.marshalNID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Task_shortId(ctx context.Context, field graphql.CollectedField, obj *db.Task) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Task",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.ShortID, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(string)
|
||||
fc.Result = res
|
||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Task_taskGroup(ctx context.Context, field graphql.CollectedField, obj *db.Task) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -19707,7 +19805,15 @@ func (ec *executionContext) unmarshalInputFindProject(ctx context.Context, obj i
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectID"))
|
||||
it.ProjectID, err = ec.unmarshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v)
|
||||
it.ProjectID, err = ec.unmarshalOUUID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "projectShortID":
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("projectShortID"))
|
||||
it.ProjectShortID, err = ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
@ -19727,7 +19833,15 @@ func (ec *executionContext) unmarshalInputFindTask(ctx context.Context, obj inte
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("taskID"))
|
||||
it.TaskID, err = ec.unmarshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v)
|
||||
it.TaskID, err = ec.unmarshalOUUID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "taskShortID":
|
||||
var err error
|
||||
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("taskShortID"))
|
||||
it.TaskShortID, err = ec.unmarshalOString2ᚖstring(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
@ -22875,6 +22989,11 @@ func (ec *executionContext) _Project(ctx context.Context, sel ast.SelectionSet,
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "shortId":
|
||||
out.Values[i] = ec._Project_shortId(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
case "createdAt":
|
||||
out.Values[i] = ec._Project_createdAt(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
@ -23226,34 +23345,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findProject":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findProject(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findTask":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findTask(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "projects":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
@ -23268,20 +23359,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findTeam":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findTeam(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "teams":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
@ -23296,6 +23373,20 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findTeam":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findTeam(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "myTasks":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
@ -23391,6 +23482,34 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findProject":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findProject(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "findTask":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._Query_findTask(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "searchMembers":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
@ -23529,6 +23648,11 @@ func (ec *executionContext) _Task(ctx context.Context, sel ast.SelectionSet, obj
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "shortId":
|
||||
out.Values[i] = ec._Task_shortId(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
case "taskGroup":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
|
@ -215,11 +215,13 @@ type DuplicateTaskGroupPayload struct {
|
||||
}
|
||||
|
||||
type FindProject struct {
|
||||
ProjectID uuid.UUID `json:"projectID"`
|
||||
ProjectID *uuid.UUID `json:"projectID"`
|
||||
ProjectShortID *string `json:"projectShortID"`
|
||||
}
|
||||
|
||||
type FindTask struct {
|
||||
TaskID uuid.UUID `json:"taskID"`
|
||||
TaskID *uuid.UUID `json:"taskID"`
|
||||
TaskShortID *string `json:"taskShortID"`
|
||||
}
|
||||
|
||||
type FindTeam struct {
|
||||
|
@ -392,6 +392,39 @@ func (r *projectLabelResolver) Name(ctx context.Context, obj *db.ProjectLabel) (
|
||||
return name, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindProject(ctx context.Context, input FindProject) (*db.Project, error) {
|
||||
_, isLoggedIn := GetUser(ctx)
|
||||
var projectID uuid.UUID
|
||||
var err error
|
||||
if input.ProjectID != nil {
|
||||
projectID = *input.ProjectID
|
||||
} else if input.ProjectShortID != nil {
|
||||
projectID, err = r.Repository.GetProjectIDByShortID(ctx, *input.ProjectShortID)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error while getting project id by short id")
|
||||
return &db.Project{}, err
|
||||
}
|
||||
} else {
|
||||
return &db.Project{}, errors.New("FindProject requires either ProjectID or ProjectShortID to be set")
|
||||
}
|
||||
if !isLoggedIn {
|
||||
isPublic, _ := IsProjectPublic(ctx, r.Repository, projectID)
|
||||
if !isPublic {
|
||||
return &db.Project{}, NotAuthorized()
|
||||
}
|
||||
}
|
||||
project, err := r.Repository.GetProjectByID(ctx, projectID)
|
||||
if err == sql.ErrNoRows {
|
||||
return &db.Project{}, &gqlerror.Error{
|
||||
Message: "Project not found",
|
||||
Extensions: map[string]interface{}{
|
||||
"code": "NOT_FOUND",
|
||||
},
|
||||
}
|
||||
}
|
||||
return &project, nil
|
||||
}
|
||||
|
||||
// LabelColor returns LabelColorResolver implementation.
|
||||
func (r *Resolver) LabelColor() LabelColorResolver { return &labelColorResolver{r} }
|
||||
|
||||
|
@ -61,31 +61,6 @@ func (r *queryResolver) FindUser(ctx context.Context, input FindUser) (*db.UserA
|
||||
return &account, err
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindProject(ctx context.Context, input FindProject) (*db.Project, error) {
|
||||
_, isLoggedIn := GetUser(ctx)
|
||||
if !isLoggedIn {
|
||||
isPublic, _ := IsProjectPublic(ctx, r.Repository, input.ProjectID)
|
||||
if !isPublic {
|
||||
return &db.Project{}, NotAuthorized()
|
||||
}
|
||||
}
|
||||
project, err := r.Repository.GetProjectByID(ctx, input.ProjectID)
|
||||
if err == sql.ErrNoRows {
|
||||
return &db.Project{}, &gqlerror.Error{
|
||||
Message: "Project not found",
|
||||
Extensions: map[string]interface{}{
|
||||
"code": "NOT_FOUND",
|
||||
},
|
||||
}
|
||||
}
|
||||
return &project, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindTask(ctx context.Context, input FindTask) (*db.Task, error) {
|
||||
task, err := r.Repository.GetTaskByID(ctx, input.TaskID)
|
||||
return &task, err
|
||||
}
|
||||
|
||||
func (r *queryResolver) Projects(ctx context.Context, input *ProjectsFilter) ([]db.Project, error) {
|
||||
userID, ok := GetUser(ctx)
|
||||
if !ok {
|
||||
@ -137,14 +112,6 @@ func (r *queryResolver) Projects(ctx context.Context, input *ProjectsFilter) ([]
|
||||
return allProjects, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindTeam(ctx context.Context, input FindTeam) (*db.Team, error) {
|
||||
team, err := r.Repository.GetTeamByID(ctx, input.TeamID)
|
||||
if err != nil {
|
||||
return &db.Team{}, err
|
||||
}
|
||||
return &team, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) Teams(ctx context.Context) ([]db.Team, error) {
|
||||
userID, ok := GetUser(ctx)
|
||||
if !ok {
|
||||
@ -190,6 +157,14 @@ func (r *queryResolver) Teams(ctx context.Context) ([]db.Team, error) {
|
||||
return foundTeams, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindTeam(ctx context.Context, input FindTeam) (*db.Team, error) {
|
||||
team, err := r.Repository.GetTeamByID(ctx, input.TeamID)
|
||||
if err != nil {
|
||||
return &db.Team{}, err
|
||||
}
|
||||
return &team, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) MyTasks(ctx context.Context, input MyTasks) (*MyTasksPayload, error) {
|
||||
userID, _ := GetUserID(ctx)
|
||||
projects := []ProjectTaskMapping{}
|
||||
|
@ -6,6 +6,7 @@ type ProjectPermission {
|
||||
|
||||
type Project {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
team: Team
|
||||
@ -145,6 +146,15 @@ type UpdateProjectMemberRolePayload {
|
||||
member: Member!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
findProject(input: FindProject!): Project!
|
||||
}
|
||||
|
||||
input FindProject {
|
||||
projectID: UUID
|
||||
projectShortID: String
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createProject(input: NewProject!): Project! @hasRole(roles: [ADMIN], level: TEAM, type: TEAM)
|
||||
deleteProject(input: DeleteProject!):
|
||||
|
@ -6,6 +6,7 @@ type ProjectPermission {
|
||||
|
||||
type Project {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
team: Team
|
||||
|
@ -1,3 +1,12 @@
|
||||
extend type Query {
|
||||
findProject(input: FindProject!): Project!
|
||||
}
|
||||
|
||||
input FindProject {
|
||||
projectID: UUID
|
||||
projectShortID: String
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createProject(input: NewProject!): Project! @hasRole(roles: [ADMIN], level: TEAM, type: TEAM)
|
||||
deleteProject(input: DeleteProject!):
|
||||
|
@ -75,12 +75,9 @@ type Query {
|
||||
users: [UserAccount!]!
|
||||
invitedUsers: [InvitedUserAccount!]!
|
||||
findUser(input: FindUser!): UserAccount!
|
||||
findProject(input: FindProject!):
|
||||
Project!
|
||||
findTask(input: FindTask!): Task!
|
||||
projects(input: ProjectsFilter): [Project!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
teams: [Team!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
myTasks(input: MyTasks!): MyTasksPayload!
|
||||
labelColors: [LabelColor!]!
|
||||
taskGroups: [TaskGroup!]!
|
||||
@ -148,13 +145,6 @@ input FindUser {
|
||||
userID: UUID!
|
||||
}
|
||||
|
||||
input FindProject {
|
||||
projectID: UUID!
|
||||
}
|
||||
|
||||
input FindTask {
|
||||
taskID: UUID!
|
||||
}
|
||||
|
||||
input FindTeam {
|
||||
teamID: UUID!
|
||||
|
@ -22,6 +22,7 @@ type TaskBadges {
|
||||
|
||||
type Task {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
taskGroup: TaskGroup!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
@ -337,6 +338,16 @@ type ToggleTaskLabelPayload {
|
||||
task: Task!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
findTask(input: FindTask!): Task!
|
||||
}
|
||||
|
||||
input FindTask {
|
||||
taskID: UUID
|
||||
taskShortID: String
|
||||
}
|
||||
|
||||
|
||||
extend type Mutation {
|
||||
createTask(input: NewTask!):
|
||||
Task! @hasRole(roles: [ADMIN, MEMBER], level: PROJECT, type: TASK_GROUP)
|
||||
|
@ -22,6 +22,7 @@ type TaskBadges {
|
||||
|
||||
type Task {
|
||||
id: ID!
|
||||
shortId: String!
|
||||
taskGroup: TaskGroup!
|
||||
createdAt: Time!
|
||||
name: String!
|
||||
|
@ -1,3 +1,13 @@
|
||||
extend type Query {
|
||||
findTask(input: FindTask!): Task!
|
||||
}
|
||||
|
||||
input FindTask {
|
||||
taskID: UUID
|
||||
taskShortID: String
|
||||
}
|
||||
|
||||
|
||||
extend type Mutation {
|
||||
createTask(input: NewTask!):
|
||||
Task! @hasRole(roles: [ADMIN, MEMBER], level: PROJECT, type: TASK_GROUP)
|
||||
|
@ -635,9 +635,9 @@ func (r *mutationResolver) AssignTask(ctx context.Context, input *AssignTaskInpu
|
||||
Data: map[string]string{
|
||||
"CausedByUsername": causedBy.Username,
|
||||
"CausedByFullName": causedBy.FullName,
|
||||
"TaskID": assignedTask.TaskID.String(),
|
||||
"TaskID": project.TaskShortID,
|
||||
"TaskName": task.Name,
|
||||
"ProjectID": project.ProjectID.String(),
|
||||
"ProjectID": project.ProjectShortID,
|
||||
"ProjectName": project.Name,
|
||||
},
|
||||
})
|
||||
@ -670,6 +670,23 @@ func (r *mutationResolver) UnassignTask(ctx context.Context, input *UnassignTask
|
||||
return &task, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) FindTask(ctx context.Context, input FindTask) (*db.Task, error) {
|
||||
var taskID uuid.UUID
|
||||
var err error
|
||||
if input.TaskID != nil {
|
||||
taskID = *input.TaskID
|
||||
} else if input.TaskShortID != nil {
|
||||
taskID, err = r.Repository.GetTaskIDByShortID(ctx, *input.TaskShortID)
|
||||
if err != nil {
|
||||
return &db.Task{}, err
|
||||
}
|
||||
} else {
|
||||
return &db.Task{}, errors.New("FindTask requires either TaskID or TaskShortID to be set")
|
||||
}
|
||||
task, err := r.Repository.GetTaskByID(ctx, taskID)
|
||||
return &task, err
|
||||
}
|
||||
|
||||
func (r *taskResolver) ID(ctx context.Context, obj *db.Task) (uuid.UUID, error) {
|
||||
return obj.TaskID, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user