Skip to content

Commit

Permalink
feat: add title to job document
Browse files Browse the repository at this point in the history
  • Loading branch information
kosukesaigusa committed Jul 26, 2023
1 parent 6ef3967 commit 39a3d51
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/firebase_common/lib/src/firestore_documents/job.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ part 'job.flutterfire_gen.dart';
class Job {
const Job({
required this.hostId,
required this.title,
required this.content,
required this.place,
this.accessTypes = const <AccessType>{},
Expand All @@ -23,6 +24,9 @@ class Job {

final String hostId;

@ReadDefault('')
final String title;

@ReadDefault('')
final String content;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ReadJob {
required this.hostLocationId,
required this.path,
required this.hostId,
required this.title,
required this.content,
required this.place,
required this.accessTypes,
Expand All @@ -27,6 +28,8 @@ class ReadJob {

final String hostId;

final String title;

final String content;

final String place;
Expand All @@ -52,6 +55,7 @@ class ReadJob {
hostLocationId: json['hostLocationId'] as String,
path: json['path'] as String,
hostId: json['hostId'] as String,
title: json['title'] as String? ?? '',
content: json['content'] as String? ?? '',
place: json['place'] as String? ?? '',
accessTypes: json['accessTypes'] == null
Expand Down Expand Up @@ -88,6 +92,7 @@ class ReadJob {
class CreateJob {
const CreateJob({
required this.hostId,
required this.title,
required this.content,
required this.place,
this.accessTypes = const <AccessType>{},
Expand All @@ -101,6 +106,7 @@ class CreateJob {
});

final String hostId;
final String title;
final String content;
final String place;
final Set<AccessType> accessTypes;
Expand All @@ -115,6 +121,7 @@ class CreateJob {
Map<String, dynamic> toJson() {
return {
'hostId': hostId,
'title': title,
'content': content,
'place': place,
'accessTypes': _accessTypesConverter.toJson(accessTypes),
Expand All @@ -133,6 +140,7 @@ class CreateJob {
class UpdateJob {
const UpdateJob({
this.hostId,
this.title,
this.content,
this.place,
this.accessTypes,
Expand All @@ -146,6 +154,7 @@ class UpdateJob {
});

final String? hostId;
final String? title;
final String? content;
final String? place;
final Set<AccessType>? accessTypes;
Expand All @@ -160,6 +169,7 @@ class UpdateJob {
Map<String, dynamic> toJson() {
return {
if (hostId != null) 'hostId': hostId,
if (title != null) 'title': title,
if (content != null) 'content': content,
if (place != null) 'place': place,
if (accessTypes != null)
Expand Down

0 comments on commit 39a3d51

Please sign in to comment.