Compare commits
2 Commits
02300c69d8
...
f6350b1d7f
| Author | SHA1 | Date | |
|---|---|---|---|
| f6350b1d7f | |||
| 292db01011 |
@@ -38,7 +38,7 @@ func CreateSyndicateHandler(db *sql.DB) http.HandlerFunc {
|
||||
helpers.SetFlash(w, r, "Syndicate created successfully")
|
||||
}
|
||||
|
||||
http.Redirect(w, r, "/account/syndicates", http.StatusSeeOther)
|
||||
http.Redirect(w, r, "/syndicate", http.StatusSeeOther)
|
||||
default:
|
||||
helpers.RenderError(w, r, http.StatusMethodNotAllowed)
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ func AcceptInviteHandler(db *sql.DB) http.HandlerFunc {
|
||||
} else {
|
||||
helpers.SetFlash(w, r, "You have joined the syndicate")
|
||||
}
|
||||
http.Redirect(w, r, "/syndicates", http.StatusSeeOther)
|
||||
http.Redirect(w, r, "/syndicate", http.StatusSeeOther)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ CREATE TABLE IF NOT EXISTS syndicate_members (
|
||||
syndicate_id INTEGER NOT NULL,
|
||||
user_id INTEGER NOT NULL,
|
||||
role TEXT DEFAULT 'member', -- owner, manager, member
|
||||
status TEXT DEFAULT 'active', -- pending, accepted, kicked
|
||||
status TEXT DEFAULT 'active',
|
||||
joined_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (syndicate_id) REFERENCES syndicates(id),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
@@ -204,7 +204,7 @@ CREATE TABLE IF NOT EXISTS syndicate_invites (
|
||||
syndicate_id INTEGER NOT NULL,
|
||||
invited_user_id INTEGER NOT NULL,
|
||||
sent_by_user_id INTEGER NOT NULL,
|
||||
status TEXT DEFAULT 'pending', -- 'pending', 'accepted', 'declined'
|
||||
status TEXT DEFAULT 'pending',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY(syndicate_id) REFERENCES syndicates(id),
|
||||
FOREIGN KEY(invited_user_id) REFERENCES users(id)
|
||||
|
||||
@@ -215,8 +215,8 @@ func CreateSyndicate(db *sql.DB, ownerID int, name, description string) (int64,
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`
|
||||
INSERT INTO syndicate_members (syndicate_id, user_id, accepted)
|
||||
VALUES (?, ?, 1)
|
||||
INSERT INTO syndicate_members (syndicate_id, user_id, role, joined_at)
|
||||
VALUES (?, ?, 'manager', CURRENT_TIMESTAMP)
|
||||
`, syndicateID, ownerID)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to add owner as member: %w", err)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
<a href="/syndicates" class="btn btn-secondary">Cancel</a>
|
||||
<a href="/syndicate" class="btn btn-secondary">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user