diff --git a/internal/invite/handlers.go b/internal/invite/handlers.go index aa63c24..f230761 100644 --- a/internal/invite/handlers.go +++ b/internal/invite/handlers.go @@ -40,7 +40,7 @@ type inviteResponse struct { Code string `json:"code"` ServerID string `json:"server_id"` ServerName string `json:"server_name"` - CreatorID string `json:"creator_id"` + CreatorID string `json:"created_by"` MaxUses *int `json:"max_uses"` UseCount int `json:"use_count"` ExpiresAt *string `json:"expires_at"` @@ -145,9 +145,9 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request) { var createdAtStr sql.NullString err = h.db.QueryRowContext(r.Context(), ` - INSERT INTO invites (code, server_id, creator_id, max_uses, expires_at) + INSERT INTO invites (code, server_id, created_by, max_uses, expires_at) VALUES ($1, $2, $3, $4, $5) - RETURNING id, code, server_id, creator_id, max_uses, use_count, expires_at::text, created_at::text + RETURNING id, code, server_id, created_by, max_uses, use_count, expires_at::text, created_at::text `, code, serverID, userID, maxUses, expiresAt).Scan( &invite.ID, &invite.Code, &invite.ServerID, &invite.CreatorID, &invite.MaxUses, &invite.UseCount, &expiresAtStr, &createdAtStr, @@ -191,7 +191,7 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) { var createdAtStr sql.NullString err := h.db.QueryRowContext(r.Context(), ` - SELECT i.id, i.code, i.server_id, COALESCE(s.name, ''), i.creator_id, + SELECT i.id, i.code, i.server_id, COALESCE(s.name, ''), i.created_by, i.max_uses, i.use_count, i.expires_at::text, i.created_at::text FROM invites i LEFT JOIN servers s ON s.id = i.server_id