Open theebank opened 9 months ago
These arrows should only be rendered if there is something to expand
Need to remodel how data is being set to backend
Collects and structures the data in an easily manageable format:
data: {
programname: "...",
exercises: [
{
exerciseid: "...",
exercisename: "...",
sets: [
{ set: 1, reps: 8, RPE: 7, Notes: "Felt good" },
{ set: 2, reps: 8, RPE: 8, Notes: "Tough but manageable" },
]
},
]
}
Receives the data and processes it to fit the relational database schema: Extracts the programname and creates a new workout program entry if needed. Iterates through each exercise in the exercises array: Checks if the exerciseid already exists or if a new record should be created. For each set in the sets array, creates a new entry in the Sets Table with the corresponding exerciseid, reps, RPE, and Notes.
The workout plan, exercises, and sets are all stored in their respective tables, with relationships defined by foreign keys. This could involve multiple insert queries, potentially within a transaction to ensure data consistency.
Step 1: Add exercises to workout cart
Step 2: Add desired amount of sets + info (reps, rpe, notes) to each exercise
Step 3: name workout
Workouts
API Endpoints needed: GET - all workout routines associated with user - Need to implement users first
GET - details of each exercise associated with routinePOST - create new workout routinePOST - create set of program exercises associated with new workout routine