Skip to content

labeling node backend refactor for frontend fields#74

Merged
itang06 merged 3 commits intofeature/label-nodefrom
feature/label/backend
Mar 15, 2026
Merged

labeling node backend refactor for frontend fields#74
itang06 merged 3 commits intofeature/label-nodefrom
feature/label/backend

Conversation

@itang06
Copy link

@itang06 itang06 commented Mar 11, 2026

What?

Updated the time_labels backend to support additional fields required by the frontend:

  • Renamed timestamp to start_timestamp
  • Added end_timestamp (nullable for in progress labels)
  • Added color (required) to store the label's display color


How?

Migration (update_time_labels.sql):

  • Renames timestamp to start_timestamp
  • Adds nullable end_timestamp TIMESTAMPTZ
  • Adds color TEXT NOT NULL

Models (models.rs):

  • Updated TimeLabel and NewTimeLabel structs to include start_timestamp, end_timestamp (as Option<DateTime>), and color

DB functions (db.rs):

  • insert_time_labels(); updated column list and bindings to include new fields
  • get_time_labels_by_range(); updated SELECT and WHERE to use start_timestamp

Testing

Postman testing:
get session id

  1. POST /api/sessions - created session to get a valid session_id

post timestamps

2. POST /api/sessions/:id/time-label - 201 response, posted first label with start_timestamp, end_timestamp, label, and color

post timestamps null end

3. POST /api/sessions/:id/time-label - 201 response, posted second label with end_timestamp: null to verify nullable case

get label by timestamps

4. GET /api/sessions/:id/time-label?start=...&end=... - wide time range returns both labels, including the one with null

get label by timestamps no first

5. GET /api/sessions/:id/time-label?start=...&end=... - narrow range starting after the first label ends returns only the second

@github-actions
Copy link

github-actions bot commented Mar 11, 2026

✅ PR approval conditions satisfied (1 lead OR 2 team members approved).
[Last checked: 2026-03-15T17:44:59.557Z]

Copy link
Collaborator

@HeisSteve HeisSteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot requested a review from HeisSteve March 15, 2026 17:44
@itang06 itang06 merged commit 561bf6f into feature/label-node Mar 15, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants