seed update, action prep, titleization
This commit is contained in:
parent
ffd696053a
commit
c6030f8ac5
35
lib/daos/actions_dao.dart
Normal file
35
lib/daos/actions_dao.dart
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
|
||||||
|
part 'actions_dao.g.dart';
|
||||||
|
|
||||||
|
@DriftAccessor(tables: [Actions])
|
||||||
|
class ActionsDao extends DatabaseAccessor<AppDatabase> with _$ActionsDaoMixin {
|
||||||
|
ActionsDao(super.db);
|
||||||
|
|
||||||
|
Future<List<Action>> all() async {
|
||||||
|
return await select(actions).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Action> find(int id) async {
|
||||||
|
return await (select(actions)..where((action) => action.id.equals(id) )).getSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Action>> fromActivity(Activity activity) async {
|
||||||
|
final result = select(db.activityActions).join(
|
||||||
|
[
|
||||||
|
innerJoin(
|
||||||
|
db.actions,
|
||||||
|
db.actions.id.equalsExp(db.activityActions.actionId),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
..where(db.activityActions.activityId.equals(activity.id));
|
||||||
|
|
||||||
|
final actions = (await result.get())
|
||||||
|
.map((e) => e.readTable(db.actions))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
}
|
8
lib/daos/actions_dao.g.dart
Normal file
8
lib/daos/actions_dao.g.dart
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'actions_dao.dart';
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
mixin _$ActionsDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||||
|
$ActionsTable get actions => attachedDatabase.actions;
|
||||||
|
}
|
30
lib/daos/activity_actions_dao.dart
Normal file
30
lib/daos/activity_actions_dao.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
|
||||||
|
part 'activity_actions_dao.g.dart';
|
||||||
|
|
||||||
|
@DriftAccessor(tables: [ActivityActions])
|
||||||
|
class ActivityActionsDao extends DatabaseAccessor<AppDatabase> with _$ActivityActionsDaoMixin {
|
||||||
|
ActivityActionsDao(super.db);
|
||||||
|
|
||||||
|
Future<List<ActivityAction>> all() => select(activityActions).get();
|
||||||
|
Stream<List<ActivityAction>> watch() => select(activityActions).watch();
|
||||||
|
Future insert(ActivityAction activityAction) => into(activityActions).insert(activityAction);
|
||||||
|
Future replace(ActivityAction activityAction) => update(activityActions).replace(activityAction);
|
||||||
|
Future remove(ActivityAction activityAction) => delete(activityActions).delete(activityAction);
|
||||||
|
|
||||||
|
// Future<List<ActivityAction>> all() async {
|
||||||
|
// return await select(activityActions).get();
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<ActivityAction> find(int id) async {
|
||||||
|
return await (select(activityActions)..where((activityAction) => activityAction.id.equals(id) )).getSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<ActivityAction>> fromActivityId(int id) async {
|
||||||
|
final result = db.managers.activityActions
|
||||||
|
.filter((activityAction) => activityAction.activityId.id(id));
|
||||||
|
|
||||||
|
return result.get();
|
||||||
|
}
|
||||||
|
}
|
10
lib/daos/activity_actions_dao.g.dart
Normal file
10
lib/daos/activity_actions_dao.g.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'activity_actions_dao.dart';
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
mixin _$ActivityActionsDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||||
|
$ActivitiesTable get activities => attachedDatabase.activities;
|
||||||
|
$ActionsTable get actions => attachedDatabase.actions;
|
||||||
|
$ActivityActionsTable get activityActions => attachedDatabase.activityActions;
|
||||||
|
}
|
@ -1,11 +1,62 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:drift_flutter/drift_flutter.dart';
|
import 'package:drift_flutter/drift_flutter.dart';
|
||||||
|
import 'package:sendtrain/daos/actions_dao.dart';
|
||||||
import 'package:sendtrain/daos/activities_dao.dart';
|
import 'package:sendtrain/daos/activities_dao.dart';
|
||||||
|
import 'package:sendtrain/daos/activity_actions_dao.dart';
|
||||||
|
import 'package:sendtrain/daos/media_items_dao.dart';
|
||||||
|
import 'package:sendtrain/daos/session_activities_dao.dart';
|
||||||
import 'package:sendtrain/daos/sessions_dao.dart';
|
import 'package:sendtrain/daos/sessions_dao.dart';
|
||||||
import 'package:sendtrain/database/seed.dart';
|
import 'package:sendtrain/database/seed.dart';
|
||||||
|
|
||||||
part 'database.g.dart';
|
part 'database.g.dart';
|
||||||
|
|
||||||
|
@DriftDatabase(tables: [
|
||||||
|
Sessions,
|
||||||
|
SessionActivities,
|
||||||
|
Activities,
|
||||||
|
ActivityActions,
|
||||||
|
Actions,
|
||||||
|
ObjectMediaItems,
|
||||||
|
MediaItems
|
||||||
|
], daos: [
|
||||||
|
SessionsDao,
|
||||||
|
ActivitiesDao,
|
||||||
|
MediaItemsDao,
|
||||||
|
SessionActivitiesDao,
|
||||||
|
ActivityActionsDao,
|
||||||
|
ActionsDao
|
||||||
|
])
|
||||||
|
class AppDatabase extends _$AppDatabase {
|
||||||
|
// After generating code, this class needs to define a `schemaVersion` getter
|
||||||
|
// and a constructor telling drift where the database should be stored.
|
||||||
|
// These are described in the getting started guide: https://drift.simonbinder.eu/setup/
|
||||||
|
AppDatabase() : super(_openConnection());
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get schemaVersion => 4;
|
||||||
|
|
||||||
|
@override
|
||||||
|
MigrationStrategy get migration {
|
||||||
|
return MigrationStrategy(
|
||||||
|
onCreate: (m) async {
|
||||||
|
await m.createAll().then((r) async {
|
||||||
|
await seedDb(this);
|
||||||
|
}); // create all tables
|
||||||
|
},
|
||||||
|
beforeOpen: (details) async {
|
||||||
|
/// Enable foreign_keys
|
||||||
|
await customStatement('PRAGMA foreign_keys = ON');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static QueryExecutor _openConnection() {
|
||||||
|
// `driftDatabase` from `package:drift_flutter` stores the database in
|
||||||
|
// `getApplicationDocumentsDirectory()`.
|
||||||
|
return driftDatabase(name: 'sendtrain');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum SessionStatus { pending, started, completed, missed }
|
enum SessionStatus { pending, started, completed, missed }
|
||||||
|
|
||||||
class Sessions extends Table {
|
class Sessions extends Table {
|
||||||
@ -22,6 +73,7 @@ class SessionActivities extends Table {
|
|||||||
IntColumn get id => integer().autoIncrement()();
|
IntColumn get id => integer().autoIncrement()();
|
||||||
IntColumn get sessionId => integer().references(Sessions, #id)();
|
IntColumn get sessionId => integer().references(Sessions, #id)();
|
||||||
IntColumn get activityId => integer().references(Activities, #id)();
|
IntColumn get activityId => integer().references(Activities, #id)();
|
||||||
|
IntColumn get position => integer()();
|
||||||
TextColumn get results => text().nullable()();
|
TextColumn get results => text().nullable()();
|
||||||
TextColumn get achievements => text().nullable()();
|
TextColumn get achievements => text().nullable()();
|
||||||
DateTimeColumn get createdAt =>
|
DateTimeColumn get createdAt =>
|
||||||
@ -57,6 +109,7 @@ class ActivityActions extends Table {
|
|||||||
IntColumn get id => integer().autoIncrement()();
|
IntColumn get id => integer().autoIncrement()();
|
||||||
IntColumn get activityId => integer().references(Activities, #id)();
|
IntColumn get activityId => integer().references(Activities, #id)();
|
||||||
IntColumn get actionId => integer().references(Actions, #id)();
|
IntColumn get actionId => integer().references(Actions, #id)();
|
||||||
|
IntColumn get position => integer()();
|
||||||
DateTimeColumn get createdAt =>
|
DateTimeColumn get createdAt =>
|
||||||
dateTime().withDefault(Variable(DateTime.now()))();
|
dateTime().withDefault(Variable(DateTime.now()))();
|
||||||
}
|
}
|
||||||
@ -96,47 +149,3 @@ class MediaItems extends Table {
|
|||||||
DateTimeColumn get createdAt =>
|
DateTimeColumn get createdAt =>
|
||||||
dateTime().withDefault(Variable(DateTime.now()))();
|
dateTime().withDefault(Variable(DateTime.now()))();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DriftDatabase(tables: [
|
|
||||||
Sessions,
|
|
||||||
SessionActivities,
|
|
||||||
Activities,
|
|
||||||
ActivityActions,
|
|
||||||
Actions,
|
|
||||||
ObjectMediaItems,
|
|
||||||
MediaItems
|
|
||||||
], daos: [
|
|
||||||
SessionsDao,
|
|
||||||
ActivitiesDao,
|
|
||||||
MediaItems
|
|
||||||
])
|
|
||||||
class AppDatabase extends _$AppDatabase {
|
|
||||||
// After generating code, this class needs to define a `schemaVersion` getter
|
|
||||||
// and a constructor telling drift where the database should be stored.
|
|
||||||
// These are described in the getting started guide: https://drift.simonbinder.eu/setup/
|
|
||||||
AppDatabase() : super(_openConnection());
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get schemaVersion => 2;
|
|
||||||
|
|
||||||
@override
|
|
||||||
MigrationStrategy get migration {
|
|
||||||
return MigrationStrategy(
|
|
||||||
onCreate: (m) async {
|
|
||||||
await m.createAll().then((r) async {
|
|
||||||
await seedDb(this);
|
|
||||||
}); // create all tablesables
|
|
||||||
},
|
|
||||||
beforeOpen: (details) async {
|
|
||||||
/// Enable foreign_keys
|
|
||||||
await customStatement('PRAGMA foreign_keys = ON');
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QueryExecutor _openConnection() {
|
|
||||||
// `driftDatabase` from `package:drift_flutter` stores the database in
|
|
||||||
// `getApplicationDocumentsDirectory()`.
|
|
||||||
return driftDatabase(name: 'sendtrain');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -725,6 +725,12 @@ class $SessionActivitiesTable extends SessionActivities
|
|||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
defaultConstraints:
|
defaultConstraints:
|
||||||
GeneratedColumn.constraintIsAlways('REFERENCES activities (id)'));
|
GeneratedColumn.constraintIsAlways('REFERENCES activities (id)'));
|
||||||
|
static const VerificationMeta _positionMeta =
|
||||||
|
const VerificationMeta('position');
|
||||||
|
@override
|
||||||
|
late final GeneratedColumn<int> position = GeneratedColumn<int>(
|
||||||
|
'position', aliasedName, false,
|
||||||
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
||||||
static const VerificationMeta _resultsMeta =
|
static const VerificationMeta _resultsMeta =
|
||||||
const VerificationMeta('results');
|
const VerificationMeta('results');
|
||||||
@override
|
@override
|
||||||
@ -747,7 +753,7 @@ class $SessionActivitiesTable extends SessionActivities
|
|||||||
defaultValue: Variable(DateTime.now()));
|
defaultValue: Variable(DateTime.now()));
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns =>
|
List<GeneratedColumn> get $columns =>
|
||||||
[id, sessionId, activityId, results, achievements, createdAt];
|
[id, sessionId, activityId, position, results, achievements, createdAt];
|
||||||
@override
|
@override
|
||||||
String get aliasedName => _alias ?? actualTableName;
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
@override
|
@override
|
||||||
@ -775,6 +781,12 @@ class $SessionActivitiesTable extends SessionActivities
|
|||||||
} else if (isInserting) {
|
} else if (isInserting) {
|
||||||
context.missing(_activityIdMeta);
|
context.missing(_activityIdMeta);
|
||||||
}
|
}
|
||||||
|
if (data.containsKey('position')) {
|
||||||
|
context.handle(_positionMeta,
|
||||||
|
position.isAcceptableOrUnknown(data['position']!, _positionMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_positionMeta);
|
||||||
|
}
|
||||||
if (data.containsKey('results')) {
|
if (data.containsKey('results')) {
|
||||||
context.handle(_resultsMeta,
|
context.handle(_resultsMeta,
|
||||||
results.isAcceptableOrUnknown(data['results']!, _resultsMeta));
|
results.isAcceptableOrUnknown(data['results']!, _resultsMeta));
|
||||||
@ -804,6 +816,8 @@ class $SessionActivitiesTable extends SessionActivities
|
|||||||
.read(DriftSqlType.int, data['${effectivePrefix}session_id'])!,
|
.read(DriftSqlType.int, data['${effectivePrefix}session_id'])!,
|
||||||
activityId: attachedDatabase.typeMapping
|
activityId: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!,
|
.read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!,
|
||||||
|
position: attachedDatabase.typeMapping
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}position'])!,
|
||||||
results: attachedDatabase.typeMapping
|
results: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.string, data['${effectivePrefix}results']),
|
.read(DriftSqlType.string, data['${effectivePrefix}results']),
|
||||||
achievements: attachedDatabase.typeMapping
|
achievements: attachedDatabase.typeMapping
|
||||||
@ -823,6 +837,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
final int id;
|
final int id;
|
||||||
final int sessionId;
|
final int sessionId;
|
||||||
final int activityId;
|
final int activityId;
|
||||||
|
final int position;
|
||||||
final String? results;
|
final String? results;
|
||||||
final String? achievements;
|
final String? achievements;
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
@ -830,6 +845,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
{required this.id,
|
{required this.id,
|
||||||
required this.sessionId,
|
required this.sessionId,
|
||||||
required this.activityId,
|
required this.activityId,
|
||||||
|
required this.position,
|
||||||
this.results,
|
this.results,
|
||||||
this.achievements,
|
this.achievements,
|
||||||
required this.createdAt});
|
required this.createdAt});
|
||||||
@ -839,6 +855,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['session_id'] = Variable<int>(sessionId);
|
map['session_id'] = Variable<int>(sessionId);
|
||||||
map['activity_id'] = Variable<int>(activityId);
|
map['activity_id'] = Variable<int>(activityId);
|
||||||
|
map['position'] = Variable<int>(position);
|
||||||
if (!nullToAbsent || results != null) {
|
if (!nullToAbsent || results != null) {
|
||||||
map['results'] = Variable<String>(results);
|
map['results'] = Variable<String>(results);
|
||||||
}
|
}
|
||||||
@ -854,6 +871,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
id: Value(id),
|
id: Value(id),
|
||||||
sessionId: Value(sessionId),
|
sessionId: Value(sessionId),
|
||||||
activityId: Value(activityId),
|
activityId: Value(activityId),
|
||||||
|
position: Value(position),
|
||||||
results: results == null && nullToAbsent
|
results: results == null && nullToAbsent
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(results),
|
: Value(results),
|
||||||
@ -871,6 +889,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
sessionId: serializer.fromJson<int>(json['sessionId']),
|
sessionId: serializer.fromJson<int>(json['sessionId']),
|
||||||
activityId: serializer.fromJson<int>(json['activityId']),
|
activityId: serializer.fromJson<int>(json['activityId']),
|
||||||
|
position: serializer.fromJson<int>(json['position']),
|
||||||
results: serializer.fromJson<String?>(json['results']),
|
results: serializer.fromJson<String?>(json['results']),
|
||||||
achievements: serializer.fromJson<String?>(json['achievements']),
|
achievements: serializer.fromJson<String?>(json['achievements']),
|
||||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||||
@ -883,6 +902,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
'sessionId': serializer.toJson<int>(sessionId),
|
'sessionId': serializer.toJson<int>(sessionId),
|
||||||
'activityId': serializer.toJson<int>(activityId),
|
'activityId': serializer.toJson<int>(activityId),
|
||||||
|
'position': serializer.toJson<int>(position),
|
||||||
'results': serializer.toJson<String?>(results),
|
'results': serializer.toJson<String?>(results),
|
||||||
'achievements': serializer.toJson<String?>(achievements),
|
'achievements': serializer.toJson<String?>(achievements),
|
||||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||||
@ -893,6 +913,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
{int? id,
|
{int? id,
|
||||||
int? sessionId,
|
int? sessionId,
|
||||||
int? activityId,
|
int? activityId,
|
||||||
|
int? position,
|
||||||
Value<String?> results = const Value.absent(),
|
Value<String?> results = const Value.absent(),
|
||||||
Value<String?> achievements = const Value.absent(),
|
Value<String?> achievements = const Value.absent(),
|
||||||
DateTime? createdAt}) =>
|
DateTime? createdAt}) =>
|
||||||
@ -900,6 +921,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
sessionId: sessionId ?? this.sessionId,
|
sessionId: sessionId ?? this.sessionId,
|
||||||
activityId: activityId ?? this.activityId,
|
activityId: activityId ?? this.activityId,
|
||||||
|
position: position ?? this.position,
|
||||||
results: results.present ? results.value : this.results,
|
results: results.present ? results.value : this.results,
|
||||||
achievements:
|
achievements:
|
||||||
achievements.present ? achievements.value : this.achievements,
|
achievements.present ? achievements.value : this.achievements,
|
||||||
@ -911,6 +933,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId,
|
sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId,
|
||||||
activityId:
|
activityId:
|
||||||
data.activityId.present ? data.activityId.value : this.activityId,
|
data.activityId.present ? data.activityId.value : this.activityId,
|
||||||
|
position: data.position.present ? data.position.value : this.position,
|
||||||
results: data.results.present ? data.results.value : this.results,
|
results: data.results.present ? data.results.value : this.results,
|
||||||
achievements: data.achievements.present
|
achievements: data.achievements.present
|
||||||
? data.achievements.value
|
? data.achievements.value
|
||||||
@ -925,6 +948,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('sessionId: $sessionId, ')
|
..write('sessionId: $sessionId, ')
|
||||||
..write('activityId: $activityId, ')
|
..write('activityId: $activityId, ')
|
||||||
|
..write('position: $position, ')
|
||||||
..write('results: $results, ')
|
..write('results: $results, ')
|
||||||
..write('achievements: $achievements, ')
|
..write('achievements: $achievements, ')
|
||||||
..write('createdAt: $createdAt')
|
..write('createdAt: $createdAt')
|
||||||
@ -933,8 +957,8 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode => Object.hash(
|
||||||
Object.hash(id, sessionId, activityId, results, achievements, createdAt);
|
id, sessionId, activityId, position, results, achievements, createdAt);
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
@ -942,6 +966,7 @@ class SessionActivity extends DataClass implements Insertable<SessionActivity> {
|
|||||||
other.id == this.id &&
|
other.id == this.id &&
|
||||||
other.sessionId == this.sessionId &&
|
other.sessionId == this.sessionId &&
|
||||||
other.activityId == this.activityId &&
|
other.activityId == this.activityId &&
|
||||||
|
other.position == this.position &&
|
||||||
other.results == this.results &&
|
other.results == this.results &&
|
||||||
other.achievements == this.achievements &&
|
other.achievements == this.achievements &&
|
||||||
other.createdAt == this.createdAt);
|
other.createdAt == this.createdAt);
|
||||||
@ -951,6 +976,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
final Value<int> id;
|
final Value<int> id;
|
||||||
final Value<int> sessionId;
|
final Value<int> sessionId;
|
||||||
final Value<int> activityId;
|
final Value<int> activityId;
|
||||||
|
final Value<int> position;
|
||||||
final Value<String?> results;
|
final Value<String?> results;
|
||||||
final Value<String?> achievements;
|
final Value<String?> achievements;
|
||||||
final Value<DateTime> createdAt;
|
final Value<DateTime> createdAt;
|
||||||
@ -958,6 +984,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.sessionId = const Value.absent(),
|
this.sessionId = const Value.absent(),
|
||||||
this.activityId = const Value.absent(),
|
this.activityId = const Value.absent(),
|
||||||
|
this.position = const Value.absent(),
|
||||||
this.results = const Value.absent(),
|
this.results = const Value.absent(),
|
||||||
this.achievements = const Value.absent(),
|
this.achievements = const Value.absent(),
|
||||||
this.createdAt = const Value.absent(),
|
this.createdAt = const Value.absent(),
|
||||||
@ -966,15 +993,18 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
required int sessionId,
|
required int sessionId,
|
||||||
required int activityId,
|
required int activityId,
|
||||||
|
required int position,
|
||||||
this.results = const Value.absent(),
|
this.results = const Value.absent(),
|
||||||
this.achievements = const Value.absent(),
|
this.achievements = const Value.absent(),
|
||||||
this.createdAt = const Value.absent(),
|
this.createdAt = const Value.absent(),
|
||||||
}) : sessionId = Value(sessionId),
|
}) : sessionId = Value(sessionId),
|
||||||
activityId = Value(activityId);
|
activityId = Value(activityId),
|
||||||
|
position = Value(position);
|
||||||
static Insertable<SessionActivity> custom({
|
static Insertable<SessionActivity> custom({
|
||||||
Expression<int>? id,
|
Expression<int>? id,
|
||||||
Expression<int>? sessionId,
|
Expression<int>? sessionId,
|
||||||
Expression<int>? activityId,
|
Expression<int>? activityId,
|
||||||
|
Expression<int>? position,
|
||||||
Expression<String>? results,
|
Expression<String>? results,
|
||||||
Expression<String>? achievements,
|
Expression<String>? achievements,
|
||||||
Expression<DateTime>? createdAt,
|
Expression<DateTime>? createdAt,
|
||||||
@ -983,6 +1013,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
if (sessionId != null) 'session_id': sessionId,
|
if (sessionId != null) 'session_id': sessionId,
|
||||||
if (activityId != null) 'activity_id': activityId,
|
if (activityId != null) 'activity_id': activityId,
|
||||||
|
if (position != null) 'position': position,
|
||||||
if (results != null) 'results': results,
|
if (results != null) 'results': results,
|
||||||
if (achievements != null) 'achievements': achievements,
|
if (achievements != null) 'achievements': achievements,
|
||||||
if (createdAt != null) 'created_at': createdAt,
|
if (createdAt != null) 'created_at': createdAt,
|
||||||
@ -993,6 +1024,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
{Value<int>? id,
|
{Value<int>? id,
|
||||||
Value<int>? sessionId,
|
Value<int>? sessionId,
|
||||||
Value<int>? activityId,
|
Value<int>? activityId,
|
||||||
|
Value<int>? position,
|
||||||
Value<String?>? results,
|
Value<String?>? results,
|
||||||
Value<String?>? achievements,
|
Value<String?>? achievements,
|
||||||
Value<DateTime>? createdAt}) {
|
Value<DateTime>? createdAt}) {
|
||||||
@ -1000,6 +1032,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
sessionId: sessionId ?? this.sessionId,
|
sessionId: sessionId ?? this.sessionId,
|
||||||
activityId: activityId ?? this.activityId,
|
activityId: activityId ?? this.activityId,
|
||||||
|
position: position ?? this.position,
|
||||||
results: results ?? this.results,
|
results: results ?? this.results,
|
||||||
achievements: achievements ?? this.achievements,
|
achievements: achievements ?? this.achievements,
|
||||||
createdAt: createdAt ?? this.createdAt,
|
createdAt: createdAt ?? this.createdAt,
|
||||||
@ -1018,6 +1051,9 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
if (activityId.present) {
|
if (activityId.present) {
|
||||||
map['activity_id'] = Variable<int>(activityId.value);
|
map['activity_id'] = Variable<int>(activityId.value);
|
||||||
}
|
}
|
||||||
|
if (position.present) {
|
||||||
|
map['position'] = Variable<int>(position.value);
|
||||||
|
}
|
||||||
if (results.present) {
|
if (results.present) {
|
||||||
map['results'] = Variable<String>(results.value);
|
map['results'] = Variable<String>(results.value);
|
||||||
}
|
}
|
||||||
@ -1036,6 +1072,7 @@ class SessionActivitiesCompanion extends UpdateCompanion<SessionActivity> {
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('sessionId: $sessionId, ')
|
..write('sessionId: $sessionId, ')
|
||||||
..write('activityId: $activityId, ')
|
..write('activityId: $activityId, ')
|
||||||
|
..write('position: $position, ')
|
||||||
..write('results: $results, ')
|
..write('results: $results, ')
|
||||||
..write('achievements: $achievements, ')
|
..write('achievements: $achievements, ')
|
||||||
..write('createdAt: $createdAt')
|
..write('createdAt: $createdAt')
|
||||||
@ -1376,6 +1413,12 @@ class $ActivityActionsTable extends ActivityActions
|
|||||||
requiredDuringInsert: true,
|
requiredDuringInsert: true,
|
||||||
defaultConstraints:
|
defaultConstraints:
|
||||||
GeneratedColumn.constraintIsAlways('REFERENCES actions (id)'));
|
GeneratedColumn.constraintIsAlways('REFERENCES actions (id)'));
|
||||||
|
static const VerificationMeta _positionMeta =
|
||||||
|
const VerificationMeta('position');
|
||||||
|
@override
|
||||||
|
late final GeneratedColumn<int> position = GeneratedColumn<int>(
|
||||||
|
'position', aliasedName, false,
|
||||||
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
||||||
static const VerificationMeta _createdAtMeta =
|
static const VerificationMeta _createdAtMeta =
|
||||||
const VerificationMeta('createdAt');
|
const VerificationMeta('createdAt');
|
||||||
@override
|
@override
|
||||||
@ -1385,7 +1428,8 @@ class $ActivityActionsTable extends ActivityActions
|
|||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultValue: Variable(DateTime.now()));
|
defaultValue: Variable(DateTime.now()));
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, activityId, actionId, createdAt];
|
List<GeneratedColumn> get $columns =>
|
||||||
|
[id, activityId, actionId, position, createdAt];
|
||||||
@override
|
@override
|
||||||
String get aliasedName => _alias ?? actualTableName;
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
@override
|
@override
|
||||||
@ -1413,6 +1457,12 @@ class $ActivityActionsTable extends ActivityActions
|
|||||||
} else if (isInserting) {
|
} else if (isInserting) {
|
||||||
context.missing(_actionIdMeta);
|
context.missing(_actionIdMeta);
|
||||||
}
|
}
|
||||||
|
if (data.containsKey('position')) {
|
||||||
|
context.handle(_positionMeta,
|
||||||
|
position.isAcceptableOrUnknown(data['position']!, _positionMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_positionMeta);
|
||||||
|
}
|
||||||
if (data.containsKey('created_at')) {
|
if (data.containsKey('created_at')) {
|
||||||
context.handle(_createdAtMeta,
|
context.handle(_createdAtMeta,
|
||||||
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta));
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta));
|
||||||
@ -1432,6 +1482,8 @@ class $ActivityActionsTable extends ActivityActions
|
|||||||
.read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!,
|
.read(DriftSqlType.int, data['${effectivePrefix}activity_id'])!,
|
||||||
actionId: attachedDatabase.typeMapping
|
actionId: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.int, data['${effectivePrefix}action_id'])!,
|
.read(DriftSqlType.int, data['${effectivePrefix}action_id'])!,
|
||||||
|
position: attachedDatabase.typeMapping
|
||||||
|
.read(DriftSqlType.int, data['${effectivePrefix}position'])!,
|
||||||
createdAt: attachedDatabase.typeMapping
|
createdAt: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
|
||||||
);
|
);
|
||||||
@ -1447,11 +1499,13 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
final int id;
|
final int id;
|
||||||
final int activityId;
|
final int activityId;
|
||||||
final int actionId;
|
final int actionId;
|
||||||
|
final int position;
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
const ActivityAction(
|
const ActivityAction(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
required this.activityId,
|
required this.activityId,
|
||||||
required this.actionId,
|
required this.actionId,
|
||||||
|
required this.position,
|
||||||
required this.createdAt});
|
required this.createdAt});
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
@ -1459,6 +1513,7 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['activity_id'] = Variable<int>(activityId);
|
map['activity_id'] = Variable<int>(activityId);
|
||||||
map['action_id'] = Variable<int>(actionId);
|
map['action_id'] = Variable<int>(actionId);
|
||||||
|
map['position'] = Variable<int>(position);
|
||||||
map['created_at'] = Variable<DateTime>(createdAt);
|
map['created_at'] = Variable<DateTime>(createdAt);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@ -1468,6 +1523,7 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
id: Value(id),
|
id: Value(id),
|
||||||
activityId: Value(activityId),
|
activityId: Value(activityId),
|
||||||
actionId: Value(actionId),
|
actionId: Value(actionId),
|
||||||
|
position: Value(position),
|
||||||
createdAt: Value(createdAt),
|
createdAt: Value(createdAt),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1479,6 +1535,7 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
activityId: serializer.fromJson<int>(json['activityId']),
|
activityId: serializer.fromJson<int>(json['activityId']),
|
||||||
actionId: serializer.fromJson<int>(json['actionId']),
|
actionId: serializer.fromJson<int>(json['actionId']),
|
||||||
|
position: serializer.fromJson<int>(json['position']),
|
||||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1489,16 +1546,22 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
'activityId': serializer.toJson<int>(activityId),
|
'activityId': serializer.toJson<int>(activityId),
|
||||||
'actionId': serializer.toJson<int>(actionId),
|
'actionId': serializer.toJson<int>(actionId),
|
||||||
|
'position': serializer.toJson<int>(position),
|
||||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityAction copyWith(
|
ActivityAction copyWith(
|
||||||
{int? id, int? activityId, int? actionId, DateTime? createdAt}) =>
|
{int? id,
|
||||||
|
int? activityId,
|
||||||
|
int? actionId,
|
||||||
|
int? position,
|
||||||
|
DateTime? createdAt}) =>
|
||||||
ActivityAction(
|
ActivityAction(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
activityId: activityId ?? this.activityId,
|
activityId: activityId ?? this.activityId,
|
||||||
actionId: actionId ?? this.actionId,
|
actionId: actionId ?? this.actionId,
|
||||||
|
position: position ?? this.position,
|
||||||
createdAt: createdAt ?? this.createdAt,
|
createdAt: createdAt ?? this.createdAt,
|
||||||
);
|
);
|
||||||
ActivityAction copyWithCompanion(ActivityActionsCompanion data) {
|
ActivityAction copyWithCompanion(ActivityActionsCompanion data) {
|
||||||
@ -1507,6 +1570,7 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
activityId:
|
activityId:
|
||||||
data.activityId.present ? data.activityId.value : this.activityId,
|
data.activityId.present ? data.activityId.value : this.activityId,
|
||||||
actionId: data.actionId.present ? data.actionId.value : this.actionId,
|
actionId: data.actionId.present ? data.actionId.value : this.actionId,
|
||||||
|
position: data.position.present ? data.position.value : this.position,
|
||||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1517,13 +1581,15 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('activityId: $activityId, ')
|
..write('activityId: $activityId, ')
|
||||||
..write('actionId: $actionId, ')
|
..write('actionId: $actionId, ')
|
||||||
|
..write('position: $position, ')
|
||||||
..write('createdAt: $createdAt')
|
..write('createdAt: $createdAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(id, activityId, actionId, createdAt);
|
int get hashCode =>
|
||||||
|
Object.hash(id, activityId, actionId, position, createdAt);
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
@ -1531,6 +1597,7 @@ class ActivityAction extends DataClass implements Insertable<ActivityAction> {
|
|||||||
other.id == this.id &&
|
other.id == this.id &&
|
||||||
other.activityId == this.activityId &&
|
other.activityId == this.activityId &&
|
||||||
other.actionId == this.actionId &&
|
other.actionId == this.actionId &&
|
||||||
|
other.position == this.position &&
|
||||||
other.createdAt == this.createdAt);
|
other.createdAt == this.createdAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1538,30 +1605,36 @@ class ActivityActionsCompanion extends UpdateCompanion<ActivityAction> {
|
|||||||
final Value<int> id;
|
final Value<int> id;
|
||||||
final Value<int> activityId;
|
final Value<int> activityId;
|
||||||
final Value<int> actionId;
|
final Value<int> actionId;
|
||||||
|
final Value<int> position;
|
||||||
final Value<DateTime> createdAt;
|
final Value<DateTime> createdAt;
|
||||||
const ActivityActionsCompanion({
|
const ActivityActionsCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.activityId = const Value.absent(),
|
this.activityId = const Value.absent(),
|
||||||
this.actionId = const Value.absent(),
|
this.actionId = const Value.absent(),
|
||||||
|
this.position = const Value.absent(),
|
||||||
this.createdAt = const Value.absent(),
|
this.createdAt = const Value.absent(),
|
||||||
});
|
});
|
||||||
ActivityActionsCompanion.insert({
|
ActivityActionsCompanion.insert({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
required int activityId,
|
required int activityId,
|
||||||
required int actionId,
|
required int actionId,
|
||||||
|
required int position,
|
||||||
this.createdAt = const Value.absent(),
|
this.createdAt = const Value.absent(),
|
||||||
}) : activityId = Value(activityId),
|
}) : activityId = Value(activityId),
|
||||||
actionId = Value(actionId);
|
actionId = Value(actionId),
|
||||||
|
position = Value(position);
|
||||||
static Insertable<ActivityAction> custom({
|
static Insertable<ActivityAction> custom({
|
||||||
Expression<int>? id,
|
Expression<int>? id,
|
||||||
Expression<int>? activityId,
|
Expression<int>? activityId,
|
||||||
Expression<int>? actionId,
|
Expression<int>? actionId,
|
||||||
|
Expression<int>? position,
|
||||||
Expression<DateTime>? createdAt,
|
Expression<DateTime>? createdAt,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
if (activityId != null) 'activity_id': activityId,
|
if (activityId != null) 'activity_id': activityId,
|
||||||
if (actionId != null) 'action_id': actionId,
|
if (actionId != null) 'action_id': actionId,
|
||||||
|
if (position != null) 'position': position,
|
||||||
if (createdAt != null) 'created_at': createdAt,
|
if (createdAt != null) 'created_at': createdAt,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1570,11 +1643,13 @@ class ActivityActionsCompanion extends UpdateCompanion<ActivityAction> {
|
|||||||
{Value<int>? id,
|
{Value<int>? id,
|
||||||
Value<int>? activityId,
|
Value<int>? activityId,
|
||||||
Value<int>? actionId,
|
Value<int>? actionId,
|
||||||
|
Value<int>? position,
|
||||||
Value<DateTime>? createdAt}) {
|
Value<DateTime>? createdAt}) {
|
||||||
return ActivityActionsCompanion(
|
return ActivityActionsCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
activityId: activityId ?? this.activityId,
|
activityId: activityId ?? this.activityId,
|
||||||
actionId: actionId ?? this.actionId,
|
actionId: actionId ?? this.actionId,
|
||||||
|
position: position ?? this.position,
|
||||||
createdAt: createdAt ?? this.createdAt,
|
createdAt: createdAt ?? this.createdAt,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1591,6 +1666,9 @@ class ActivityActionsCompanion extends UpdateCompanion<ActivityAction> {
|
|||||||
if (actionId.present) {
|
if (actionId.present) {
|
||||||
map['action_id'] = Variable<int>(actionId.value);
|
map['action_id'] = Variable<int>(actionId.value);
|
||||||
}
|
}
|
||||||
|
if (position.present) {
|
||||||
|
map['position'] = Variable<int>(position.value);
|
||||||
|
}
|
||||||
if (createdAt.present) {
|
if (createdAt.present) {
|
||||||
map['created_at'] = Variable<DateTime>(createdAt.value);
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
||||||
}
|
}
|
||||||
@ -1603,6 +1681,7 @@ class ActivityActionsCompanion extends UpdateCompanion<ActivityAction> {
|
|||||||
..write('id: $id, ')
|
..write('id: $id, ')
|
||||||
..write('activityId: $activityId, ')
|
..write('activityId: $activityId, ')
|
||||||
..write('actionId: $actionId, ')
|
..write('actionId: $actionId, ')
|
||||||
|
..write('position: $position, ')
|
||||||
..write('createdAt: $createdAt')
|
..write('createdAt: $createdAt')
|
||||||
..write(')'))
|
..write(')'))
|
||||||
.toString();
|
.toString();
|
||||||
@ -2279,6 +2358,12 @@ abstract class _$AppDatabase extends GeneratedDatabase {
|
|||||||
$ObjectMediaItemsTable(this);
|
$ObjectMediaItemsTable(this);
|
||||||
late final SessionsDao sessionsDao = SessionsDao(this as AppDatabase);
|
late final SessionsDao sessionsDao = SessionsDao(this as AppDatabase);
|
||||||
late final ActivitiesDao activitiesDao = ActivitiesDao(this as AppDatabase);
|
late final ActivitiesDao activitiesDao = ActivitiesDao(this as AppDatabase);
|
||||||
|
late final MediaItemsDao mediaItemsDao = MediaItemsDao(this as AppDatabase);
|
||||||
|
late final SessionActivitiesDao sessionActivitiesDao =
|
||||||
|
SessionActivitiesDao(this as AppDatabase);
|
||||||
|
late final ActivityActionsDao activityActionsDao =
|
||||||
|
ActivityActionsDao(this as AppDatabase);
|
||||||
|
late final ActionsDao actionsDao = ActionsDao(this as AppDatabase);
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo<Table, Object?>> get allTables =>
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
||||||
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
||||||
@ -2910,6 +2995,7 @@ typedef $$SessionActivitiesTableCreateCompanionBuilder
|
|||||||
Value<int> id,
|
Value<int> id,
|
||||||
required int sessionId,
|
required int sessionId,
|
||||||
required int activityId,
|
required int activityId,
|
||||||
|
required int position,
|
||||||
Value<String?> results,
|
Value<String?> results,
|
||||||
Value<String?> achievements,
|
Value<String?> achievements,
|
||||||
Value<DateTime> createdAt,
|
Value<DateTime> createdAt,
|
||||||
@ -2919,6 +3005,7 @@ typedef $$SessionActivitiesTableUpdateCompanionBuilder
|
|||||||
Value<int> id,
|
Value<int> id,
|
||||||
Value<int> sessionId,
|
Value<int> sessionId,
|
||||||
Value<int> activityId,
|
Value<int> activityId,
|
||||||
|
Value<int> position,
|
||||||
Value<String?> results,
|
Value<String?> results,
|
||||||
Value<String?> achievements,
|
Value<String?> achievements,
|
||||||
Value<DateTime> createdAt,
|
Value<DateTime> createdAt,
|
||||||
@ -2968,6 +3055,9 @@ class $$SessionActivitiesTableFilterComposer
|
|||||||
ColumnFilters<int> get id => $composableBuilder(
|
ColumnFilters<int> get id => $composableBuilder(
|
||||||
column: $table.id, builder: (column) => ColumnFilters(column));
|
column: $table.id, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
|
ColumnFilters<int> get position => $composableBuilder(
|
||||||
|
column: $table.position, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
ColumnFilters<String> get results => $composableBuilder(
|
ColumnFilters<String> get results => $composableBuilder(
|
||||||
column: $table.results, builder: (column) => ColumnFilters(column));
|
column: $table.results, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
@ -3030,6 +3120,9 @@ class $$SessionActivitiesTableOrderingComposer
|
|||||||
ColumnOrderings<int> get id => $composableBuilder(
|
ColumnOrderings<int> get id => $composableBuilder(
|
||||||
column: $table.id, builder: (column) => ColumnOrderings(column));
|
column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
|
ColumnOrderings<int> get position => $composableBuilder(
|
||||||
|
column: $table.position, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
ColumnOrderings<String> get results => $composableBuilder(
|
ColumnOrderings<String> get results => $composableBuilder(
|
||||||
column: $table.results, builder: (column) => ColumnOrderings(column));
|
column: $table.results, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
@ -3093,6 +3186,9 @@ class $$SessionActivitiesTableAnnotationComposer
|
|||||||
GeneratedColumn<int> get id =>
|
GeneratedColumn<int> get id =>
|
||||||
$composableBuilder(column: $table.id, builder: (column) => column);
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||||
|
|
||||||
|
GeneratedColumn<int> get position =>
|
||||||
|
$composableBuilder(column: $table.position, builder: (column) => column);
|
||||||
|
|
||||||
GeneratedColumn<String> get results =>
|
GeneratedColumn<String> get results =>
|
||||||
$composableBuilder(column: $table.results, builder: (column) => column);
|
$composableBuilder(column: $table.results, builder: (column) => column);
|
||||||
|
|
||||||
@ -3171,6 +3267,7 @@ class $$SessionActivitiesTableTableManager extends RootTableManager<
|
|||||||
Value<int> id = const Value.absent(),
|
Value<int> id = const Value.absent(),
|
||||||
Value<int> sessionId = const Value.absent(),
|
Value<int> sessionId = const Value.absent(),
|
||||||
Value<int> activityId = const Value.absent(),
|
Value<int> activityId = const Value.absent(),
|
||||||
|
Value<int> position = const Value.absent(),
|
||||||
Value<String?> results = const Value.absent(),
|
Value<String?> results = const Value.absent(),
|
||||||
Value<String?> achievements = const Value.absent(),
|
Value<String?> achievements = const Value.absent(),
|
||||||
Value<DateTime> createdAt = const Value.absent(),
|
Value<DateTime> createdAt = const Value.absent(),
|
||||||
@ -3179,6 +3276,7 @@ class $$SessionActivitiesTableTableManager extends RootTableManager<
|
|||||||
id: id,
|
id: id,
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
activityId: activityId,
|
activityId: activityId,
|
||||||
|
position: position,
|
||||||
results: results,
|
results: results,
|
||||||
achievements: achievements,
|
achievements: achievements,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
@ -3187,6 +3285,7 @@ class $$SessionActivitiesTableTableManager extends RootTableManager<
|
|||||||
Value<int> id = const Value.absent(),
|
Value<int> id = const Value.absent(),
|
||||||
required int sessionId,
|
required int sessionId,
|
||||||
required int activityId,
|
required int activityId,
|
||||||
|
required int position,
|
||||||
Value<String?> results = const Value.absent(),
|
Value<String?> results = const Value.absent(),
|
||||||
Value<String?> achievements = const Value.absent(),
|
Value<String?> achievements = const Value.absent(),
|
||||||
Value<DateTime> createdAt = const Value.absent(),
|
Value<DateTime> createdAt = const Value.absent(),
|
||||||
@ -3195,6 +3294,7 @@ class $$SessionActivitiesTableTableManager extends RootTableManager<
|
|||||||
id: id,
|
id: id,
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
activityId: activityId,
|
activityId: activityId,
|
||||||
|
position: position,
|
||||||
results: results,
|
results: results,
|
||||||
achievements: achievements,
|
achievements: achievements,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
@ -3520,6 +3620,7 @@ typedef $$ActivityActionsTableCreateCompanionBuilder = ActivityActionsCompanion
|
|||||||
Value<int> id,
|
Value<int> id,
|
||||||
required int activityId,
|
required int activityId,
|
||||||
required int actionId,
|
required int actionId,
|
||||||
|
required int position,
|
||||||
Value<DateTime> createdAt,
|
Value<DateTime> createdAt,
|
||||||
});
|
});
|
||||||
typedef $$ActivityActionsTableUpdateCompanionBuilder = ActivityActionsCompanion
|
typedef $$ActivityActionsTableUpdateCompanionBuilder = ActivityActionsCompanion
|
||||||
@ -3527,6 +3628,7 @@ typedef $$ActivityActionsTableUpdateCompanionBuilder = ActivityActionsCompanion
|
|||||||
Value<int> id,
|
Value<int> id,
|
||||||
Value<int> activityId,
|
Value<int> activityId,
|
||||||
Value<int> actionId,
|
Value<int> actionId,
|
||||||
|
Value<int> position,
|
||||||
Value<DateTime> createdAt,
|
Value<DateTime> createdAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3574,6 +3676,9 @@ class $$ActivityActionsTableFilterComposer
|
|||||||
ColumnFilters<int> get id => $composableBuilder(
|
ColumnFilters<int> get id => $composableBuilder(
|
||||||
column: $table.id, builder: (column) => ColumnFilters(column));
|
column: $table.id, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
|
ColumnFilters<int> get position => $composableBuilder(
|
||||||
|
column: $table.position, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
||||||
column: $table.createdAt, builder: (column) => ColumnFilters(column));
|
column: $table.createdAt, builder: (column) => ColumnFilters(column));
|
||||||
|
|
||||||
@ -3630,6 +3735,9 @@ class $$ActivityActionsTableOrderingComposer
|
|||||||
ColumnOrderings<int> get id => $composableBuilder(
|
ColumnOrderings<int> get id => $composableBuilder(
|
||||||
column: $table.id, builder: (column) => ColumnOrderings(column));
|
column: $table.id, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
|
ColumnOrderings<int> get position => $composableBuilder(
|
||||||
|
column: $table.position, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
||||||
column: $table.createdAt, builder: (column) => ColumnOrderings(column));
|
column: $table.createdAt, builder: (column) => ColumnOrderings(column));
|
||||||
|
|
||||||
@ -3686,6 +3794,9 @@ class $$ActivityActionsTableAnnotationComposer
|
|||||||
GeneratedColumn<int> get id =>
|
GeneratedColumn<int> get id =>
|
||||||
$composableBuilder(column: $table.id, builder: (column) => column);
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||||
|
|
||||||
|
GeneratedColumn<int> get position =>
|
||||||
|
$composableBuilder(column: $table.position, builder: (column) => column);
|
||||||
|
|
||||||
GeneratedColumn<DateTime> get createdAt =>
|
GeneratedColumn<DateTime> get createdAt =>
|
||||||
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
||||||
|
|
||||||
@ -3757,24 +3868,28 @@ class $$ActivityActionsTableTableManager extends RootTableManager<
|
|||||||
Value<int> id = const Value.absent(),
|
Value<int> id = const Value.absent(),
|
||||||
Value<int> activityId = const Value.absent(),
|
Value<int> activityId = const Value.absent(),
|
||||||
Value<int> actionId = const Value.absent(),
|
Value<int> actionId = const Value.absent(),
|
||||||
|
Value<int> position = const Value.absent(),
|
||||||
Value<DateTime> createdAt = const Value.absent(),
|
Value<DateTime> createdAt = const Value.absent(),
|
||||||
}) =>
|
}) =>
|
||||||
ActivityActionsCompanion(
|
ActivityActionsCompanion(
|
||||||
id: id,
|
id: id,
|
||||||
activityId: activityId,
|
activityId: activityId,
|
||||||
actionId: actionId,
|
actionId: actionId,
|
||||||
|
position: position,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
),
|
),
|
||||||
createCompanionCallback: ({
|
createCompanionCallback: ({
|
||||||
Value<int> id = const Value.absent(),
|
Value<int> id = const Value.absent(),
|
||||||
required int activityId,
|
required int activityId,
|
||||||
required int actionId,
|
required int actionId,
|
||||||
|
required int position,
|
||||||
Value<DateTime> createdAt = const Value.absent(),
|
Value<DateTime> createdAt = const Value.absent(),
|
||||||
}) =>
|
}) =>
|
||||||
ActivityActionsCompanion.insert(
|
ActivityActionsCompanion.insert(
|
||||||
id: id,
|
id: id,
|
||||||
activityId: activityId,
|
activityId: activityId,
|
||||||
actionId: actionId,
|
actionId: actionId,
|
||||||
|
position: position,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
),
|
),
|
||||||
withReferenceMapper: (p0) => p0
|
withReferenceMapper: (p0) => p0
|
||||||
|
@ -312,8 +312,345 @@ i1.GeneratedColumn<int> _column_17(String aliasedName) =>
|
|||||||
type: i1.DriftSqlType.int,
|
type: i1.DriftSqlType.int,
|
||||||
defaultConstraints: i1.GeneratedColumn.constraintIsAlways(
|
defaultConstraints: i1.GeneratedColumn.constraintIsAlways(
|
||||||
'REFERENCES media_items (id)'));
|
'REFERENCES media_items (id)'));
|
||||||
|
|
||||||
|
final class Schema3 extends i0.VersionedSchema {
|
||||||
|
Schema3({required super.database}) : super(version: 3);
|
||||||
|
@override
|
||||||
|
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||||
|
sessions,
|
||||||
|
activities,
|
||||||
|
sessionActivities,
|
||||||
|
actions,
|
||||||
|
activityActions,
|
||||||
|
mediaItems,
|
||||||
|
objectMediaItems,
|
||||||
|
];
|
||||||
|
late final Shape0 sessions = Shape0(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'sessions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_3,
|
||||||
|
_column_4,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape1 activities = Shape1(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'activities',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_6,
|
||||||
|
_column_2,
|
||||||
|
_column_7,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape7 sessionActivities = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'session_activities',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_18,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape3 actions = Shape3(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'actions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_12,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape8 activityActions = Shape8(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'activity_actions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_13,
|
||||||
|
_column_18,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape5 mediaItems = Shape5(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'media_items',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_14,
|
||||||
|
_column_6,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape6 objectMediaItems = Shape6(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'object_media_items',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_15,
|
||||||
|
_column_16,
|
||||||
|
_column_17,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape7 extends i0.VersionedTable {
|
||||||
|
Shape7({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<int> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get sessionId =>
|
||||||
|
columnsByName['session_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get activityId =>
|
||||||
|
columnsByName['activity_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get postition =>
|
||||||
|
columnsByName['postition']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<String> get results =>
|
||||||
|
columnsByName['results']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get achievements =>
|
||||||
|
columnsByName['achievements']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<int> _column_18(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<int>('postition', aliasedName, false,
|
||||||
|
type: i1.DriftSqlType.int);
|
||||||
|
|
||||||
|
class Shape8 extends i0.VersionedTable {
|
||||||
|
Shape8({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<int> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get activityId =>
|
||||||
|
columnsByName['activity_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get actionId =>
|
||||||
|
columnsByName['action_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get postition =>
|
||||||
|
columnsByName['postition']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class Schema4 extends i0.VersionedSchema {
|
||||||
|
Schema4({required super.database}) : super(version: 4);
|
||||||
|
@override
|
||||||
|
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||||
|
sessions,
|
||||||
|
activities,
|
||||||
|
sessionActivities,
|
||||||
|
actions,
|
||||||
|
activityActions,
|
||||||
|
mediaItems,
|
||||||
|
objectMediaItems,
|
||||||
|
];
|
||||||
|
late final Shape0 sessions = Shape0(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'sessions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_3,
|
||||||
|
_column_4,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape1 activities = Shape1(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'activities',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_6,
|
||||||
|
_column_2,
|
||||||
|
_column_7,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape9 sessionActivities = Shape9(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'session_activities',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_19,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape3 actions = Shape3(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'actions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_12,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape10 activityActions = Shape10(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'activity_actions',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_13,
|
||||||
|
_column_19,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape5 mediaItems = Shape5(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'media_items',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_2,
|
||||||
|
_column_14,
|
||||||
|
_column_6,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
late final Shape6 objectMediaItems = Shape6(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'object_media_items',
|
||||||
|
withoutRowId: false,
|
||||||
|
isStrict: false,
|
||||||
|
tableConstraints: [],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_15,
|
||||||
|
_column_16,
|
||||||
|
_column_17,
|
||||||
|
_column_5,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape9 extends i0.VersionedTable {
|
||||||
|
Shape9({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<int> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get sessionId =>
|
||||||
|
columnsByName['session_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get activityId =>
|
||||||
|
columnsByName['activity_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get position =>
|
||||||
|
columnsByName['position']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<String> get results =>
|
||||||
|
columnsByName['results']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get achievements =>
|
||||||
|
columnsByName['achievements']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<int> _column_19(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<int>('position', aliasedName, false,
|
||||||
|
type: i1.DriftSqlType.int);
|
||||||
|
|
||||||
|
class Shape10 extends i0.VersionedTable {
|
||||||
|
Shape10({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<int> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get activityId =>
|
||||||
|
columnsByName['activity_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get actionId =>
|
||||||
|
columnsByName['action_id']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<int> get position =>
|
||||||
|
columnsByName['position']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
columnsByName['created_at']! as i1.GeneratedColumn<DateTime>;
|
||||||
|
}
|
||||||
|
|
||||||
i0.MigrationStepWithVersion migrationSteps({
|
i0.MigrationStepWithVersion migrationSteps({
|
||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
}) {
|
}) {
|
||||||
return (currentVersion, database) async {
|
return (currentVersion, database) async {
|
||||||
switch (currentVersion) {
|
switch (currentVersion) {
|
||||||
@ -322,6 +659,16 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
final migrator = i1.Migrator(database, schema);
|
final migrator = i1.Migrator(database, schema);
|
||||||
await from1To2(migrator, schema);
|
await from1To2(migrator, schema);
|
||||||
return 2;
|
return 2;
|
||||||
|
case 2:
|
||||||
|
final schema = Schema3(database: database);
|
||||||
|
final migrator = i1.Migrator(database, schema);
|
||||||
|
await from2To3(migrator, schema);
|
||||||
|
return 3;
|
||||||
|
case 3:
|
||||||
|
final schema = Schema4(database: database);
|
||||||
|
final migrator = i1.Migrator(database, schema);
|
||||||
|
await from3To4(migrator, schema);
|
||||||
|
return 4;
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||||
}
|
}
|
||||||
@ -330,8 +677,12 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
|
|
||||||
i1.OnUpgrade stepByStep({
|
i1.OnUpgrade stepByStep({
|
||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema4 schema) from3To4,
|
||||||
}) =>
|
}) =>
|
||||||
i0.VersionedSchema.stepByStepHelper(
|
i0.VersionedSchema.stepByStepHelper(
|
||||||
step: migrationSteps(
|
step: migrationSteps(
|
||||||
from1To2: from1To2,
|
from1To2: from1To2,
|
||||||
|
from2To3: from2To3,
|
||||||
|
from3To4: from3To4,
|
||||||
));
|
));
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,6 +36,11 @@ Future<void> seedDb(AppDatabase database) async {
|
|||||||
['BgheYcxhrsw', MediaType.youtube]
|
['BgheYcxhrsw', MediaType.youtube]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
final List<String> actionTypes = [
|
||||||
|
"[[{\"actionID\": 0, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 2, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"1, 3, 5\", \"type\": \"repititions\", \"amount\": 1, \"weight\": 0}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]",
|
||||||
|
"[[{\"actionID\": 0, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 1, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 2, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 3, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 4, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 5, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 6, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 7, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 8, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 9, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 10, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 11, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 12, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 13, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 14, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 15, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}], [{\"actionID\": 16, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weight\": 80}, {\"actionID\": 17, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 5}, {\"actionID\": 18, \"name\": \"Long Pulls\", \"type\": \"seconds\", \"amount\": 5, \"weights\": 80}, {\"actionID\": 19, \"name\": \"Rest\", \"type\": \"seconds\", \"amount\": 300}]]"
|
||||||
|
];
|
||||||
|
|
||||||
final int totalSessions = 15;
|
final int totalSessions = 15;
|
||||||
final int totalActivities = 6;
|
final int totalActivities = 6;
|
||||||
final int totalActions = 5;
|
final int totalActions = 5;
|
||||||
@ -59,14 +64,15 @@ Future<void> seedDb(AppDatabase database) async {
|
|||||||
date: Value(DateTime.now())))
|
date: Value(DateTime.now())))
|
||||||
.then((sessionId) async {
|
.then((sessionId) async {
|
||||||
// activities things
|
// activities things
|
||||||
for (int j = 0; j < random.nextInt(totalActivities); j++) {
|
for (int j = 0; j <= random.nextInt(totalActivities); j++) {
|
||||||
await database
|
await database
|
||||||
.into(database.activities)
|
.into(database.activities)
|
||||||
.insert(ActivitiesCompanion.insert(
|
.insert(ActivitiesCompanion.insert(
|
||||||
title: "test activity $j",
|
title: "Test activity $j",
|
||||||
type: ActivityType
|
type: ActivityType
|
||||||
.values[random.nextInt(ActivityType.values.length)],
|
.values[random.nextInt(ActivityType.values.length)],
|
||||||
description: "test training activity $j",
|
description:
|
||||||
|
"$j Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.",
|
||||||
category: ActivityCategories
|
category: ActivityCategories
|
||||||
.values[random.nextInt(ActivityCategories.values.length)]))
|
.values[random.nextInt(ActivityCategories.values.length)]))
|
||||||
.then((activityId) async {
|
.then((activityId) async {
|
||||||
@ -76,31 +82,34 @@ Future<void> seedDb(AppDatabase database) async {
|
|||||||
.insert(SessionActivitiesCompanion.insert(
|
.insert(SessionActivitiesCompanion.insert(
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
activityId: activityId,
|
activityId: activityId,
|
||||||
|
position: j,
|
||||||
results: Value("results json, will need to test"),
|
results: Value("results json, will need to test"),
|
||||||
achievements: Value("comma, seperated, items"),
|
achievements: Value("comma, seperated, items"),
|
||||||
));
|
));
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
for (int k = 0; k < random.nextInt(totalActions); k++) {
|
for (int k = 0; k <= random.nextInt(totalActions); k++) {
|
||||||
await database
|
await database
|
||||||
.into(database.actions)
|
.into(database.actions)
|
||||||
.insert(ActionsCompanion.insert(
|
.insert(ActionsCompanion.insert(
|
||||||
title: 'test action $k',
|
title: 'Test action $k',
|
||||||
description: 'test action description $k',
|
description:
|
||||||
set: ''))
|
'$k Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.',
|
||||||
|
set: actionTypes[random.nextInt(actionTypes.length)]))
|
||||||
.then((actionId) async {
|
.then((actionId) async {
|
||||||
// add activity action association
|
// add activity action association
|
||||||
await database.into(database.activityActions).insert(
|
await database.into(database.activityActions).insert(
|
||||||
ActivityActionsCompanion.insert(
|
ActivityActionsCompanion.insert(
|
||||||
activityId: activityId, actionId: actionId));
|
activityId: activityId, actionId: actionId, position: k));
|
||||||
|
|
||||||
for (int l = 0; l < random.nextInt(totalMedia); l++) {
|
for (int l = 0; l <= random.nextInt(totalMedia); l++) {
|
||||||
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
||||||
await database
|
await database
|
||||||
.into(database.mediaItems)
|
.into(database.mediaItems)
|
||||||
.insert(MediaItemsCompanion.insert(
|
.insert(MediaItemsCompanion.insert(
|
||||||
title: 'media title $l',
|
title: 'Media title $l',
|
||||||
description: 'media description $l',
|
description:
|
||||||
|
'Media description $l Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.',
|
||||||
reference: mediaItem[0],
|
reference: mediaItem[0],
|
||||||
type: mediaItem[1]))
|
type: mediaItem[1]))
|
||||||
.then((mediaId) async {
|
.then((mediaId) async {
|
||||||
@ -114,13 +123,14 @@ Future<void> seedDb(AppDatabase database) async {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int l = 0; l < random.nextInt(totalMedia); l++) {
|
for (int m = 0; m <= random.nextInt(totalMedia); m++) {
|
||||||
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
||||||
await database
|
await database
|
||||||
.into(database.mediaItems)
|
.into(database.mediaItems)
|
||||||
.insert(MediaItemsCompanion.insert(
|
.insert(MediaItemsCompanion.insert(
|
||||||
title: 'media title $l',
|
title: 'Media title $m',
|
||||||
description: 'media description $l',
|
description:
|
||||||
|
'Media description $m Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.',
|
||||||
reference: mediaItem[0],
|
reference: mediaItem[0],
|
||||||
type: mediaItem[1]))
|
type: mediaItem[1]))
|
||||||
.then((mediaId) async {
|
.then((mediaId) async {
|
||||||
@ -134,13 +144,14 @@ Future<void> seedDb(AppDatabase database) async {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int l = 0; l < random.nextInt(totalMedia); l++) {
|
for (int n = 0; n <= random.nextInt(totalMedia); n++) {
|
||||||
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
final mediaItem = mediaItems[random.nextInt(mediaItems.length)];
|
||||||
await database
|
await database
|
||||||
.into(database.mediaItems)
|
.into(database.mediaItems)
|
||||||
.insert(MediaItemsCompanion.insert(
|
.insert(MediaItemsCompanion.insert(
|
||||||
title: 'media title $l',
|
title: 'Media title $n',
|
||||||
description: 'media description $l',
|
description:
|
||||||
|
'Media description $n Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.',
|
||||||
reference: mediaItem[0],
|
reference: mediaItem[0],
|
||||||
type: mediaItem[1]))
|
type: mediaItem[1]))
|
||||||
.then((mediaId) async {
|
.then((mediaId) async {
|
||||||
|
84
lib/extensions/string_extensions.dart
Normal file
84
lib/extensions/string_extensions.dart
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
List<String> exceptions = [
|
||||||
|
'a',
|
||||||
|
'abaft',
|
||||||
|
'about',
|
||||||
|
'above',
|
||||||
|
'afore',
|
||||||
|
'after',
|
||||||
|
'along',
|
||||||
|
'amid',
|
||||||
|
'among',
|
||||||
|
'an',
|
||||||
|
'apud',
|
||||||
|
'as',
|
||||||
|
'aside',
|
||||||
|
'at',
|
||||||
|
'atop',
|
||||||
|
'below',
|
||||||
|
'but',
|
||||||
|
'by',
|
||||||
|
'circa',
|
||||||
|
'down',
|
||||||
|
'for',
|
||||||
|
'from',
|
||||||
|
'given',
|
||||||
|
'in',
|
||||||
|
'into',
|
||||||
|
'lest',
|
||||||
|
'like',
|
||||||
|
'mid',
|
||||||
|
'midst',
|
||||||
|
'minus',
|
||||||
|
'near',
|
||||||
|
'next',
|
||||||
|
'of',
|
||||||
|
'off',
|
||||||
|
'on',
|
||||||
|
'onto',
|
||||||
|
'out',
|
||||||
|
'over',
|
||||||
|
'pace',
|
||||||
|
'past',
|
||||||
|
'per',
|
||||||
|
'plus',
|
||||||
|
'pro',
|
||||||
|
'qua',
|
||||||
|
'round',
|
||||||
|
'sans',
|
||||||
|
'save',
|
||||||
|
'since',
|
||||||
|
'than',
|
||||||
|
'thru',
|
||||||
|
'till',
|
||||||
|
'times',
|
||||||
|
'to',
|
||||||
|
'under',
|
||||||
|
'until',
|
||||||
|
'unto',
|
||||||
|
'up',
|
||||||
|
'upon',
|
||||||
|
'via',
|
||||||
|
'vice',
|
||||||
|
'with',
|
||||||
|
'worth',
|
||||||
|
'the","and',
|
||||||
|
'nor',
|
||||||
|
'or',
|
||||||
|
'yet',
|
||||||
|
'so'
|
||||||
|
];
|
||||||
|
|
||||||
|
extension TitleCase on String {
|
||||||
|
String toTitleCase() {
|
||||||
|
return toLowerCase().replaceAllMapped(
|
||||||
|
RegExp(
|
||||||
|
r'[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+'),
|
||||||
|
(Match match) {
|
||||||
|
|
||||||
|
// if (exceptions.contains(match[0])) {
|
||||||
|
// return match[0]!;
|
||||||
|
// }
|
||||||
|
return "${match[0]![0].toUpperCase()}${match[0]!.substring(1).toLowerCase()}";
|
||||||
|
}).replaceAll(RegExp(r'(_|-)+'), ' ');
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ class ActivityTimerModel with ChangeNotifier {
|
|||||||
ActivityModel? _activityModel;
|
ActivityModel? _activityModel;
|
||||||
Activity? _activity;
|
Activity? _activity;
|
||||||
List _sets = [];
|
List _sets = [];
|
||||||
|
List _actions = [];
|
||||||
int _currentActionNum = 0;
|
int _currentActionNum = 0;
|
||||||
int _currentSetNum = 0;
|
int _currentSetNum = 0;
|
||||||
Timer? _periodicTimer;
|
Timer? _periodicTimer;
|
||||||
@ -30,7 +31,7 @@ class ActivityTimerModel with ChangeNotifier {
|
|||||||
double get progress => _progress;
|
double get progress => _progress;
|
||||||
int get totalTime => _totalTime;
|
int get totalTime => _totalTime;
|
||||||
|
|
||||||
void setup(ActivityModel activityModel, Activity activity) {
|
void setup(ActivityModel activityModel, Activity activity, List actions) {
|
||||||
if (_activityModel == null || activityModel.id != _activityModel?.id) {
|
if (_activityModel == null || activityModel.id != _activityModel?.id) {
|
||||||
_periodicTimer?.cancel();
|
_periodicTimer?.cancel();
|
||||||
_progress = 0;
|
_progress = 0;
|
||||||
@ -38,6 +39,7 @@ class ActivityTimerModel with ChangeNotifier {
|
|||||||
_activityModel = activityModel;
|
_activityModel = activityModel;
|
||||||
_activity = activity;
|
_activity = activity;
|
||||||
_sets = activityModel.actions[0].items();
|
_sets = activityModel.actions[0].items();
|
||||||
|
_actions = actions;
|
||||||
_currentActionNum = 0;
|
_currentActionNum = 0;
|
||||||
_currentSetNum = 0;
|
_currentSetNum = 0;
|
||||||
setActionCount();
|
setActionCount();
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||||
import 'package:sendtrain/classes/activity_action.dart';
|
import 'package:sendtrain/classes/activity_action.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
import 'package:sendtrain/models/activity_timer_model.dart';
|
import 'package:sendtrain/models/activity_timer_model.dart';
|
||||||
|
|
||||||
class ActivityActionView extends StatefulWidget {
|
class ActivityActionView extends StatefulWidget {
|
||||||
@ -74,7 +75,7 @@ class ActivityActionViewState extends State<ActivityActionView> {
|
|||||||
: Theme.of(context).colorScheme.surfaceContainerLow,
|
: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
child: Text(
|
child: Text(
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
'${setItem['name']}: ${setItem['amount']} ${setItem['type']}')))
|
'${setItem['name']}: ${setItem['amount']} ${setItem['type']}'.toTitleCase())))
|
||||||
])));
|
])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:sendtrain/daos/media_items_dao.dart';
|
import 'package:sendtrain/daos/media_items_dao.dart';
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
import 'package:sendtrain/models/activity_model.dart';
|
import 'package:sendtrain/models/activity_model.dart';
|
||||||
import 'package:sendtrain/models/activity_timer_model.dart';
|
import 'package:sendtrain/models/activity_timer_model.dart';
|
||||||
import 'package:sendtrain/widgets/activity_view.dart';
|
import 'package:sendtrain/widgets/activity_view.dart';
|
||||||
@ -71,19 +72,20 @@ class ActivityCardState extends State<ActivityCard> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListTile(
|
ListTile(
|
||||||
|
// visualDensity: VisualDensity(horizontal: VisualDensity.maximumDensity),
|
||||||
leading: Padding(
|
leading: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(top: 5, bottom: 5),
|
// padding: EdgeInsets.only(top: 5, bottom: 5),
|
||||||
width: 60,
|
width: 60,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.fill,
|
||||||
image:
|
image:
|
||||||
findMediaByType(mediaItems, 'image')),
|
findMediaByType(mediaItems, 'image')),
|
||||||
// color: Colors.blue,
|
// color: Colors.blue,
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const BorderRadius.all(
|
||||||
Radius.elliptical(10, 10)),
|
Radius.elliptical(8, 8)),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
title: Consumer<ActivityTimerModel>(
|
title: Consumer<ActivityTimerModel>(
|
||||||
@ -91,9 +93,9 @@ class ActivityCardState extends State<ActivityCard> {
|
|||||||
if (atm.activity?.id == widget.activity.id) {
|
if (atm.activity?.id == widget.activity.id) {
|
||||||
return Text(
|
return Text(
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
"${widget.data.title} (${formattedTime(atm.totalTime)})");
|
"${widget.data.title.toTitleCase()} (${formattedTime(atm.totalTime)})");
|
||||||
} else {
|
} else {
|
||||||
return Text(maxLines: 1, widget.data.title);
|
return Text(maxLines: 1, widget.data.title.toTitleCase());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -128,7 +130,13 @@ class ActivityCardState extends State<ActivityCard> {
|
|||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return CircularProgressIndicator();
|
return Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50.0,
|
||||||
|
width: 50.0,
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_expandable_fab/flutter_expandable_fab.dart';
|
import 'package:flutter_expandable_fab/flutter_expandable_fab.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:sendtrain/daos/actions_dao.dart';
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
import 'package:sendtrain/models/activity_model.dart';
|
import 'package:sendtrain/models/activity_model.dart';
|
||||||
import 'package:sendtrain/models/activity_timer_model.dart';
|
import 'package:sendtrain/models/activity_timer_model.dart';
|
||||||
import 'package:sendtrain/widgets/activity_action_view.dart';
|
import 'package:sendtrain/widgets/activity_action_view.dart';
|
||||||
@ -27,133 +29,171 @@ class _ActivityViewState extends State<ActivityView> {
|
|||||||
ActivityTimerModel atm =
|
ActivityTimerModel atm =
|
||||||
Provider.of<ActivityTimerModel>(context, listen: false);
|
Provider.of<ActivityTimerModel>(context, listen: false);
|
||||||
|
|
||||||
atm.setup(activityModel, activity);
|
return FutureBuilder<List>(
|
||||||
|
future: ActionsDao(Provider.of<AppDatabase>(context))
|
||||||
|
.fromActivity(activity),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
List actions = snapshot.data!;
|
||||||
|
atm.setup(activityModel, activity, actions);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButtonLocation: ExpandableFab.location,
|
floatingActionButtonLocation: ExpandableFab.location,
|
||||||
floatingActionButton: ExpandableFab(
|
floatingActionButton: ExpandableFab(
|
||||||
distance: 70,
|
distance: 70,
|
||||||
type: ExpandableFabType.up,
|
type: ExpandableFabType.up,
|
||||||
overlayStyle: ExpandableFabOverlayStyle(
|
overlayStyle: ExpandableFabOverlayStyle(
|
||||||
color: Colors.black.withOpacity(0.5),
|
color: Colors.black.withOpacity(0.5),
|
||||||
blur: 10,
|
blur: 10,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
FloatingActionButton.extended(
|
FloatingActionButton.extended(
|
||||||
icon: const Icon(Icons.history_outlined),
|
icon: const Icon(Icons.history_outlined),
|
||||||
label: Text('Restart'),
|
label: Text('Restart'),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
FloatingActionButton.extended(
|
FloatingActionButton.extended(
|
||||||
icon: const Icon(Icons.done_all_outlined),
|
icon: const Icon(Icons.done_all_outlined),
|
||||||
label: Text('Done'),
|
label: Text('Done'),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
FloatingActionButton.extended(
|
FloatingActionButton.extended(
|
||||||
icon: const Icon(Icons.edit_outlined),
|
icon: const Icon(Icons.edit_outlined),
|
||||||
label: Text('Edit'),
|
label: Text('Edit'),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
body: Column(
|
||||||
AppBar(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
centerTitle: true,
|
children: [
|
||||||
title: const Text('Activity', style: TextStyle(fontSize: 15)),
|
AppBar(
|
||||||
),
|
titleSpacing: 0,
|
||||||
Padding(
|
centerTitle: true,
|
||||||
padding: const EdgeInsets.only(
|
title: const Text('Activity',
|
||||||
left: 15, right: 20, top: 15, bottom: 10),
|
style: TextStyle(fontSize: 15)),
|
||||||
child: Text(
|
),
|
||||||
maxLines: 1,
|
Padding(
|
||||||
style: const TextStyle(
|
padding: const EdgeInsets.only(
|
||||||
fontSize: 25, fontWeight: FontWeight.bold),
|
left: 15, right: 20, top: 15, bottom: 10),
|
||||||
activity.title)),
|
child: Text(
|
||||||
Padding(
|
maxLines: 1,
|
||||||
padding: const EdgeInsets.fromLTRB(10, 0, 0, 10),
|
style: const TextStyle(
|
||||||
child: Flex(direction: Axis.horizontal, children: [
|
fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
ActivityViewCategories(categories: [activity.category]),
|
activity.title.toTitleCase())),
|
||||||
ActivityViewTypes(types: [activity.type])
|
Padding(
|
||||||
])),
|
padding: const EdgeInsets.fromLTRB(10, 0, 0, 10),
|
||||||
Padding(
|
child: Flex(direction: Axis.horizontal, children: [
|
||||||
padding: const EdgeInsets.only(
|
ActivityViewCategories(
|
||||||
top: 0, bottom: 10, left: 15, right: 15),
|
categories: [activity.category]),
|
||||||
child: Text(
|
ActivityViewTypes(types: [activity.type])
|
||||||
textAlign: TextAlign.left,
|
])),
|
||||||
style: const TextStyle(fontSize: 15),
|
Padding(
|
||||||
activity.description)),
|
padding: const EdgeInsets.only(
|
||||||
const Padding(
|
top: 0, bottom: 10, left: 15, right: 15),
|
||||||
padding: EdgeInsets.fromLTRB(15, 20, 0, 10),
|
child: Text(
|
||||||
child: Text(
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 15),
|
||||||
'Media:')),
|
activity.description)),
|
||||||
ActivityViewMedia(activity: activity),
|
const Padding(
|
||||||
const Padding(
|
padding: EdgeInsets.fromLTRB(15, 20, 0, 10),
|
||||||
padding: EdgeInsets.fromLTRB(15, 30, 0, 10),
|
child: Text(
|
||||||
child: Text(
|
style: TextStyle(
|
||||||
textAlign: TextAlign.left,
|
fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
'Media:')),
|
||||||
'Actions')),
|
ActivityViewMedia(activity: activity),
|
||||||
Padding(
|
const Padding(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding: EdgeInsets.fromLTRB(15, 30, 0, 10),
|
||||||
child: Card(
|
child: Text(
|
||||||
clipBehavior: Clip.antiAlias,
|
textAlign: TextAlign.left,
|
||||||
shape: const RoundedRectangleBorder(
|
style: TextStyle(
|
||||||
borderRadius: BorderRadius.only(
|
fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
topLeft: Radius.circular(10),
|
'Actions')),
|
||||||
topRight: Radius.circular(10)),
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
color: Theme.of(context).colorScheme.onPrimary,
|
child: Card(
|
||||||
child: Row(children: [
|
clipBehavior: Clip.antiAlias,
|
||||||
Ink(
|
shape: const RoundedRectangleBorder(
|
||||||
width: 70,
|
borderRadius: BorderRadius.only(
|
||||||
color: Theme.of(context).colorScheme.primaryContainer,
|
topLeft: Radius.circular(10),
|
||||||
child: Consumer<ActivityTimerModel>(
|
topRight: Radius.circular(10)),
|
||||||
builder: (context, atm, child) {
|
),
|
||||||
return IconButton(
|
color: Theme.of(context).colorScheme.onPrimary,
|
||||||
alignment: AlignmentDirectional.center,
|
child: Row(children: [
|
||||||
icon: atm.isActive
|
Ink(
|
||||||
? const Icon(Icons.pause_rounded)
|
width: 70,
|
||||||
: const Icon(Icons.play_arrow_rounded),
|
color: Theme.of(context)
|
||||||
onPressed: () =>
|
.colorScheme
|
||||||
{atm.isActive ? atm.pause() : atm.start()});
|
.primaryContainer,
|
||||||
},
|
child: Consumer<ActivityTimerModel>(
|
||||||
)),
|
builder: (context, atm, child) {
|
||||||
Expanded(
|
return IconButton(
|
||||||
flex: 1,
|
alignment:
|
||||||
child: Stack(alignment: Alignment.center, children: [
|
AlignmentDirectional.center,
|
||||||
Container(
|
icon: atm.isActive
|
||||||
alignment: Alignment.center,
|
? const Icon(
|
||||||
child: Consumer<ActivityTimerModel>(
|
Icons.pause_rounded)
|
||||||
|
: const Icon(
|
||||||
|
Icons.play_arrow_rounded),
|
||||||
|
onPressed: () => {
|
||||||
|
atm.isActive
|
||||||
|
? atm.pause()
|
||||||
|
: atm.start()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Consumer<ActivityTimerModel>(
|
||||||
|
builder: (context, atm, child) {
|
||||||
|
return Text(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
'${atm.actionCount} ${atm.currentAction['type']}'.toTitleCase());
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(right: 15),
|
||||||
|
child:
|
||||||
|
Consumer<ActivityTimerModel>(
|
||||||
|
builder: (context, atm,
|
||||||
|
child) {
|
||||||
|
return Text(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
'${atm.currentAction['actionID'] + 1} of ${atm.totalActions()}');
|
||||||
|
})),
|
||||||
|
])),
|
||||||
|
]))),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 14, right: 14),
|
||||||
|
child: Consumer<ActivityTimerModel>(
|
||||||
builder: (context, atm, child) {
|
builder: (context, atm, child) {
|
||||||
return Text(
|
return LinearProgressIndicator(
|
||||||
style: const TextStyle(fontSize: 20),
|
value: atm.progress,
|
||||||
textAlign: TextAlign.center,
|
semanticsLabel: 'Activity Progress',
|
||||||
'${atm.actionCount} ${atm.currentAction['type']}');
|
);
|
||||||
},
|
})),
|
||||||
),
|
ActivityActionView(action: activityModel.actions[0]),
|
||||||
),
|
]));
|
||||||
Container(
|
} else {
|
||||||
alignment: Alignment.centerRight,
|
return Container(
|
||||||
padding: EdgeInsets.only(right: 15),
|
alignment: Alignment.center,
|
||||||
child: Consumer<ActivityTimerModel>(
|
child: SizedBox(
|
||||||
builder: (context, atm, child) {
|
height: 50.0,
|
||||||
return Text(
|
width: 50.0,
|
||||||
style: const TextStyle(fontSize: 12),
|
child: CircularProgressIndicator(),
|
||||||
textAlign: TextAlign.right,
|
));
|
||||||
'${atm.currentAction['actionID'] + 1} of ${atm.totalActions()}');
|
}
|
||||||
})),
|
});
|
||||||
])),
|
|
||||||
]))),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(left: 14, right: 14),
|
|
||||||
child:
|
|
||||||
Consumer<ActivityTimerModel>(builder: (context, atm, child) {
|
|
||||||
return LinearProgressIndicator(
|
|
||||||
value: atm.progress,
|
|
||||||
semanticsLabel: 'Activity Progress',
|
|
||||||
);
|
|
||||||
})),
|
|
||||||
ActivityActionView(action: activityModel.actions[0]),
|
|
||||||
]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
|
|
||||||
class ActivityViewCategories extends StatelessWidget {
|
class ActivityViewCategories extends StatelessWidget {
|
||||||
const ActivityViewCategories({super.key, required this.categories});
|
const ActivityViewCategories({super.key, required this.categories});
|
||||||
@ -19,7 +20,7 @@ class ActivityViewCategories extends StatelessWidget {
|
|||||||
return ActionChip(
|
return ActionChip(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
avatar: const Icon(Icons.category_rounded),
|
avatar: const Icon(Icons.category_rounded),
|
||||||
label: Text(maxLines: 1, categories[index].name),
|
label: Text(maxLines: 1, categories[index].name.toTitleCase()),
|
||||||
tooltip: "Activity Category",
|
tooltip: "Activity Category",
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
|
|
||||||
class ActivityViewTypes extends StatelessWidget {
|
class ActivityViewTypes extends StatelessWidget {
|
||||||
const ActivityViewTypes({super.key, required this.types});
|
const ActivityViewTypes({super.key, required this.types});
|
||||||
@ -19,7 +20,7 @@ class ActivityViewTypes extends StatelessWidget {
|
|||||||
return ActionChip(
|
return ActionChip(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
avatar: const Icon(Icons.fitness_center_rounded),
|
avatar: const Icon(Icons.fitness_center_rounded),
|
||||||
label: Text(maxLines: 1, types[index].name),
|
label: Text(maxLines: 1, types[index].name.toTitleCase()),
|
||||||
tooltip: "Activity Type",
|
tooltip: "Activity Type",
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
);
|
);
|
||||||
|
@ -4,6 +4,7 @@ import 'package:intl/date_symbol_data_local.dart';
|
|||||||
import 'package:sendtrain/classes/activity_action.dart';
|
import 'package:sendtrain/classes/activity_action.dart';
|
||||||
import 'package:sendtrain/classes/media.dart';
|
import 'package:sendtrain/classes/media.dart';
|
||||||
import 'package:sendtrain/database/database.dart' hide ActivityAction;
|
import 'package:sendtrain/database/database.dart' hide ActivityAction;
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
import 'package:sendtrain/models/activity_model.dart';
|
import 'package:sendtrain/models/activity_model.dart';
|
||||||
import 'package:sendtrain/models/session_model.dart';
|
import 'package:sendtrain/models/session_model.dart';
|
||||||
import 'package:sendtrain/widgets/session_view.dart';
|
import 'package:sendtrain/widgets/session_view.dart';
|
||||||
@ -217,7 +218,7 @@ class SessionCard extends StatelessWidget {
|
|||||||
BorderRadius.all(Radius.elliptical(10, 10)),
|
BorderRadius.all(Radius.elliptical(10, 10)),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
title: Text(maxLines: 1, session.title),
|
title: Text(maxLines: 1, session.title.toTitleCase()),
|
||||||
subtitle: Text(maxLines: 1, dateFormat.format(session.date as DateTime)),
|
subtitle: Text(maxLines: 1, dateFormat.format(session.date as DateTime)),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
@ -303,7 +304,7 @@ class SessionCard extends StatelessWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
session.title,
|
session.title.toTitleCase(),
|
||||||
textAlign: TextAlign.center),
|
textAlign: TextAlign.center),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
@ -6,6 +6,7 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:sendtrain/daos/activities_dao.dart';
|
import 'package:sendtrain/daos/activities_dao.dart';
|
||||||
|
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
import 'package:sendtrain/models/session_model.dart';
|
import 'package:sendtrain/models/session_model.dart';
|
||||||
import 'package:sendtrain/widgets/session_view_achievements.dart';
|
import 'package:sendtrain/widgets/session_view_achievements.dart';
|
||||||
import 'package:sendtrain/widgets/session_view_activities.dart';
|
import 'package:sendtrain/widgets/session_view_activities.dart';
|
||||||
@ -69,7 +70,7 @@ class SessionView extends StatelessWidget {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 25, fontWeight: FontWeight.bold),
|
fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
session.title)),
|
session.title.toTitleCase())),
|
||||||
SessionViewAchievements(session: session),
|
SessionViewAchievements(session: session),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:sendtrain/daos/session_activities_dao.dart';
|
import 'package:sendtrain/daos/session_activities_dao.dart';
|
||||||
import 'package:sendtrain/database/database.dart';
|
import 'package:sendtrain/database/database.dart';
|
||||||
|
import 'package:sendtrain/extensions/string_extensions.dart';
|
||||||
|
|
||||||
class SessionViewAchievements extends StatelessWidget {
|
class SessionViewAchievements extends StatelessWidget {
|
||||||
const SessionViewAchievements({super.key, required this.session});
|
const SessionViewAchievements({super.key, required this.session});
|
||||||
@ -50,7 +51,7 @@ class SessionViewAchievements extends StatelessWidget {
|
|||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
avatar:
|
avatar:
|
||||||
const Icon(Icons.check_circle_outline),
|
const Icon(Icons.check_circle_outline),
|
||||||
label: Text(maxLines: 1, achievements[index]),
|
label: Text(maxLines: 1, achievements[index].toTitleCase()),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,8 @@ import 'package:drift/drift.dart';
|
|||||||
import 'package:drift/internal/migrations.dart';
|
import 'package:drift/internal/migrations.dart';
|
||||||
import 'schema_v1.dart' as v1;
|
import 'schema_v1.dart' as v1;
|
||||||
import 'schema_v2.dart' as v2;
|
import 'schema_v2.dart' as v2;
|
||||||
|
import 'schema_v3.dart' as v3;
|
||||||
|
import 'schema_v4.dart' as v4;
|
||||||
|
|
||||||
class GeneratedHelper implements SchemaInstantiationHelper {
|
class GeneratedHelper implements SchemaInstantiationHelper {
|
||||||
@override
|
@override
|
||||||
@ -14,10 +16,14 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
|||||||
return v1.DatabaseAtV1(db);
|
return v1.DatabaseAtV1(db);
|
||||||
case 2:
|
case 2:
|
||||||
return v2.DatabaseAtV2(db);
|
return v2.DatabaseAtV2(db);
|
||||||
|
case 3:
|
||||||
|
return v3.DatabaseAtV3(db);
|
||||||
|
case 4:
|
||||||
|
return v4.DatabaseAtV4(db);
|
||||||
default:
|
default:
|
||||||
throw MissingSchemaException(version, versions);
|
throw MissingSchemaException(version, versions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const versions = const [1, 2];
|
static const versions = const [1, 2, 3, 4];
|
||||||
}
|
}
|
||||||
|
1977
test/drift/sendtrain/generated/schema_v3.dart
Normal file
1977
test/drift/sendtrain/generated/schema_v3.dart
Normal file
File diff suppressed because it is too large
Load Diff
1977
test/drift/sendtrain/generated/schema_v4.dart
Normal file
1977
test/drift/sendtrain/generated/schema_v4.dart
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user