mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-29 09:20:56 +01:00
54 lines
1.0 KiB
Dart
54 lines
1.0 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:wger/helpers/json.dart';
|
|
|
|
part 'log.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class Log {
|
|
@JsonKey(required: true)
|
|
final int id;
|
|
|
|
@JsonKey(required: true)
|
|
int exercise;
|
|
|
|
@JsonKey(required: true, name: 'workout')
|
|
int workoutPlan;
|
|
|
|
@JsonKey(required: true)
|
|
int reps;
|
|
|
|
@JsonKey(required: false)
|
|
double rir;
|
|
|
|
@JsonKey(required: true, name: 'repetition_unit')
|
|
int repetitionUnit;
|
|
|
|
@JsonKey(required: true, fromJson: toNum, toJson: toString)
|
|
num weight;
|
|
|
|
@JsonKey(required: true, name: 'weight_unit')
|
|
int weightUnit;
|
|
|
|
@JsonKey(required: true, toJson: toDate)
|
|
DateTime date;
|
|
|
|
//@JsonKey(required: true)
|
|
//String comment;
|
|
|
|
Log({
|
|
this.id,
|
|
this.exercise,
|
|
this.workoutPlan,
|
|
this.repetitionUnit,
|
|
this.reps,
|
|
this.rir,
|
|
this.weight,
|
|
this.weightUnit,
|
|
this.date,
|
|
});
|
|
|
|
// Boilerplate
|
|
factory Log.fromJson(Map<String, dynamic> json) => _$LogFromJson(json);
|
|
Map<String, dynamic> toJson() => _$LogToJson(this);
|
|
}
|