feature: UI changes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,12 @@ type NewProject struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type NewProjectLabel struct {
|
||||
ProjectID uuid.UUID `json:"projectID"`
|
||||
LabelColorID uuid.UUID `json:"labelColorID"`
|
||||
Name *string `json:"name"`
|
||||
}
|
||||
|
||||
type NewRefreshToken struct {
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
@ -100,6 +106,7 @@ type NewUserAccount struct {
|
||||
type ProfileIcon struct {
|
||||
URL *string `json:"url"`
|
||||
Initials *string `json:"initials"`
|
||||
BgColor *string `json:"bgColor"`
|
||||
}
|
||||
|
||||
type ProjectMember struct {
|
||||
@ -118,6 +125,11 @@ type RemoveTaskLabelInput struct {
|
||||
TaskLabelID uuid.UUID `json:"taskLabelID"`
|
||||
}
|
||||
|
||||
type UnassignTaskInput struct {
|
||||
TaskID uuid.UUID `json:"taskID"`
|
||||
UserID uuid.UUID `json:"userID"`
|
||||
}
|
||||
|
||||
type UpdateTaskDescriptionInput struct {
|
||||
TaskID uuid.UUID `json:"taskID"`
|
||||
Description string `json:"description"`
|
||||
|
@ -1,15 +1,25 @@
|
||||
scalar Time
|
||||
scalar UUID
|
||||
|
||||
type ProjectLabel {
|
||||
projectLabelID: ID!
|
||||
createdDate: Time!
|
||||
colorHex: String!
|
||||
name: String
|
||||
}
|
||||
|
||||
type TaskLabel {
|
||||
taskLabelID: ID!
|
||||
labelColorID: UUID!
|
||||
projectLabelID: UUID!
|
||||
assignedDate: Time!
|
||||
colorHex: String!
|
||||
name: String
|
||||
}
|
||||
|
||||
type ProfileIcon {
|
||||
url: String
|
||||
initials: String
|
||||
bgColor: String
|
||||
}
|
||||
|
||||
type ProjectMember {
|
||||
@ -50,6 +60,7 @@ type Project {
|
||||
owner: ProjectMember!
|
||||
taskGroups: [TaskGroup!]!
|
||||
members: [ProjectMember!]!
|
||||
labels: [ProjectLabel!]!
|
||||
}
|
||||
|
||||
type TaskGroup {
|
||||
@ -174,6 +185,10 @@ input AssignTaskInput {
|
||||
userID: UUID!
|
||||
}
|
||||
|
||||
input UnassignTaskInput {
|
||||
taskID: UUID!
|
||||
userID: UUID!
|
||||
}
|
||||
input UpdateTaskDescriptionInput {
|
||||
taskID: UUID!
|
||||
description: String!
|
||||
@ -189,6 +204,12 @@ input RemoveTaskLabelInput {
|
||||
taskLabelID: UUID!
|
||||
}
|
||||
|
||||
input NewProjectLabel {
|
||||
projectID: UUID!
|
||||
labelColorID: UUID!
|
||||
name: String
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createRefreshToken(input: NewRefreshToken!): RefreshToken!
|
||||
|
||||
@ -197,6 +218,7 @@ type Mutation {
|
||||
createTeam(input: NewTeam!): Team!
|
||||
|
||||
createProject(input: NewProject!): Project!
|
||||
createProjectLabel(input: NewProjectLabel!): ProjectLabel!
|
||||
|
||||
createTaskGroup(input: NewTaskGroup!): TaskGroup!
|
||||
updateTaskGroupLocation(input: NewTaskGroupLocation!): TaskGroup!
|
||||
@ -211,6 +233,7 @@ type Mutation {
|
||||
updateTaskName(input: UpdateTaskName!): Task!
|
||||
deleteTask(input: DeleteTaskInput!): DeleteTaskPayload!
|
||||
assignTask(input: AssignTaskInput): Task!
|
||||
unassignTask(input: UnassignTaskInput): Task!
|
||||
|
||||
logoutUser(input: LogoutUser!): Boolean!
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ func (r *mutationResolver) CreateProject(ctx context.Context, input NewProject)
|
||||
return &project, err
|
||||
}
|
||||
|
||||
func (r *mutationResolver) CreateProjectLabel(ctx context.Context, input NewProjectLabel) (*pg.ProjectLabel, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *mutationResolver) CreateTaskGroup(ctx context.Context, input NewTaskGroup) (*pg.TaskGroup, error) {
|
||||
createdAt := time.Now().UTC()
|
||||
projectID, err := uuid.Parse(input.ProjectID)
|
||||
@ -164,6 +168,18 @@ func (r *mutationResolver) AssignTask(ctx context.Context, input *AssignTaskInpu
|
||||
return &task, err
|
||||
}
|
||||
|
||||
func (r *mutationResolver) UnassignTask(ctx context.Context, input *UnassignTaskInput) (*pg.Task, error) {
|
||||
task, err := r.Repository.GetTaskByID(ctx, input.TaskID)
|
||||
if err != nil {
|
||||
return &pg.Task{}, err
|
||||
}
|
||||
_, err = r.Repository.DeleteTaskAssignedByID(ctx, pg.DeleteTaskAssignedByIDParams{input.TaskID, input.UserID})
|
||||
if err != nil {
|
||||
return &pg.Task{}, err
|
||||
}
|
||||
return &task, nil
|
||||
}
|
||||
|
||||
func (r *mutationResolver) LogoutUser(ctx context.Context, input LogoutUser) (bool, error) {
|
||||
userID, err := uuid.Parse(input.UserID)
|
||||
if err != nil {
|
||||
@ -185,7 +201,7 @@ func (r *projectResolver) Owner(ctx context.Context, obj *pg.Project) (*ProjectM
|
||||
return &ProjectMember{}, err
|
||||
}
|
||||
initials := string([]rune(user.FirstName)[0]) + string([]rune(user.LastName)[0])
|
||||
profileIcon := &ProfileIcon{nil, &initials}
|
||||
profileIcon := &ProfileIcon{nil, &initials, &user.ProfileBgColor}
|
||||
return &ProjectMember{obj.Owner, user.FirstName, user.LastName, profileIcon}, nil
|
||||
}
|
||||
|
||||
@ -200,11 +216,28 @@ func (r *projectResolver) Members(ctx context.Context, obj *pg.Project) ([]Proje
|
||||
return members, err
|
||||
}
|
||||
initials := string([]rune(user.FirstName)[0]) + string([]rune(user.LastName)[0])
|
||||
profileIcon := &ProfileIcon{nil, &initials}
|
||||
profileIcon := &ProfileIcon{nil, &initials, &user.ProfileBgColor}
|
||||
members = append(members, ProjectMember{obj.Owner, user.FirstName, user.LastName, profileIcon})
|
||||
return members, nil
|
||||
}
|
||||
|
||||
func (r *projectResolver) Labels(ctx context.Context, obj *pg.Project) ([]pg.ProjectLabel, error) {
|
||||
labels, err := r.Repository.GetProjectLabelsForProject(ctx, obj.ProjectID)
|
||||
return labels, err
|
||||
}
|
||||
|
||||
func (r *projectLabelResolver) ColorHex(ctx context.Context, obj *pg.ProjectLabel) (string, error) {
|
||||
labelColor, err := r.Repository.GetLabelColorByID(ctx, obj.LabelColorID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return labelColor.ColorHex, nil
|
||||
}
|
||||
|
||||
func (r *projectLabelResolver) Name(ctx context.Context, obj *pg.ProjectLabel) (*string, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
func (r *queryResolver) Users(ctx context.Context) ([]pg.UserAccount, error) {
|
||||
return r.Repository.GetAllUserAccounts(ctx)
|
||||
}
|
||||
@ -306,7 +339,7 @@ func (r *taskResolver) Assigned(ctx context.Context, obj *pg.Task) ([]ProjectMem
|
||||
return taskMembers, err
|
||||
}
|
||||
initials := string([]rune(user.FirstName)[0]) + string([]rune(user.LastName)[0])
|
||||
profileIcon := &ProfileIcon{nil, &initials}
|
||||
profileIcon := &ProfileIcon{nil, &initials, &user.ProfileBgColor}
|
||||
taskMembers = append(taskMembers, ProjectMember{taskMemberLink.UserID, user.FirstName, user.LastName, profileIcon})
|
||||
}
|
||||
return taskMembers, nil
|
||||
@ -326,16 +359,32 @@ func (r *taskGroupResolver) Tasks(ctx context.Context, obj *pg.TaskGroup) ([]pg.
|
||||
}
|
||||
|
||||
func (r *taskLabelResolver) ColorHex(ctx context.Context, obj *pg.TaskLabel) (string, error) {
|
||||
labelColor, err := r.Repository.GetLabelColorByID(ctx, obj.LabelColorID)
|
||||
projectLabel, err := r.Repository.GetProjectLabelByID(ctx, obj.ProjectLabelID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
labelColor, err := r.Repository.GetLabelColorByID(ctx, projectLabel.LabelColorID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return labelColor.ColorHex, nil
|
||||
}
|
||||
|
||||
func (r *taskLabelResolver) Name(ctx context.Context, obj *pg.TaskLabel) (*string, error) {
|
||||
projectLabel, err := r.Repository.GetProjectLabelByID(ctx, obj.ProjectLabelID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
name := projectLabel.Name
|
||||
if !name.Valid {
|
||||
return nil, err
|
||||
}
|
||||
return &name.String, err
|
||||
}
|
||||
|
||||
func (r *userAccountResolver) ProfileIcon(ctx context.Context, obj *pg.UserAccount) (*ProfileIcon, error) {
|
||||
initials := string([]rune(obj.FirstName)[0]) + string([]rune(obj.LastName)[0])
|
||||
profileIcon := &ProfileIcon{nil, &initials}
|
||||
profileIcon := &ProfileIcon{nil, &initials, &obj.ProfileBgColor}
|
||||
return profileIcon, nil
|
||||
}
|
||||
|
||||
@ -345,6 +394,9 @@ func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} }
|
||||
// Project returns ProjectResolver implementation.
|
||||
func (r *Resolver) Project() ProjectResolver { return &projectResolver{r} }
|
||||
|
||||
// ProjectLabel returns ProjectLabelResolver implementation.
|
||||
func (r *Resolver) ProjectLabel() ProjectLabelResolver { return &projectLabelResolver{r} }
|
||||
|
||||
// Query returns QueryResolver implementation.
|
||||
func (r *Resolver) Query() QueryResolver { return &queryResolver{r} }
|
||||
|
||||
@ -362,6 +414,7 @@ func (r *Resolver) UserAccount() UserAccountResolver { return &userAccountResolv
|
||||
|
||||
type mutationResolver struct{ *Resolver }
|
||||
type projectResolver struct{ *Resolver }
|
||||
type projectLabelResolver struct{ *Resolver }
|
||||
type queryResolver struct{ *Resolver }
|
||||
type taskResolver struct{ *Resolver }
|
||||
type taskGroupResolver struct{ *Resolver }
|
||||
@ -374,6 +427,9 @@ type userAccountResolver struct{ *Resolver }
|
||||
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
|
||||
// it when you're done.
|
||||
// - You have helper methods in this file. Move them out to keep these resolver files clean.
|
||||
func (r *taskLabelResolver) ProjectLabelID(ctx context.Context, obj *pg.TaskLabel) (uuid.UUID, error) {
|
||||
panic(fmt.Errorf("not implemented"))
|
||||
}
|
||||
func (r *userAccountResolver) DisplayName(ctx context.Context, obj *pg.UserAccount) (string, error) {
|
||||
return obj.FirstName + " " + obj.LastName, nil
|
||||
}
|
||||
|
7
api/migrations/0012-add-project-label-table.up.sql
Normal file
7
api/migrations/0012-add-project-label-table.up.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE project_label (
|
||||
project_label_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
project_id uuid NOT NULL REFERENCES project(project_id),
|
||||
label_color_id uuid NOT NULL REFERENCES label_color(label_color_id),
|
||||
created_date timestamptz NOT NULL,
|
||||
name text
|
||||
);
|
@ -1,6 +1,6 @@
|
||||
CREATE TABLE task_label (
|
||||
task_label_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
task_id uuid NOT NULL REFERENCES task(task_id),
|
||||
label_color_id uuid NOT NULL REFERENCES label_color(label_color_id),
|
||||
project_label_id uuid NOT NULL REFERENCES project_label(project_label_id),
|
||||
assigned_date timestamptz NOT NULL
|
||||
);
|
@ -0,0 +1 @@
|
||||
ALTER TABLE user_account ADD COLUMN profile_bg_color text NOT NULL DEFAULT '#7367F0';
|
@ -29,6 +29,14 @@ type Project struct {
|
||||
Owner uuid.UUID `json:"owner"`
|
||||
}
|
||||
|
||||
type ProjectLabel struct {
|
||||
ProjectLabelID uuid.UUID `json:"project_label_id"`
|
||||
ProjectID uuid.UUID `json:"project_id"`
|
||||
LabelColorID uuid.UUID `json:"label_color_id"`
|
||||
CreatedDate time.Time `json:"created_date"`
|
||||
Name sql.NullString `json:"name"`
|
||||
}
|
||||
|
||||
type RefreshToken struct {
|
||||
TokenID uuid.UUID `json:"token_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
@ -62,10 +70,10 @@ type TaskGroup struct {
|
||||
}
|
||||
|
||||
type TaskLabel struct {
|
||||
TaskLabelID uuid.UUID `json:"task_label_id"`
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
LabelColorID uuid.UUID `json:"label_color_id"`
|
||||
AssignedDate time.Time `json:"assigned_date"`
|
||||
TaskLabelID uuid.UUID `json:"task_label_id"`
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
ProjectLabelID uuid.UUID `json:"project_label_id"`
|
||||
AssignedDate time.Time `json:"assigned_date"`
|
||||
}
|
||||
|
||||
type Team struct {
|
||||
@ -76,11 +84,12 @@ type Team struct {
|
||||
}
|
||||
|
||||
type UserAccount struct {
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Email string `json:"email"`
|
||||
Username string `json:"username"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Email string `json:"email"`
|
||||
Username string `json:"username"`
|
||||
PasswordHash string `json:"password_hash"`
|
||||
ProfileBgColor string `json:"profile_bg_color"`
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ type Repository interface {
|
||||
GetUserAccountByUsername(ctx context.Context, username string) (UserAccount, error)
|
||||
GetAllUserAccounts(ctx context.Context) ([]UserAccount, error)
|
||||
|
||||
CreateProjectLabel(ctx context.Context, arg CreateProjectLabelParams) (ProjectLabel, error)
|
||||
GetProjectLabelsForProject(ctx context.Context, projectID uuid.UUID) ([]ProjectLabel, error)
|
||||
GetProjectLabelByID(ctx context.Context, projectLabelID uuid.UUID) (ProjectLabel, error)
|
||||
|
||||
CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshToken, error)
|
||||
GetRefreshTokenByID(ctx context.Context, tokenID uuid.UUID) (RefreshToken, error)
|
||||
DeleteRefreshTokenByID(ctx context.Context, tokenID uuid.UUID) error
|
||||
@ -55,6 +59,7 @@ type Repository interface {
|
||||
|
||||
CreateTaskAssigned(ctx context.Context, arg CreateTaskAssignedParams) (TaskAssigned, error)
|
||||
GetAssignedMembersForTask(ctx context.Context, taskID uuid.UUID) ([]TaskAssigned, error)
|
||||
DeleteTaskAssignedByID(ctx context.Context, arg DeleteTaskAssignedByIDParams) (TaskAssigned, error)
|
||||
}
|
||||
|
||||
type repoSvc struct {
|
||||
|
92
api/pg/project_label.sql.go
Normal file
92
api/pg/project_label.sql.go
Normal file
@ -0,0 +1,92 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// source: project_label.sql
|
||||
|
||||
package pg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const createProjectLabel = `-- name: CreateProjectLabel :one
|
||||
INSERT INTO project_label (project_id, label_color_id, created_date, name)
|
||||
VALUES ($1, $2, $3, $4) RETURNING project_label_id, project_id, label_color_id, created_date, name
|
||||
`
|
||||
|
||||
type CreateProjectLabelParams struct {
|
||||
ProjectID uuid.UUID `json:"project_id"`
|
||||
LabelColorID uuid.UUID `json:"label_color_id"`
|
||||
CreatedDate time.Time `json:"created_date"`
|
||||
Name sql.NullString `json:"name"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateProjectLabel(ctx context.Context, arg CreateProjectLabelParams) (ProjectLabel, error) {
|
||||
row := q.db.QueryRowContext(ctx, createProjectLabel,
|
||||
arg.ProjectID,
|
||||
arg.LabelColorID,
|
||||
arg.CreatedDate,
|
||||
arg.Name,
|
||||
)
|
||||
var i ProjectLabel
|
||||
err := row.Scan(
|
||||
&i.ProjectLabelID,
|
||||
&i.ProjectID,
|
||||
&i.LabelColorID,
|
||||
&i.CreatedDate,
|
||||
&i.Name,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getProjectLabelByID = `-- name: GetProjectLabelByID :one
|
||||
SELECT project_label_id, project_id, label_color_id, created_date, name FROM project_label WHERE project_label_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectLabelByID(ctx context.Context, projectLabelID uuid.UUID) (ProjectLabel, error) {
|
||||
row := q.db.QueryRowContext(ctx, getProjectLabelByID, projectLabelID)
|
||||
var i ProjectLabel
|
||||
err := row.Scan(
|
||||
&i.ProjectLabelID,
|
||||
&i.ProjectID,
|
||||
&i.LabelColorID,
|
||||
&i.CreatedDate,
|
||||
&i.Name,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getProjectLabelsForProject = `-- name: GetProjectLabelsForProject :many
|
||||
SELECT project_label_id, project_id, label_color_id, created_date, name FROM project_label WHERE project_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetProjectLabelsForProject(ctx context.Context, projectID uuid.UUID) ([]ProjectLabel, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getProjectLabelsForProject, projectID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ProjectLabel
|
||||
for rows.Next() {
|
||||
var i ProjectLabel
|
||||
if err := rows.Scan(
|
||||
&i.ProjectLabelID,
|
||||
&i.ProjectID,
|
||||
&i.LabelColorID,
|
||||
&i.CreatedDate,
|
||||
&i.Name,
|
||||
); 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
|
||||
}
|
@ -11,6 +11,7 @@ import (
|
||||
type Querier interface {
|
||||
CreateOrganization(ctx context.Context, arg CreateOrganizationParams) (Organization, error)
|
||||
CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
|
||||
CreateProjectLabel(ctx context.Context, arg CreateProjectLabelParams) (ProjectLabel, error)
|
||||
CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshToken, error)
|
||||
CreateTask(ctx context.Context, arg CreateTaskParams) (Task, error)
|
||||
CreateTaskAssigned(ctx context.Context, arg CreateTaskAssignedParams) (TaskAssigned, error)
|
||||
@ -21,6 +22,7 @@ type Querier interface {
|
||||
DeleteExpiredTokens(ctx context.Context) error
|
||||
DeleteRefreshTokenByID(ctx context.Context, tokenID uuid.UUID) error
|
||||
DeleteRefreshTokenByUserID(ctx context.Context, userID uuid.UUID) error
|
||||
DeleteTaskAssignedByID(ctx context.Context, arg DeleteTaskAssignedByIDParams) (TaskAssigned, error)
|
||||
DeleteTaskByID(ctx context.Context, taskID uuid.UUID) error
|
||||
DeleteTaskGroupByID(ctx context.Context, taskGroupID uuid.UUID) (int64, error)
|
||||
DeleteTasksByTaskGroupID(ctx context.Context, taskGroupID uuid.UUID) (int64, error)
|
||||
@ -35,6 +37,8 @@ type Querier interface {
|
||||
GetAssignedMembersForTask(ctx context.Context, taskID uuid.UUID) ([]TaskAssigned, error)
|
||||
GetLabelColorByID(ctx context.Context, labelColorID uuid.UUID) (LabelColor, error)
|
||||
GetProjectByID(ctx context.Context, projectID uuid.UUID) (Project, error)
|
||||
GetProjectLabelByID(ctx context.Context, projectLabelID uuid.UUID) (ProjectLabel, error)
|
||||
GetProjectLabelsForProject(ctx context.Context, projectID uuid.UUID) ([]ProjectLabel, error)
|
||||
GetRefreshTokenByID(ctx context.Context, tokenID uuid.UUID) (RefreshToken, error)
|
||||
GetTaskByID(ctx context.Context, taskID uuid.UUID) (Task, error)
|
||||
GetTaskGroupByID(ctx context.Context, taskGroupID uuid.UUID) (TaskGroup, error)
|
||||
|
@ -33,6 +33,27 @@ func (q *Queries) CreateTaskAssigned(ctx context.Context, arg CreateTaskAssigned
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteTaskAssignedByID = `-- name: DeleteTaskAssignedByID :one
|
||||
DELETE FROM task_assigned WHERE task_id = $1 AND user_id = $2 RETURNING task_assigned_id, task_id, user_id, assigned_date
|
||||
`
|
||||
|
||||
type DeleteTaskAssignedByIDParams struct {
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) DeleteTaskAssignedByID(ctx context.Context, arg DeleteTaskAssignedByIDParams) (TaskAssigned, error) {
|
||||
row := q.db.QueryRowContext(ctx, deleteTaskAssignedByID, arg.TaskID, arg.UserID)
|
||||
var i TaskAssigned
|
||||
err := row.Scan(
|
||||
&i.TaskAssignedID,
|
||||
&i.TaskID,
|
||||
&i.UserID,
|
||||
&i.AssignedDate,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getAssignedMembersForTask = `-- name: GetAssignedMembersForTask :many
|
||||
SELECT task_assigned_id, task_id, user_id, assigned_date FROM task_assigned WHERE task_id = $1
|
||||
`
|
||||
|
@ -11,30 +11,30 @@ import (
|
||||
)
|
||||
|
||||
const createTaskLabelForTask = `-- name: CreateTaskLabelForTask :one
|
||||
INSERT INTO task_label (task_id, label_color_id, assigned_date)
|
||||
VALUES ($1, $2, $3) RETURNING task_label_id, task_id, label_color_id, assigned_date
|
||||
INSERT INTO task_label (task_id, project_label_id, assigned_date)
|
||||
VALUES ($1, $2, $3) RETURNING task_label_id, task_id, project_label_id, assigned_date
|
||||
`
|
||||
|
||||
type CreateTaskLabelForTaskParams struct {
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
LabelColorID uuid.UUID `json:"label_color_id"`
|
||||
AssignedDate time.Time `json:"assigned_date"`
|
||||
TaskID uuid.UUID `json:"task_id"`
|
||||
ProjectLabelID uuid.UUID `json:"project_label_id"`
|
||||
AssignedDate time.Time `json:"assigned_date"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateTaskLabelForTask(ctx context.Context, arg CreateTaskLabelForTaskParams) (TaskLabel, error) {
|
||||
row := q.db.QueryRowContext(ctx, createTaskLabelForTask, arg.TaskID, arg.LabelColorID, arg.AssignedDate)
|
||||
row := q.db.QueryRowContext(ctx, createTaskLabelForTask, arg.TaskID, arg.ProjectLabelID, arg.AssignedDate)
|
||||
var i TaskLabel
|
||||
err := row.Scan(
|
||||
&i.TaskLabelID,
|
||||
&i.TaskID,
|
||||
&i.LabelColorID,
|
||||
&i.ProjectLabelID,
|
||||
&i.AssignedDate,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getTaskLabelsForTaskID = `-- name: GetTaskLabelsForTaskID :many
|
||||
SELECT task_label_id, task_id, label_color_id, assigned_date FROM task_label WHERE task_id = $1
|
||||
SELECT task_label_id, task_id, project_label_id, assigned_date FROM task_label WHERE task_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetTaskLabelsForTaskID(ctx context.Context, taskID uuid.UUID) ([]TaskLabel, error) {
|
||||
@ -49,7 +49,7 @@ func (q *Queries) GetTaskLabelsForTaskID(ctx context.Context, taskID uuid.UUID)
|
||||
if err := rows.Scan(
|
||||
&i.TaskLabelID,
|
||||
&i.TaskID,
|
||||
&i.LabelColorID,
|
||||
&i.ProjectLabelID,
|
||||
&i.AssignedDate,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
const createUserAccount = `-- name: CreateUserAccount :one
|
||||
INSERT INTO user_account(first_name, last_name, email, username, created_at, password_hash)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
RETURNING user_id, created_at, first_name, last_name, email, username, password_hash
|
||||
RETURNING user_id, created_at, first_name, last_name, email, username, password_hash, profile_bg_color
|
||||
`
|
||||
|
||||
type CreateUserAccountParams struct {
|
||||
@ -43,12 +43,13 @@ func (q *Queries) CreateUserAccount(ctx context.Context, arg CreateUserAccountPa
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.ProfileBgColor,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getAllUserAccounts = `-- name: GetAllUserAccounts :many
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash FROM user_account
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash, profile_bg_color FROM user_account
|
||||
`
|
||||
|
||||
func (q *Queries) GetAllUserAccounts(ctx context.Context) ([]UserAccount, error) {
|
||||
@ -68,6 +69,7 @@ func (q *Queries) GetAllUserAccounts(ctx context.Context) ([]UserAccount, error)
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.ProfileBgColor,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -83,7 +85,7 @@ func (q *Queries) GetAllUserAccounts(ctx context.Context) ([]UserAccount, error)
|
||||
}
|
||||
|
||||
const getUserAccountByID = `-- name: GetUserAccountByID :one
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash FROM user_account WHERE user_id = $1
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash, profile_bg_color FROM user_account WHERE user_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserAccountByID(ctx context.Context, userID uuid.UUID) (UserAccount, error) {
|
||||
@ -97,12 +99,13 @@ func (q *Queries) GetUserAccountByID(ctx context.Context, userID uuid.UUID) (Use
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.ProfileBgColor,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserAccountByUsername = `-- name: GetUserAccountByUsername :one
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash FROM user_account WHERE username = $1
|
||||
SELECT user_id, created_at, first_name, last_name, email, username, password_hash, profile_bg_color FROM user_account WHERE username = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserAccountByUsername(ctx context.Context, username string) (UserAccount, error) {
|
||||
@ -116,6 +119,7 @@ func (q *Queries) GetUserAccountByUsername(ctx context.Context, username string)
|
||||
&i.Email,
|
||||
&i.Username,
|
||||
&i.PasswordHash,
|
||||
&i.ProfileBgColor,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
9
api/query/project_label.sql
Normal file
9
api/query/project_label.sql
Normal file
@ -0,0 +1,9 @@
|
||||
-- name: CreateProjectLabel :one
|
||||
INSERT INTO project_label (project_id, label_color_id, created_date, name)
|
||||
VALUES ($1, $2, $3, $4) RETURNING *;
|
||||
|
||||
-- name: GetProjectLabelsForProject :many
|
||||
SELECT * FROM project_label WHERE project_id = $1;
|
||||
|
||||
-- name: GetProjectLabelByID :one
|
||||
SELECT * FROM project_label WHERE project_label_id = $1;
|
@ -4,3 +4,6 @@ INSERT INTO task_assigned (task_id, user_id, assigned_date)
|
||||
|
||||
-- name: GetAssignedMembersForTask :many
|
||||
SELECT * FROM task_assigned WHERE task_id = $1;
|
||||
|
||||
-- name: DeleteTaskAssignedByID :one
|
||||
DELETE FROM task_assigned WHERE task_id = $1 AND user_id = $2 RETURNING *;
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- name: CreateTaskLabelForTask :one
|
||||
INSERT INTO task_label (task_id, label_color_id, assigned_date)
|
||||
INSERT INTO task_label (task_id, project_label_id, assigned_date)
|
||||
VALUES ($1, $2, $3) RETURNING *;
|
||||
|
||||
-- name: GetTaskLabelsForTaskID :many
|
||||
|
Reference in New Issue
Block a user