CRUD Events and React interaction

This commit is contained in:
cdricms
2025-01-27 17:58:47 +01:00
parent 9843158803
commit ac7e97527f
17 changed files with 887 additions and 349 deletions

View File

@@ -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())