Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added persistence layer and some forms #10

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading