Skip to content

Commit

Permalink
feat(backend): allow setting rpe for sets
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Dec 11, 2024
1 parent 5977c91 commit 0aac9ed
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/models/fitness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ pub struct WorkoutSetTotals {
#[serde(rename_all = "snake_case")]
pub struct WorkoutSetRecord {
pub lot: SetLot,
pub rpe: Option<u8>,
pub note: Option<String>,
pub rest_time: Option<u16>,
pub actual_rest_time: Option<i64>,
Expand Down Expand Up @@ -571,6 +572,7 @@ pub struct UserMeasurementsListInput {
#[derive(Clone, Debug, Deserialize, Serialize, InputObject)]
pub struct UserWorkoutSetRecord {
pub lot: SetLot,
pub rpe: Option<u8>,
pub note: Option<String>,
pub rest_time: Option<u16>,
pub statistic: WorkoutSetStatistic,
Expand Down
1 change: 1 addition & 0 deletions crates/services/fitness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ impl FitnessService {
.into_iter()
.map(|s| WorkoutSetRecord {
lot: s.lot,
rpe: s.rpe,
note: s.note,
totals: None,
confirmed_at: None,
Expand Down
1 change: 1 addition & 0 deletions crates/services/importer/src/strong_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ async fn import_exercises(
distance: set.distance.and_then(|d| d.checked_div(dec!(1000))),
..Default::default()
},
rpe: None,
note: None,
lot: set_lot,
rest_time: None,
Expand Down
4 changes: 3 additions & 1 deletion crates/utils/dependent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ pub async fn create_or_update_workout(
}
let mut value = WorkoutSetRecord {
lot: set.lot,
rpe: set.rpe,
actual_rest_time,
totals: Some(totals),
note: set.note.clone(),
Expand Down Expand Up @@ -2397,9 +2398,10 @@ pub fn db_workout_to_workout_input(user_workout: workout::Model) -> UserWorkoutI
.into_iter()
.map(|s| UserWorkoutSetRecord {
lot: s.lot,
rpe: s.rpe,
note: s.note,
statistic: s.statistic,
rest_time: s.rest_time,
statistic: s.statistic,
confirmed_at: s.confirmed_at,
})
.collect(),
Expand Down
1 change: 1 addition & 0 deletions docs/includes/export-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export interface WorkoutSetRecord {
note: string | null;
personal_bests: WorkoutSetPersonalBest[] | null;
rest_time: number | null;
rpe: number | null;
statistic: WorkoutSetStatistic;
totals: WorkoutSetTotals | null;
}
Expand Down
2 changes: 2 additions & 0 deletions libs/generated/src/graphql/backend/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,7 @@ export type UserWorkoutSetRecord = {
lot: SetLot;
note?: InputMaybe<Scalars['String']['input']>;
restTime?: InputMaybe<Scalars['Int']['input']>;
rpe?: InputMaybe<Scalars['Int']['input']>;
statistic: SetStatisticInput;
};

Expand Down Expand Up @@ -2777,6 +2778,7 @@ export type WorkoutSetRecord = {
note?: Maybe<Scalars['String']['output']>;
personalBests?: Maybe<Array<WorkoutSetPersonalBest>>;
restTime?: Maybe<Scalars['Int']['output']>;
rpe?: Maybe<Scalars['Int']['output']>;
statistic: WorkoutSetStatistic;
totals?: Maybe<WorkoutSetTotals>;
};
Expand Down
2 changes: 2 additions & 0 deletions libs/generated/src/graphql/backend/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2765,6 +2765,7 @@ export type UserWorkoutSetRecord = {
lot: SetLot;
note?: InputMaybe<Scalars['String']['input']>;
restTime?: InputMaybe<Scalars['Int']['input']>;
rpe?: InputMaybe<Scalars['Int']['input']>;
statistic: SetStatisticInput;
};

Expand Down Expand Up @@ -2898,6 +2899,7 @@ export type WorkoutSetRecord = {
note?: Maybe<Scalars['String']['output']>;
personalBests?: Maybe<Array<WorkoutSetPersonalBest>>;
restTime?: Maybe<Scalars['Int']['output']>;
rpe?: Maybe<Scalars['Int']['output']>;
statistic: WorkoutSetStatistic;
totals?: Maybe<WorkoutSetTotals>;
};
Expand Down

0 comments on commit 0aac9ed

Please sign in to comment.