CRUD Events and React interaction
This commit is contained in:
@@ -13,10 +13,11 @@ import (
|
||||
)
|
||||
|
||||
type UpdateShortcodeArgs struct {
|
||||
Code *string `json:"code"` // The shortcode value
|
||||
Type *core.ShortcodeType `json:"type"`
|
||||
Value *string `json:"value"`
|
||||
MediaID *uuid.UUID `json:"media_id"` // Nullable reference to another table's ID
|
||||
ID *int64 `json:"id,omitempty"`
|
||||
Code *string `json:"code,omitempty"` // The shortcode value
|
||||
Type *core.ShortcodeType `bun:"shortcode_type" json:"type,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
MediaID *uuid.UUID `json:"media_id,omitempty"` // Nullable reference to another table's ID
|
||||
}
|
||||
|
||||
func HandleUpdateShortcode(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -51,7 +52,7 @@ func HandleUpdateShortcode(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
code := r.PathValue("shortcode")
|
||||
_, err = updateQuery.
|
||||
Where("code = ?", code).
|
||||
Where("id = ? OR code = ?", updateArgs.ID, code).
|
||||
Returning("*").
|
||||
Exec(context.Background())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user