-
Notifications
You must be signed in to change notification settings - Fork 45
Add ticket code support for cards with auto-incrementing numbers #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ const ( | |
| BoardSearchFieldNone BoardSearchField = "" | ||
| BoardSearchFieldTitle BoardSearchField = "title" | ||
| BoardSearchFieldPropertyName BoardSearchField = "property_name" | ||
| BoardSearchFieldCardPrefix BoardSearchField = "card_prefix" | ||
| ) | ||
|
|
||
| // Board groups a set of blocks and its layout | ||
|
|
@@ -97,6 +98,14 @@ type Board struct { | |
| // required: false | ||
| CardProperties []map[string]interface{} `json:"cardProperties"` | ||
|
|
||
| // The short prefix used for ticket codes (e.g. "PROJ", "BUG") | ||
| // required: false | ||
| CardPrefix string `json:"cardPrefix"` | ||
|
|
||
| // The auto-incrementing counter for card ticket numbers | ||
| // required: false | ||
| CardCount int64 `json:"cardCount"` | ||
|
|
||
| // The creation time in miliseconds since the current epoch | ||
| // required: true | ||
| CreateAt int64 `json:"createAt"` | ||
|
|
@@ -156,6 +165,10 @@ type BoardPatch struct { | |
| // required: false | ||
| ChannelID *string `json:"channelId"` | ||
|
|
||
| // The short prefix used for ticket codes (e.g. "PROJ", "BUG") | ||
| // required: false | ||
| CardPrefix *string `json:"cardPrefix"` | ||
|
|
||
| // The board updated properties | ||
| // required: false | ||
| UpdatedProperties map[string]interface{} `json:"updatedProperties"` | ||
|
|
@@ -297,6 +310,10 @@ func (p *BoardPatch) Patch(board *Board) *Board { | |
| board.ChannelID = *p.ChannelID | ||
| } | ||
|
|
||
| if p.CardPrefix != nil { | ||
| board.CardPrefix = *p.CardPrefix | ||
| } | ||
|
Comment on lines
+313
to
+315
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harden This only checks length and then persists the raw value unchanged. API callers can still save lowercase, whitespace, or hyphenated prefixes, which makes the new lookup path unreliable because Also applies to: 397-399 🤖 Prompt for AI Agents |
||
|
|
||
| for key, property := range p.UpdatedProperties { | ||
| board.Properties[key] = property | ||
| } | ||
|
|
@@ -377,6 +394,10 @@ func (p *BoardPatch) IsValid() error { | |
| return InvalidBoardErr{"invalid-channel-id"} | ||
| } | ||
|
|
||
| if p.CardPrefix != nil && len(*p.CardPrefix) > 10 { | ||
| return InvalidBoardErr{"invalid-card-prefix-too-long"} | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -447,6 +468,8 @@ func BoardSearchFieldFromString(field string) (BoardSearchField, error) { | |
| return BoardSearchFieldTitle, nil | ||
| case string(BoardSearchFieldPropertyName): | ||
| return BoardSearchFieldPropertyName, nil | ||
| case string(BoardSearchFieldCardPrefix): | ||
| return BoardSearchFieldCardPrefix, nil | ||
| } | ||
| return BoardSearchFieldNone, ErrInvalidBoardSearchField | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mask unauthorized ticket-code hits as not found.
This lookup happens before the board permission check, and the handler returns a different result for “exists but forbidden” vs “doesn’t exist”. Because ticket codes are predictable, that lets callers enumerate cards on private boards. Prefer folding access control into the query or returning a 404-equivalent when
PermissionViewBoardfails.🤖 Prompt for AI Agents