Skip to content

Commit

Permalink
Merge pull request #10 from Guthax/1-create-persistence-layer
Browse files Browse the repository at this point in the history
added persistence layer and some forms
  • Loading branch information
Guthax authored Jan 25, 2024
2 parents aa6d250 + 427735c commit 75c653c
Show file tree
Hide file tree
Showing 21 changed files with 1,434 additions and 60 deletions.
5 changes: 0 additions & 5 deletions reptrack/lib/classes/exercise.dart

This file was deleted.

9 changes: 0 additions & 9 deletions reptrack/lib/classes/schedule.dart

This file was deleted.

76 changes: 76 additions & 0 deletions reptrack/lib/classes/schemas.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@


import 'package:realm/realm.dart';
part 'schemas.g.dart';

@RealmModel()
class _User {
@PrimaryKey()
@MapTo("_id")
late final ObjectId userId;

late final String name = "Jurriaan";
late _WorkoutSchedule? activeSchedule;
}
@RealmModel()
class _WorkoutSchedule {
@PrimaryKey()
@MapTo("_id")
late final ObjectId scheduleId;

late String name = "Push Pull Legs";
late int numWeeks = 6;

late int startingWeightKg = 60;
late int finishWeightKg = 90;
late DateTime? dateStarted;

late List<_TrainingSession> sessions = List.empty();
late List<_Workout> workouts = List.empty();
late _Workout? activeWorkout;

}


@RealmModel()
class _TrainingSession {
@PrimaryKey()
@MapTo("_id")
late final ObjectId sessionId;

late DateTime? dateStarted;
late DateTime? dateEnded;

late List<_SessionExercise> exercises = List.empty();

}

@RealmModel()
class _SessionExercise {
late _Exercise? exercise;
late int sets = 2;
late List<int> repsPerSet = List.empty();
late List<int> weightPerSetKg = List.empty();
late String? comment;
}

@RealmModel()
class _Workout {
@PrimaryKey()
@MapTo("_id")
late final ObjectId workoutId;
late final int day;
late List<_Exercise> exercises = List.empty();

}


@RealmModel()
class _Exercise {

@PrimaryKey()
String? name;

late String? description;
late String? muscles;
}
Loading

0 comments on commit 75c653c

Please sign in to comment.