Skip to content

Commit b493cc9

Browse files
committed
[tasks] minor fixes
1 parent 02ef68e commit b493cc9

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/server/tasks/dto.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type TaskUpdateRequest struct {
7979
Description *string `json:"description,omitempty" validate:"omitempty,max=10000"`
8080
Priority *string `json:"priority,omitempty" validate:"omitempty,oneof=Trivial Minor Major Critical Blocker"`
8181
Status *string `json:"status,omitempty" validate:"omitempty,oneof=New Open 'In Progress' Resolved Closed Reopened"`
82-
AssigneeID *int64 `json:"assignee_id,omitempty" validate:"omitempty,min=1"`
82+
AssigneeID *int64 `json:"assignee_id,omitempty" validate:"omitempty,min=0"`
8383
DueDate *string `json:"due_date,omitempty" validate:"omitzero,datetime=2006-01-02"`
8484
}
8585

@@ -230,7 +230,7 @@ func (req TaskCreateRequest) toTaskInput(authorID int64) tasks.TaskInput {
230230
ProjectSlug: req.ProjectSlug,
231231
Title: req.Title,
232232
Description: req.Description,
233-
Priority: priority,
233+
Priority: lo.CoalesceOrEmpty(priority, tasks.PriorityMajor),
234234
AuthorID: authorID,
235235
AssigneeID: req.AssigneeID,
236236
DueDate: req.DueDate,

internal/tasks/repository.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func (r *Repository) Create(ctx context.Context, input TaskInput) (*Task, error)
3232
Model((*taskModel)(nil)).
3333
Column("number").
3434
Where("project_slug = ?", input.ProjectSlug).
35+
WhereAllWithDeleted().
3536
OrderExpr("number DESC").
3637
Limit(1).
3738
Scan(ctx, &maxNumber)

requests.http

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ Authorization: Bearer {{accessToken}}
210210
"title": "Implement user authentication",
211211
"description": "# Overview\nAdd JWT-based authentication to the API.\n\n## Requirements\n- Login endpoint\n- Token validation middleware",
212212
"priority": "Major",
213-
"assignee_id": {{userID}},
214-
"due_date": "2026-04-20"
213+
"due_date": "2026-04-20",
214+
"assignee_id": {{userID}}
215215
}
216216

217217
###
@@ -224,8 +224,7 @@ Authorization: Bearer {{accessToken}}
224224

225225
{
226226
"project_slug": "my-new-project",
227-
"title": "Fix bug in task numbering",
228-
"priority": "Minor"
227+
"title": "Fix bug in task numbering"
229228
}
230229

231230
###

0 commit comments

Comments
 (0)