feat: add my tasks list view
This commit is contained in:
@ -69,6 +69,8 @@ type Querier interface {
|
||||
GetAllUserAccounts(ctx context.Context) ([]UserAccount, error)
|
||||
GetAllVisibleProjectsForUserID(ctx context.Context, userID uuid.UUID) ([]Project, error)
|
||||
GetAssignedMembersForTask(ctx context.Context, taskID uuid.UUID) ([]TaskAssigned, error)
|
||||
GetAssignedTasksDueDateForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error)
|
||||
GetAssignedTasksProjectForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error)
|
||||
GetCommentsForTaskID(ctx context.Context, taskID uuid.UUID) ([]TaskComment, error)
|
||||
GetConfirmTokenByEmail(ctx context.Context, email string) (UserAccountConfirmToken, error)
|
||||
GetConfirmTokenByID(ctx context.Context, confirmTokenID uuid.UUID) (UserAccountConfirmToken, error)
|
||||
@ -90,12 +92,14 @@ type Querier interface {
|
||||
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)
|
||||
GetProjectIdMappings(ctx context.Context, dollar_1 []uuid.UUID) ([]GetProjectIdMappingsRow, error)
|
||||
GetProjectLabelByID(ctx context.Context, projectLabelID uuid.UUID) (ProjectLabel, error)
|
||||
GetProjectLabelsForProject(ctx context.Context, projectID uuid.UUID) ([]ProjectLabel, error)
|
||||
GetProjectMemberInvitedIDByEmail(ctx context.Context, email string) (GetProjectMemberInvitedIDByEmailRow, error)
|
||||
GetProjectMembersForProjectID(ctx context.Context, projectID uuid.UUID) ([]ProjectMember, error)
|
||||
GetProjectRolesForUserID(ctx context.Context, userID uuid.UUID) ([]GetProjectRolesForUserIDRow, error)
|
||||
GetProjectsForInvitedMember(ctx context.Context, email string) ([]uuid.UUID, error)
|
||||
GetRecentlyAssignedTaskForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error)
|
||||
GetRefreshTokenByID(ctx context.Context, tokenID uuid.UUID) (RefreshToken, error)
|
||||
GetRoleForProjectMemberByUserID(ctx context.Context, arg GetRoleForProjectMemberByUserIDParams) (Role, error)
|
||||
GetRoleForTeamMember(ctx context.Context, arg GetRoleForTeamMemberParams) (Role, error)
|
||||
|
@ -56,3 +56,26 @@ DELETE FROM task_comment WHERE task_comment_id = $1 RETURNING *;
|
||||
|
||||
-- name: UpdateTaskComment :one
|
||||
UPDATE task_comment SET message = $2, updated_at = $3 WHERE task_comment_id = $1 RETURNING *;
|
||||
|
||||
-- name: GetRecentlyAssignedTaskForUserID :many
|
||||
SELECT task.* FROM task_assigned INNER JOIN
|
||||
task ON task.task_id = task_assigned.task_id WHERE user_id = $1 ORDER BY task_assigned.assigned_date DESC;
|
||||
|
||||
-- name: GetAssignedTasksProjectForUserID :many
|
||||
SELECT task.* 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
|
||||
ORDER BY task_group.project_id DESC, task_assigned.assigned_date DESC;
|
||||
|
||||
-- name: GetProjectIdMappings :many
|
||||
SELECT project_id, task_id FROM task
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE task_id = ANY($1::uuid[]);
|
||||
|
||||
-- name: GetAssignedTasksDueDateForUserID :many
|
||||
SELECT task.* 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
|
||||
ORDER BY task.due_date DESC, task_group.project_id DESC;
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
const createTask = `-- name: CreateTask :one
|
||||
@ -197,6 +198,90 @@ func (q *Queries) GetAllTasks(ctx context.Context) ([]Task, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
ORDER BY task.due_date DESC, task_group.project_id DESC
|
||||
`
|
||||
|
||||
func (q *Queries) GetAssignedTasksDueDateForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getAssignedTasksDueDateForUserID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Task
|
||||
for rows.Next() {
|
||||
var i Task
|
||||
if err := rows.Scan(
|
||||
&i.TaskID,
|
||||
&i.TaskGroupID,
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.Position,
|
||||
&i.Description,
|
||||
&i.DueDate,
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
ORDER BY task_group.project_id DESC, task_assigned.assigned_date DESC
|
||||
`
|
||||
|
||||
func (q *Queries) GetAssignedTasksProjectForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getAssignedTasksProjectForUserID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Task
|
||||
for rows.Next() {
|
||||
var i Task
|
||||
if err := rows.Scan(
|
||||
&i.TaskID,
|
||||
&i.TaskGroupID,
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.Position,
|
||||
&i.Description,
|
||||
&i.DueDate,
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getCommentsForTaskID = `-- name: GetCommentsForTaskID :many
|
||||
SELECT task_comment_id, task_id, created_at, updated_at, created_by, pinned, message FROM task_comment WHERE task_id = $1 ORDER BY created_at
|
||||
`
|
||||
@ -245,6 +330,79 @@ func (q *Queries) GetProjectIDForTask(ctx context.Context, taskID uuid.UUID) (uu
|
||||
return project_id, err
|
||||
}
|
||||
|
||||
const getProjectIdMappings = `-- name: GetProjectIdMappings :many
|
||||
SELECT project_id, task_id FROM task
|
||||
INNER JOIN task_group ON task_group.task_group_id = task.task_group_id
|
||||
WHERE task_id = ANY($1::uuid[])
|
||||
`
|
||||
|
||||
type GetProjectIdMappingsRow struct {
|
||||
ProjectID uuid.UUID `json:"project_id"`
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectIdMappings(ctx context.Context, dollar_1 []uuid.UUID) ([]GetProjectIdMappingsRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getProjectIdMappings, pq.Array(dollar_1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetProjectIdMappingsRow
|
||||
for rows.Next() {
|
||||
var i GetProjectIdMappingsRow
|
||||
if err := rows.Scan(&i.ProjectID, &i.TaskID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
task ON task.task_id = task_assigned.task_id WHERE user_id = $1 ORDER BY task_assigned.assigned_date DESC
|
||||
`
|
||||
|
||||
func (q *Queries) GetRecentlyAssignedTaskForUserID(ctx context.Context, userID uuid.UUID) ([]Task, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getRecentlyAssignedTaskForUserID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Task
|
||||
for rows.Next() {
|
||||
var i Task
|
||||
if err := rows.Scan(
|
||||
&i.TaskID,
|
||||
&i.TaskGroupID,
|
||||
&i.CreatedAt,
|
||||
&i.Name,
|
||||
&i.Position,
|
||||
&i.Description,
|
||||
&i.DueDate,
|
||||
&i.Complete,
|
||||
&i.CompletedAt,
|
||||
&i.HasTime,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
`
|
||||
@ -334,7 +492,7 @@ func (q *Queries) SetTaskComplete(ctx context.Context, arg SetTaskCompleteParams
|
||||
}
|
||||
|
||||
const updateTaskComment = `-- name: UpdateTaskComment :one
|
||||
UPDATE task_comment SET message = $2, updated_at = COALESCE($3, updated_at) WHERE task_comment_id = $1 RETURNING task_comment_id, task_id, created_at, updated_at, created_by, pinned, message
|
||||
UPDATE task_comment SET message = $2, updated_at = $3 WHERE task_comment_id = $1 RETURNING task_comment_id, task_id, created_at, updated_at, created_by, pinned, message
|
||||
`
|
||||
|
||||
type UpdateTaskCommentParams struct {
|
||||
|
@ -273,6 +273,11 @@ type ComplexityRoot struct {
|
||||
UpdateUserRole func(childComplexity int, input UpdateUserRole) int
|
||||
}
|
||||
|
||||
MyTasksPayload struct {
|
||||
Projects func(childComplexity int) int
|
||||
Tasks func(childComplexity int) int
|
||||
}
|
||||
|
||||
Notification struct {
|
||||
ActionType func(childComplexity int) int
|
||||
Actor func(childComplexity int) int
|
||||
@ -338,6 +343,11 @@ type ComplexityRoot struct {
|
||||
RoleCode func(childComplexity int) int
|
||||
}
|
||||
|
||||
ProjectTaskMapping struct {
|
||||
ProjectID func(childComplexity int) int
|
||||
TaskID func(childComplexity int) int
|
||||
}
|
||||
|
||||
Query struct {
|
||||
FindProject func(childComplexity int, input FindProject) int
|
||||
FindTask func(childComplexity int, input FindTask) int
|
||||
@ -346,6 +356,7 @@ type ComplexityRoot struct {
|
||||
InvitedUsers func(childComplexity int) int
|
||||
LabelColors func(childComplexity int) int
|
||||
Me func(childComplexity int) int
|
||||
MyTasks func(childComplexity int, input MyTasks) int
|
||||
Notifications func(childComplexity int) int
|
||||
Organizations func(childComplexity int) int
|
||||
Projects func(childComplexity int, input *ProjectsFilter) int
|
||||
@ -622,6 +633,7 @@ type QueryResolver interface {
|
||||
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)
|
||||
MyTasks(ctx context.Context, input MyTasks) (*MyTasksPayload, error)
|
||||
LabelColors(ctx context.Context) ([]db.LabelColor, error)
|
||||
TaskGroups(ctx context.Context) ([]db.TaskGroup, error)
|
||||
Me(ctx context.Context) (*MePayload, error)
|
||||
@ -1878,6 +1890,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Mutation.UpdateUserRole(childComplexity, args["input"].(UpdateUserRole)), true
|
||||
|
||||
case "MyTasksPayload.projects":
|
||||
if e.complexity.MyTasksPayload.Projects == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.MyTasksPayload.Projects(childComplexity), true
|
||||
|
||||
case "MyTasksPayload.tasks":
|
||||
if e.complexity.MyTasksPayload.Tasks == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.MyTasksPayload.Tasks(childComplexity), true
|
||||
|
||||
case "Notification.actionType":
|
||||
if e.complexity.Notification.ActionType == nil {
|
||||
break
|
||||
@ -2123,6 +2149,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.ProjectRole.RoleCode(childComplexity), true
|
||||
|
||||
case "ProjectTaskMapping.projectID":
|
||||
if e.complexity.ProjectTaskMapping.ProjectID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.ProjectTaskMapping.ProjectID(childComplexity), true
|
||||
|
||||
case "ProjectTaskMapping.taskID":
|
||||
if e.complexity.ProjectTaskMapping.TaskID == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.ProjectTaskMapping.TaskID(childComplexity), true
|
||||
|
||||
case "Query.findProject":
|
||||
if e.complexity.Query.FindProject == nil {
|
||||
break
|
||||
@ -2192,6 +2232,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
||||
|
||||
return e.complexity.Query.Me(childComplexity), true
|
||||
|
||||
case "Query.myTasks":
|
||||
if e.complexity.Query.MyTasks == nil {
|
||||
break
|
||||
}
|
||||
|
||||
args, err := ec.field_Query_myTasks_args(context.TODO(), rawArgs)
|
||||
if err != nil {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
return e.complexity.Query.MyTasks(childComplexity, args["input"].(MyTasks)), true
|
||||
|
||||
case "Query.notifications":
|
||||
if e.complexity.Query.Notifications == nil {
|
||||
break
|
||||
@ -3229,13 +3281,47 @@ type Query {
|
||||
projects(input: ProjectsFilter): [Project!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
teams: [Team!]!
|
||||
myTasks(input: MyTasks!): MyTasksPayload!
|
||||
labelColors: [LabelColor!]!
|
||||
taskGroups: [TaskGroup!]!
|
||||
me: MePayload!
|
||||
}
|
||||
|
||||
|
||||
type Mutation
|
||||
|
||||
enum MyTasksStatus {
|
||||
ALL
|
||||
INCOMPLETE
|
||||
COMPLETE_ALL
|
||||
COMPLETE_TODAY
|
||||
COMPLETE_YESTERDAY
|
||||
COMPLETE_ONE_WEEK
|
||||
COMPLETE_TWO_WEEK
|
||||
COMPLETE_THREE_WEEK
|
||||
}
|
||||
|
||||
enum MyTasksSort {
|
||||
NONE
|
||||
PROJECT
|
||||
DUE_DATE
|
||||
}
|
||||
|
||||
input MyTasks {
|
||||
status: MyTasksStatus!
|
||||
sort: MyTasksSort!
|
||||
}
|
||||
|
||||
type ProjectTaskMapping {
|
||||
projectID: UUID!
|
||||
taskID: UUID!
|
||||
}
|
||||
|
||||
type MyTasksPayload {
|
||||
tasks: [Task!]!
|
||||
projects: [ProjectTaskMapping!]!
|
||||
}
|
||||
|
||||
type TeamRole {
|
||||
teamID: UUID!
|
||||
roleCode: RoleCode!
|
||||
@ -3462,6 +3548,7 @@ input NewTask {
|
||||
taskGroupID: UUID!
|
||||
name: String!
|
||||
position: Float!
|
||||
assigned: [UUID!]
|
||||
}
|
||||
|
||||
input AssignTaskInput {
|
||||
@ -4806,6 +4893,20 @@ func (ec *executionContext) field_Query_findUser_args(ctx context.Context, rawAr
|
||||
return args, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) field_Query_myTasks_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||
var err error
|
||||
args := map[string]interface{}{}
|
||||
var arg0 MyTasks
|
||||
if tmp, ok := rawArgs["input"]; ok {
|
||||
arg0, err = ec.unmarshalNMyTasks2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasks(ctx, tmp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
args["input"] = arg0
|
||||
return args, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) field_Query_projects_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||
var err error
|
||||
args := map[string]interface{}{}
|
||||
@ -11270,6 +11371,74 @@ func (ec *executionContext) _Mutation_updateUserInfo(ctx context.Context, field
|
||||
return ec.marshalNUpdateUserInfoPayload2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐUpdateUserInfoPayload(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MyTasksPayload_tasks(ctx context.Context, field graphql.CollectedField, obj *MyTasksPayload) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "MyTasksPayload",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: 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.Tasks, 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.([]db.Task)
|
||||
fc.Result = res
|
||||
return ec.marshalNTask2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐTaskᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _MyTasksPayload_projects(ctx context.Context, field graphql.CollectedField, obj *MyTasksPayload) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "MyTasksPayload",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: 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.Projects, 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.([]ProjectTaskMapping)
|
||||
fc.Result = res
|
||||
return ec.marshalNProjectTaskMapping2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐProjectTaskMappingᚄ(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Notification_id(ctx context.Context, field graphql.CollectedField, obj *db.Notification) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -12445,6 +12614,74 @@ func (ec *executionContext) _ProjectRole_roleCode(ctx context.Context, field gra
|
||||
return ec.marshalNRoleCode2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐRoleCode(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _ProjectTaskMapping_projectID(ctx context.Context, field graphql.CollectedField, obj *ProjectTaskMapping) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "ProjectTaskMapping",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: 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.ProjectID, 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.(uuid.UUID)
|
||||
fc.Result = res
|
||||
return ec.marshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _ProjectTaskMapping_taskID(ctx context.Context, field graphql.CollectedField, obj *ProjectTaskMapping) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "ProjectTaskMapping",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: 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.TaskID, 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.(uuid.UUID)
|
||||
fc.Result = res
|
||||
return ec.marshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_organizations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -12818,6 +13055,47 @@ func (ec *executionContext) _Query_teams(ctx context.Context, field graphql.Coll
|
||||
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 {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
fc := &graphql.FieldContext{
|
||||
Object: "Query",
|
||||
Field: field,
|
||||
Args: nil,
|
||||
IsMethod: true,
|
||||
}
|
||||
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
rawArgs := field.ArgumentMap(ec.Variables)
|
||||
args, err := ec.field_Query_myTasks_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().MyTasks(rctx, args["input"].(MyTasks))
|
||||
})
|
||||
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.(*MyTasksPayload)
|
||||
fc.Result = res
|
||||
return ec.marshalNMyTasksPayload2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksPayload(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Query_labelColors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@ -17902,6 +18180,30 @@ func (ec *executionContext) unmarshalInputMemberSearchFilter(ctx context.Context
|
||||
return it, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalInputMyTasks(ctx context.Context, obj interface{}) (MyTasks, error) {
|
||||
var it MyTasks
|
||||
var asMap = obj.(map[string]interface{})
|
||||
|
||||
for k, v := range asMap {
|
||||
switch k {
|
||||
case "status":
|
||||
var err error
|
||||
it.Status, err = ec.unmarshalNMyTasksStatus2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksStatus(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "sort":
|
||||
var err error
|
||||
it.Sort, err = ec.unmarshalNMyTasksSort2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksSort(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return it, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalInputNewProject(ctx context.Context, obj interface{}) (NewProject, error) {
|
||||
var it NewProject
|
||||
var asMap = obj.(map[string]interface{})
|
||||
@ -17998,6 +18300,12 @@ func (ec *executionContext) unmarshalInputNewTask(ctx context.Context, obj inter
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "assigned":
|
||||
var err error
|
||||
it.Assigned, err = ec.unmarshalOUUID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20086,6 +20394,38 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
|
||||
return out
|
||||
}
|
||||
|
||||
var myTasksPayloadImplementors = []string{"MyTasksPayload"}
|
||||
|
||||
func (ec *executionContext) _MyTasksPayload(ctx context.Context, sel ast.SelectionSet, obj *MyTasksPayload) graphql.Marshaler {
|
||||
fields := graphql.CollectFields(ec.OperationContext, sel, myTasksPayloadImplementors)
|
||||
|
||||
out := graphql.NewFieldSet(fields)
|
||||
var invalids uint32
|
||||
for i, field := range fields {
|
||||
switch field.Name {
|
||||
case "__typename":
|
||||
out.Values[i] = graphql.MarshalString("MyTasksPayload")
|
||||
case "tasks":
|
||||
out.Values[i] = ec._MyTasksPayload_tasks(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "projects":
|
||||
out.Values[i] = ec._MyTasksPayload_projects(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
default:
|
||||
panic("unknown field " + strconv.Quote(field.Name))
|
||||
}
|
||||
}
|
||||
out.Dispatch()
|
||||
if invalids > 0 {
|
||||
return graphql.Null
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
var notificationImplementors = []string{"Notification"}
|
||||
|
||||
func (ec *executionContext) _Notification(ctx context.Context, sel ast.SelectionSet, obj *db.Notification) graphql.Marshaler {
|
||||
@ -20601,6 +20941,38 @@ func (ec *executionContext) _ProjectRole(ctx context.Context, sel ast.SelectionS
|
||||
return out
|
||||
}
|
||||
|
||||
var projectTaskMappingImplementors = []string{"ProjectTaskMapping"}
|
||||
|
||||
func (ec *executionContext) _ProjectTaskMapping(ctx context.Context, sel ast.SelectionSet, obj *ProjectTaskMapping) graphql.Marshaler {
|
||||
fields := graphql.CollectFields(ec.OperationContext, sel, projectTaskMappingImplementors)
|
||||
|
||||
out := graphql.NewFieldSet(fields)
|
||||
var invalids uint32
|
||||
for i, field := range fields {
|
||||
switch field.Name {
|
||||
case "__typename":
|
||||
out.Values[i] = graphql.MarshalString("ProjectTaskMapping")
|
||||
case "projectID":
|
||||
out.Values[i] = ec._ProjectTaskMapping_projectID(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
case "taskID":
|
||||
out.Values[i] = ec._ProjectTaskMapping_taskID(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
invalids++
|
||||
}
|
||||
default:
|
||||
panic("unknown field " + strconv.Quote(field.Name))
|
||||
}
|
||||
}
|
||||
out.Dispatch()
|
||||
if invalids > 0 {
|
||||
return graphql.Null
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
var queryImplementors = []string{"Query"}
|
||||
|
||||
func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
|
||||
@ -20742,6 +21114,20 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "myTasks":
|
||||
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_myTasks(ctx, field)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&invalids, 1)
|
||||
}
|
||||
return res
|
||||
})
|
||||
case "labelColors":
|
||||
field := field
|
||||
out.Concurrently(i, func() (res graphql.Marshaler) {
|
||||
@ -23147,6 +23533,42 @@ func (ec *executionContext) marshalNMemberSearchResult2ᚕgithubᚗcomᚋjordank
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNMyTasks2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasks(ctx context.Context, v interface{}) (MyTasks, error) {
|
||||
return ec.unmarshalInputMyTasks(ctx, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNMyTasksPayload2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksPayload(ctx context.Context, sel ast.SelectionSet, v MyTasksPayload) graphql.Marshaler {
|
||||
return ec._MyTasksPayload(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNMyTasksPayload2ᚖgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksPayload(ctx context.Context, sel ast.SelectionSet, v *MyTasksPayload) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
return ec._MyTasksPayload(ctx, sel, v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNMyTasksSort2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksSort(ctx context.Context, v interface{}) (MyTasksSort, error) {
|
||||
var res MyTasksSort
|
||||
return res, res.UnmarshalGQL(v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNMyTasksSort2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksSort(ctx context.Context, sel ast.SelectionSet, v MyTasksSort) graphql.Marshaler {
|
||||
return v
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNMyTasksStatus2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksStatus(ctx context.Context, v interface{}) (MyTasksStatus, error) {
|
||||
var res MyTasksStatus
|
||||
return res, res.UnmarshalGQL(v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNMyTasksStatus2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐMyTasksStatus(ctx context.Context, sel ast.SelectionSet, v MyTasksStatus) graphql.Marshaler {
|
||||
return v
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalNNewProject2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐNewProject(ctx context.Context, v interface{}) (NewProject, error) {
|
||||
return ec.unmarshalInputNewProject(ctx, v)
|
||||
}
|
||||
@ -23473,6 +23895,47 @@ func (ec *executionContext) marshalNProjectRole2ᚕgithubᚗcomᚋjordanknottᚋ
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNProjectTaskMapping2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐProjectTaskMapping(ctx context.Context, sel ast.SelectionSet, v ProjectTaskMapping) graphql.Marshaler {
|
||||
return ec._ProjectTaskMapping(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNProjectTaskMapping2ᚕgithubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐProjectTaskMappingᚄ(ctx context.Context, sel ast.SelectionSet, v []ProjectTaskMapping) graphql.Marshaler {
|
||||
ret := make(graphql.Array, len(v))
|
||||
var wg sync.WaitGroup
|
||||
isLen1 := len(v) == 1
|
||||
if !isLen1 {
|
||||
wg.Add(len(v))
|
||||
}
|
||||
for i := range v {
|
||||
i := i
|
||||
fc := &graphql.FieldContext{
|
||||
Index: &i,
|
||||
Result: &v[i],
|
||||
}
|
||||
ctx := graphql.WithFieldContext(ctx, fc)
|
||||
f := func(i int) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = nil
|
||||
}
|
||||
}()
|
||||
if !isLen1 {
|
||||
defer wg.Done()
|
||||
}
|
||||
ret[i] = ec.marshalNProjectTaskMapping2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋgraphᚐProjectTaskMapping(ctx, sel, v[i])
|
||||
}
|
||||
if isLen1 {
|
||||
f(i)
|
||||
} else {
|
||||
go f(i)
|
||||
}
|
||||
|
||||
}
|
||||
wg.Wait()
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNRefreshToken2githubᚗcomᚋjordanknottᚋtaskcafeᚋinternalᚋdbᚐRefreshToken(ctx context.Context, sel ast.SelectionSet, v db.RefreshToken) graphql.Marshaler {
|
||||
return ec._RefreshToken(ctx, sel, &v)
|
||||
}
|
||||
@ -24875,6 +25338,38 @@ func (ec *executionContext) marshalOUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx
|
||||
return MarshalUUID(v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalOUUID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, v interface{}) ([]uuid.UUID, error) {
|
||||
var vSlice []interface{}
|
||||
if v != nil {
|
||||
if tmp1, ok := v.([]interface{}); ok {
|
||||
vSlice = tmp1
|
||||
} else {
|
||||
vSlice = []interface{}{v}
|
||||
}
|
||||
}
|
||||
var err error
|
||||
res := make([]uuid.UUID, len(vSlice))
|
||||
for i := range vSlice {
|
||||
res[i], err = ec.unmarshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, vSlice[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOUUID2ᚕgithubᚗcomᚋgoogleᚋuuidᚐUUIDᚄ(ctx context.Context, sel ast.SelectionSet, v []uuid.UUID) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ret := make(graphql.Array, len(v))
|
||||
for i := range v {
|
||||
ret[i] = ec.marshalNUUID2githubᚗcomᚋgoogleᚋuuidᚐUUID(ctx, sel, v[i])
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalOUUID2ᚖgithubᚗcomᚋgoogleᚋuuidᚐUUID(ctx context.Context, v interface{}) (*uuid.UUID, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
|
@ -291,6 +291,16 @@ type MemberSearchResult struct {
|
||||
Status ShareStatus `json:"status"`
|
||||
}
|
||||
|
||||
type MyTasks struct {
|
||||
Status MyTasksStatus `json:"status"`
|
||||
Sort MyTasksSort `json:"sort"`
|
||||
}
|
||||
|
||||
type MyTasksPayload struct {
|
||||
Tasks []db.Task `json:"tasks"`
|
||||
Projects []ProjectTaskMapping `json:"projects"`
|
||||
}
|
||||
|
||||
type NewProject struct {
|
||||
TeamID *uuid.UUID `json:"teamID"`
|
||||
Name string `json:"name"`
|
||||
@ -307,9 +317,10 @@ type NewRefreshToken struct {
|
||||
}
|
||||
|
||||
type NewTask struct {
|
||||
TaskGroupID uuid.UUID `json:"taskGroupID"`
|
||||
Name string `json:"name"`
|
||||
Position float64 `json:"position"`
|
||||
TaskGroupID uuid.UUID `json:"taskGroupID"`
|
||||
Name string `json:"name"`
|
||||
Position float64 `json:"position"`
|
||||
Assigned []uuid.UUID `json:"assigned"`
|
||||
}
|
||||
|
||||
type NewTaskGroup struct {
|
||||
@ -376,6 +387,11 @@ type ProjectRole struct {
|
||||
RoleCode RoleCode `json:"roleCode"`
|
||||
}
|
||||
|
||||
type ProjectTaskMapping struct {
|
||||
ProjectID uuid.UUID `json:"projectID"`
|
||||
TaskID uuid.UUID `json:"taskID"`
|
||||
}
|
||||
|
||||
type ProjectsFilter struct {
|
||||
TeamID *uuid.UUID `json:"teamID"`
|
||||
}
|
||||
@ -797,6 +813,102 @@ func (e EntityType) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
||||
|
||||
type MyTasksSort string
|
||||
|
||||
const (
|
||||
MyTasksSortNone MyTasksSort = "NONE"
|
||||
MyTasksSortProject MyTasksSort = "PROJECT"
|
||||
MyTasksSortDueDate MyTasksSort = "DUE_DATE"
|
||||
)
|
||||
|
||||
var AllMyTasksSort = []MyTasksSort{
|
||||
MyTasksSortNone,
|
||||
MyTasksSortProject,
|
||||
MyTasksSortDueDate,
|
||||
}
|
||||
|
||||
func (e MyTasksSort) IsValid() bool {
|
||||
switch e {
|
||||
case MyTasksSortNone, MyTasksSortProject, MyTasksSortDueDate:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e MyTasksSort) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e *MyTasksSort) UnmarshalGQL(v interface{}) error {
|
||||
str, ok := v.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("enums must be strings")
|
||||
}
|
||||
|
||||
*e = MyTasksSort(str)
|
||||
if !e.IsValid() {
|
||||
return fmt.Errorf("%s is not a valid MyTasksSort", str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e MyTasksSort) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
||||
|
||||
type MyTasksStatus string
|
||||
|
||||
const (
|
||||
MyTasksStatusAll MyTasksStatus = "ALL"
|
||||
MyTasksStatusIncomplete MyTasksStatus = "INCOMPLETE"
|
||||
MyTasksStatusCompleteAll MyTasksStatus = "COMPLETE_ALL"
|
||||
MyTasksStatusCompleteToday MyTasksStatus = "COMPLETE_TODAY"
|
||||
MyTasksStatusCompleteYesterday MyTasksStatus = "COMPLETE_YESTERDAY"
|
||||
MyTasksStatusCompleteOneWeek MyTasksStatus = "COMPLETE_ONE_WEEK"
|
||||
MyTasksStatusCompleteTwoWeek MyTasksStatus = "COMPLETE_TWO_WEEK"
|
||||
MyTasksStatusCompleteThreeWeek MyTasksStatus = "COMPLETE_THREE_WEEK"
|
||||
)
|
||||
|
||||
var AllMyTasksStatus = []MyTasksStatus{
|
||||
MyTasksStatusAll,
|
||||
MyTasksStatusIncomplete,
|
||||
MyTasksStatusCompleteAll,
|
||||
MyTasksStatusCompleteToday,
|
||||
MyTasksStatusCompleteYesterday,
|
||||
MyTasksStatusCompleteOneWeek,
|
||||
MyTasksStatusCompleteTwoWeek,
|
||||
MyTasksStatusCompleteThreeWeek,
|
||||
}
|
||||
|
||||
func (e MyTasksStatus) IsValid() bool {
|
||||
switch e {
|
||||
case MyTasksStatusAll, MyTasksStatusIncomplete, MyTasksStatusCompleteAll, MyTasksStatusCompleteToday, MyTasksStatusCompleteYesterday, MyTasksStatusCompleteOneWeek, MyTasksStatusCompleteTwoWeek, MyTasksStatusCompleteThreeWeek:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e MyTasksStatus) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e *MyTasksStatus) UnmarshalGQL(v interface{}) error {
|
||||
str, ok := v.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("enums must be strings")
|
||||
}
|
||||
|
||||
*e = MyTasksStatus(str)
|
||||
if !e.IsValid() {
|
||||
return fmt.Errorf("%s is not a valid MyTasksStatus", str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e MyTasksStatus) MarshalGQL(w io.Writer) {
|
||||
fmt.Fprint(w, strconv.Quote(e.String()))
|
||||
}
|
||||
|
||||
type ObjectType string
|
||||
|
||||
const (
|
||||
|
@ -261,13 +261,47 @@ type Query {
|
||||
projects(input: ProjectsFilter): [Project!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
teams: [Team!]!
|
||||
myTasks(input: MyTasks!): MyTasksPayload!
|
||||
labelColors: [LabelColor!]!
|
||||
taskGroups: [TaskGroup!]!
|
||||
me: MePayload!
|
||||
}
|
||||
|
||||
|
||||
type Mutation
|
||||
|
||||
enum MyTasksStatus {
|
||||
ALL
|
||||
INCOMPLETE
|
||||
COMPLETE_ALL
|
||||
COMPLETE_TODAY
|
||||
COMPLETE_YESTERDAY
|
||||
COMPLETE_ONE_WEEK
|
||||
COMPLETE_TWO_WEEK
|
||||
COMPLETE_THREE_WEEK
|
||||
}
|
||||
|
||||
enum MyTasksSort {
|
||||
NONE
|
||||
PROJECT
|
||||
DUE_DATE
|
||||
}
|
||||
|
||||
input MyTasks {
|
||||
status: MyTasksStatus!
|
||||
sort: MyTasksSort!
|
||||
}
|
||||
|
||||
type ProjectTaskMapping {
|
||||
projectID: UUID!
|
||||
taskID: UUID!
|
||||
}
|
||||
|
||||
type MyTasksPayload {
|
||||
tasks: [Task!]!
|
||||
projects: [ProjectTaskMapping!]!
|
||||
}
|
||||
|
||||
type TeamRole {
|
||||
teamID: UUID!
|
||||
roleCode: RoleCode!
|
||||
@ -494,6 +528,7 @@ input NewTask {
|
||||
taskGroupID: UUID!
|
||||
name: String!
|
||||
position: Float!
|
||||
assigned: [UUID!]
|
||||
}
|
||||
|
||||
input AssignTaskInput {
|
||||
@ -945,4 +980,3 @@ type DeleteUserAccountPayload {
|
||||
ok: Boolean!
|
||||
userAccount: UserAccount!
|
||||
}
|
||||
|
||||
|
@ -314,6 +314,21 @@ func (r *mutationResolver) CreateTask(ctx context.Context, input NewTask) (*db.T
|
||||
ActivityTypeID: 1,
|
||||
})
|
||||
|
||||
if len(input.Assigned) != 0 {
|
||||
assignedDate := time.Now().UTC()
|
||||
for _, assigned := range input.Assigned {
|
||||
assignedTask, err := r.Repository.CreateTaskAssigned(ctx, db.CreateTaskAssignedParams{TaskID: task.TaskID, UserID: assigned, AssignedDate: assignedDate})
|
||||
logger.New(ctx).WithFields(log.Fields{
|
||||
"assignedUserID": assignedTask.UserID,
|
||||
"taskID": assignedTask.TaskID,
|
||||
"assignedTaskID": assignedTask.TaskAssignedID,
|
||||
}).Info("assigned task")
|
||||
if err != nil {
|
||||
return &db.Task{}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.New(ctx).WithError(err).Error("issue while creating task")
|
||||
return &db.Task{}, err
|
||||
@ -1391,6 +1406,38 @@ func (r *queryResolver) Teams(ctx context.Context) ([]db.Team, error) {
|
||||
return foundTeams, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) MyTasks(ctx context.Context, input MyTasks) (*MyTasksPayload, error) {
|
||||
userID, _ := GetUserID(ctx)
|
||||
projects := []ProjectTaskMapping{}
|
||||
var tasks []db.Task
|
||||
var err error
|
||||
if input.Sort == MyTasksSortNone {
|
||||
tasks, err = r.Repository.GetRecentlyAssignedTaskForUserID(ctx, userID)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return &MyTasksPayload{}, err
|
||||
}
|
||||
} else if input.Sort == MyTasksSortProject {
|
||||
tasks, err = r.Repository.GetAssignedTasksProjectForUserID(ctx, userID)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return &MyTasksPayload{}, err
|
||||
}
|
||||
} else if input.Sort == MyTasksSortDueDate {
|
||||
tasks, err = r.Repository.GetAssignedTasksDueDateForUserID(ctx, userID)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return &MyTasksPayload{}, err
|
||||
}
|
||||
}
|
||||
taskIds := []uuid.UUID{}
|
||||
for _, task := range tasks {
|
||||
taskIds = append(taskIds, task.TaskID)
|
||||
}
|
||||
mappings, err := r.Repository.GetProjectIdMappings(ctx, taskIds)
|
||||
for _, mapping := range mappings {
|
||||
projects = append(projects, ProjectTaskMapping{ProjectID: mapping.ProjectID, TaskID: mapping.TaskID})
|
||||
}
|
||||
return &MyTasksPayload{Tasks: tasks, Projects: projects}, err
|
||||
}
|
||||
|
||||
func (r *queryResolver) LabelColors(ctx context.Context) ([]db.LabelColor, error) {
|
||||
return r.Repository.GetLabelColors(ctx)
|
||||
}
|
||||
|
@ -37,13 +37,47 @@ type Query {
|
||||
projects(input: ProjectsFilter): [Project!]!
|
||||
findTeam(input: FindTeam!): Team!
|
||||
teams: [Team!]!
|
||||
myTasks(input: MyTasks!): MyTasksPayload!
|
||||
labelColors: [LabelColor!]!
|
||||
taskGroups: [TaskGroup!]!
|
||||
me: MePayload!
|
||||
}
|
||||
|
||||
|
||||
type Mutation
|
||||
|
||||
enum MyTasksStatus {
|
||||
ALL
|
||||
INCOMPLETE
|
||||
COMPLETE_ALL
|
||||
COMPLETE_TODAY
|
||||
COMPLETE_YESTERDAY
|
||||
COMPLETE_ONE_WEEK
|
||||
COMPLETE_TWO_WEEK
|
||||
COMPLETE_THREE_WEEK
|
||||
}
|
||||
|
||||
enum MyTasksSort {
|
||||
NONE
|
||||
PROJECT
|
||||
DUE_DATE
|
||||
}
|
||||
|
||||
input MyTasks {
|
||||
status: MyTasksStatus!
|
||||
sort: MyTasksSort!
|
||||
}
|
||||
|
||||
type ProjectTaskMapping {
|
||||
projectID: UUID!
|
||||
taskID: UUID!
|
||||
}
|
||||
|
||||
type MyTasksPayload {
|
||||
tasks: [Task!]!
|
||||
projects: [ProjectTaskMapping!]!
|
||||
}
|
||||
|
||||
type TeamRole {
|
||||
teamID: UUID!
|
||||
roleCode: RoleCode!
|
||||
|
@ -25,6 +25,7 @@ input NewTask {
|
||||
taskGroupID: UUID!
|
||||
name: String!
|
||||
position: Float!
|
||||
assigned: [UUID!]
|
||||
}
|
||||
|
||||
input AssignTaskInput {
|
||||
|
Reference in New Issue
Block a user