53 lines
1.5 KiB
Dart
53 lines
1.5 KiB
Dart
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
|
|
import '../constants.dart';
|
|
import 'language.dart';
|
|
import 'location.dart';
|
|
|
|
class UserProfile {
|
|
final String id;
|
|
final String uid;
|
|
final String email;
|
|
final String name;
|
|
final String firstName;
|
|
final String lastName;
|
|
final String risk;
|
|
final List<String> skills;
|
|
final List<String> skillsSought;
|
|
final List<Language> languages;
|
|
final Map<String, MyLocation?> locations;
|
|
|
|
UserProfile({
|
|
required this.id,
|
|
required this.uid,
|
|
required this.email,
|
|
required this.name,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
required this.risk,
|
|
required this.skills,
|
|
required this.skillsSought,
|
|
required this.languages,
|
|
required this.locations,
|
|
});
|
|
|
|
factory UserProfile.fromDocument(DocumentSnapshot doc) {
|
|
Map<String, dynamic> data = doc.data() as Map<String, dynamic>;
|
|
|
|
return UserProfile(
|
|
id: doc.id,
|
|
uid: data[Constants.dbFieldUsersID] ?? '',
|
|
email: data[Constants.dbFieldUsersEmail] ?? '',
|
|
name: data[Constants.dbFieldUsersName] ?? '',
|
|
firstName: data[Constants.dbFieldUsersFirstName] ?? '',
|
|
lastName: data[Constants.dbFieldUsersLastName] ?? '',
|
|
skills: List<String>.from(data[Constants.dbFieldUsersSkills] ?? []),
|
|
skillsSought:
|
|
List<String>.from(data[Constants.dbFieldUsersSkillsSought] ?? []),
|
|
risk: data[Constants.dbFieldUsersRiskTolerance] ?? '',
|
|
languages: [],
|
|
locations: {},
|
|
);
|
|
}
|
|
}
|