ARCH: add stable cloud profile and motorcycle DTOs
This commit is contained in:
parent
eded81345e
commit
dd99a930bc
|
|
@ -0,0 +1,98 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
/// Stable cloud-facing representation of the MotorSignal rider profile.
|
||||||
|
/// Firebase UID is the identity; username is a future public handle and is
|
||||||
|
/// intentionally not used as an account identifier.
|
||||||
|
@immutable
|
||||||
|
class CloudUserProfile {
|
||||||
|
final String id;
|
||||||
|
final String? username;
|
||||||
|
final String? displayName;
|
||||||
|
final String? profilePhotoUrl;
|
||||||
|
final String? bio;
|
||||||
|
final String? location;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final DateTime updatedAt;
|
||||||
|
final Map<String, dynamic> privacySettings;
|
||||||
|
final Map<String, dynamic> preferences;
|
||||||
|
|
||||||
|
const CloudUserProfile({
|
||||||
|
required this.id,
|
||||||
|
this.username,
|
||||||
|
this.displayName,
|
||||||
|
this.profilePhotoUrl,
|
||||||
|
this.bio,
|
||||||
|
this.location,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
this.privacySettings = const <String, dynamic>{},
|
||||||
|
this.preferences = const <String, dynamic>{},
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'username': username,
|
||||||
|
'displayName': displayName,
|
||||||
|
'profilePhotoUrl': profilePhotoUrl,
|
||||||
|
'bio': bio,
|
||||||
|
'location': location,
|
||||||
|
'createdAt': createdAt.toUtc().toIso8601String(),
|
||||||
|
'updatedAt': updatedAt.toUtc().toIso8601String(),
|
||||||
|
'privacySettings': privacySettings,
|
||||||
|
'preferences': preferences,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Cloud DTO for a motorcycle. Local Drift IDs remain stable within the
|
||||||
|
/// installation; the string form is used as the Firestore document ID.
|
||||||
|
@immutable
|
||||||
|
class CloudMotorcycle {
|
||||||
|
final String id;
|
||||||
|
final String ownerId;
|
||||||
|
final int year;
|
||||||
|
final String makeId;
|
||||||
|
final String makeName;
|
||||||
|
final String modelId;
|
||||||
|
final String modelName;
|
||||||
|
final String? variantId;
|
||||||
|
final String? variantName;
|
||||||
|
final String? nickname;
|
||||||
|
final bool isDefault;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final DateTime updatedAt;
|
||||||
|
final String? specificationJson;
|
||||||
|
|
||||||
|
const CloudMotorcycle({
|
||||||
|
required this.id,
|
||||||
|
required this.ownerId,
|
||||||
|
required this.year,
|
||||||
|
required this.makeId,
|
||||||
|
required this.makeName,
|
||||||
|
required this.modelId,
|
||||||
|
required this.modelName,
|
||||||
|
this.variantId,
|
||||||
|
this.variantName,
|
||||||
|
this.nickname,
|
||||||
|
required this.isDefault,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
this.specificationJson,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'ownerId': ownerId,
|
||||||
|
'year': year,
|
||||||
|
'makeId': makeId,
|
||||||
|
'makeName': makeName,
|
||||||
|
'modelId': modelId,
|
||||||
|
'modelName': modelName,
|
||||||
|
'variantId': variantId,
|
||||||
|
'variantName': variantName,
|
||||||
|
'nickname': nickname,
|
||||||
|
'isDefault': isDefault,
|
||||||
|
'createdAt': createdAt.toUtc().toIso8601String(),
|
||||||
|
'updatedAt': updatedAt.toUtc().toIso8601String(),
|
||||||
|
'specificationJson': specificationJson,
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue