logs
Logs
Keep a record of everything that happend on BackBone, let clients use the same to track what is happening on thier account as well as on thier app or third party apis, etc.
- Data Structure
- Data Model
- Log
- - log 1
- - - type (chnage, deleted, added, auth)
- - - field
- - - original
- - - update
- - - by (id)
- - - time
class LogEntry { // Renamed to LogEntry for clarity
final String type;
final String field;
final String? original;
final String? update;
final String by; // Store user ID
final DateTime time;
LogEntry({
required this.type,
required this.field,
this.original,
this.update,
required this.by,
required this.time,
});
Map<String, dynamic> toMap() {
return {
'type': type,
'field': field,
'original': original,
'update': update,
'by': by,
'time': time.toIso8601String(),
};
}
factory LogEntry.fromFirestore(Map<String, dynamic> data) {
return LogEntry(
type: data['type'],
field: data['field'],
original: data['original'],
update: data['update'],
by: data['by'],
time: DateTime.parse(data['time']),
);
}
}