Files
prosappweb/lib/models/comment_entity.dart
T
Lizandro GuarnizoandClaude Sonnet 4.6 60216fd0e3 feat: migrate Firebase → NestJS REST API backend
Replace all Firebase SDK (Auth, Firestore, Storage) with HTTP calls
to backend.prosapp.co/api/v1:

- New ApiService singleton (JWT token, GET/POST/PATCH/DELETE/upload)
- auth_provider: Firebase Auth → /auth/login, /auth/register, /auth/phone/*
- services_provider + calendar_services_provider → /services endpoints
- professional_provider + professionals_provider → /professional-info, /users/professionals
- profile_form_provider + professional_form_provider → /users/me, /storage/upload
- cities/professions/settings providers → /cities, /professions, /settings
- firebase_chat_repository → polling via /chats endpoints (3s interval)
- firebase_score_repository → polling via /comments endpoints (10s interval)
- professional_detail_provider → /users/:id + /professional-info/:id
- dashboard_view: Firestore.add → POST /services
- chat_view + rating_view: FirebaseAuth.uid → AuthProvider.user.id
- Models: Timestamp → String for createdAt fields
- google_fonts upgraded to ^8.1.0 (Dart 3.12 compat)
- Remove firebase_core, firebase_auth, cloud_firestore, firebase_storage from pubspec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 15:53:39 -05:00

49 lines
1.3 KiB
Dart

class CommentEntity {
final String authorId;
final String destinationId;
final String serviceId;
final String content;
final double score;
final bool isFromUser;
final String createdAt;
const CommentEntity({
required this.authorId,
required this.destinationId,
required this.serviceId,
required this.content,
required this.score,
required this.isFromUser,
required this.createdAt,
});
static CommentEntity fromDocument(Map<String, dynamic> doc) {
return CommentEntity(
authorId: doc['author_id'] as String? ?? '',
destinationId: doc['destination_id'] as String? ?? '',
serviceId: doc['service_id'] as String? ?? '',
content: doc['content'] as String? ?? '',
score: (doc['score'] as num?)?.toDouble() ?? 0.0,
isFromUser: doc['is_from_user'] as bool? ?? false,
createdAt: doc['created_at']?.toString() ?? '',
);
}
Map<String, dynamic> toDocument() {
return {
'author_id': authorId,
'destination_id': destinationId,
'service_id': serviceId,
'content': content,
'score': score,
'is_from_user': isFromUser,
'created_at': createdAt,
};
}
@override
String toString() {
return 'CommentEntity{authorId: $authorId, destinationId: $destinationId, score: $score}';
}
}