]> littlesong.place Git - littlesongplace.git/commitdiff
Sketch out jam schema and API
authorChris Fulljames <christianfulljames@gmail.com>
Tue, 8 Apr 2025 11:38:05 +0000 (07:38 -0400)
committerChris Fulljames <christianfulljames@gmail.com>
Tue, 8 Apr 2025 11:38:05 +0000 (07:38 -0400)
src/littlesongplace/jams.py
src/littlesongplace/sql/schema_update.sql

index f744958be95cdd0b50145194627a7c88a440f3c5..1e729a18571bba998474b987c36789b8037ed6af 100644 (file)
@@ -2,6 +2,54 @@ from flask import Blueprint, render_template
 
 bp = Blueprint("jams", __name__, url_prefix="/jams")
 
-@bp.get("/<int:jamid>")
+@bp.get("/")
+def jams():
+    # Show a list of all jams: current, upcoming, previous
+    ...
+
+@bp.get("/create")
+def create():
+    # Create a new jam and redirect to the edit form
+    ...
+
+@bp.get("/<jamid>")
 def jam(jamid):
+    # Show the current/most recent event
+    # TODO: Redirect to current event page
     return render_template("jam.html")
+
+@bp.post("/<jamid>/update")
+def update(jamid):
+    # Update a jam with the new form data, redirect to view page
+    ...
+
+@bp.get("/<jamid>/delete")
+def delete(jamid):
+    # Delete a jam, redirect to the jams list
+    ...
+
+@bp.get("/<jamid>/events")
+def events(jamid):
+    # Show a list of all events for the jam
+    ...
+
+@bp.get("/<jamid>/events/create")
+def events_create():
+    # Create a new event and redirect to the edit form
+    ...
+
+@bp.get("/<jamid>/events/<int:eventid>")
+def events_view(eventid):
+    # Show the event page
+    ...
+
+@bp.post("/<jamid>/events/<int:eventid>/update")
+def events_update(jamid):
+    # Update an event with the new form data
+    ...
+
+@bp.get("/<jamid>/events/<int:eventid>/delete")
+def events_delete(jamid):
+    # Delete an event, redirect to list of all events
+    ...
+
index 139597f9cb07c5d48bed18984ec4747f4b4f3438..fb4cc15648d1acf9ca180850fc6bcb649095f514 100644 (file)
@@ -1,2 +1,23 @@
+--DROP TABLE IF EXISTS jams;
+CREATE TABLE jams (
+    jamid INTEGER PRIMARY KEY,
+    owner INTEGER NOT NULL,
+    created TEXT NOT NULL,
+    title TEXT NOT NULL,
+    description TEXT,
+    FOREIGN KEY(owner) REFERENCES users(userid)
+);
 
-
+--DROP TABLE IF EXISTS jam_events;
+CREATE TABLE jam_events(
+    eventid INTEGER PRIMARY KEY,
+    jamid INTEGER NOT NULL,
+    created TEXT NOT NULL,
+    title TEXT NOT NULL,
+    startdate TEXT NOT NULL,
+    enddate TEXT NOT NULL,
+    threadid INTEGER NOT NULL,
+    description TEXT,
+    FOREIGN KEY(jamid) REFERENCES jams(jamid),
+    FOREIGN KEY(threadid) REFERENCES comment_threads(threadid)
+);