Skip to content

Commit

Permalink
Merge branch 'entire_refactor' into release_to_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kosukesaigusa committed Sep 10, 2023
2 parents c49da78 + 4308827 commit cac55ba
Show file tree
Hide file tree
Showing 45 changed files with 1,244 additions and 804 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/flutter_ci_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,20 @@ jobs:
id: dartfile
run: |
echo "Checking for changes in Dart files..."
changes=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- '*.dart')
if [ -z "$changes" ]; then
echo "No Dart files changed."
echo "run-tests=false" >> $GITHUB_ENV
else
base_sha=${{ github.event.pull_request.base.sha }}
current_sha=${{ github.event.pull_request.head.sha }}
echo "Base SHA: $base_sha"
echo "Current SHA: $current_sha"
git diff --name-only $base_sha $current_sha || true
changed_files=$(git diff $base_sha $current_sha --name-only | grep '\.dart$' || true)
if [[ -n "$changed_files" ]]; then
echo "Dart files changed."
echo "run-tests=true" >> $GITHUB_ENV
echo "dart-changes=true" >> $GITHUB_ENV
else
echo "No Dart files changed."
echo "dart-changes=false" >> $GITHUB_ENV
fi
# fvm のバージョンとチャネルを環境変数に設定する
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export 'in_review_config.dart';
export 'job.dart';
export 'read_status.dart';
export 'review.dart';
export 'sample_todo.dart';
export 'todo.dart';
export 'user_fcm_token.dart';
export 'user_social_login.dart';
export 'worker.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import 'package:json_annotation/json_annotation.dart';

part 'host_location.flutterfire_gen.dart';

// NOT: ドキュメント ID は hostId と一致する。
@FirestoreDocument(path: 'hostLocations', documentName: 'hostLocation')
class HostLocation {
const HostLocation({
required this.hostId,
required this.address,
required this.geo,
this.createdAt,
this.updatedAt,
});

final String hostId;

@ReadDefault('')
final String address;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class ReadHostLocation {
const ReadHostLocation({
required this.hostLocationId,
required this.path,
required this.hostId,
required this.address,
required this.geo,
required this.createdAt,
Expand All @@ -19,8 +18,6 @@ class ReadHostLocation {

final String path;

final String hostId;

final String address;

final Geo geo;
Expand All @@ -33,7 +30,6 @@ class ReadHostLocation {
return ReadHostLocation(
hostLocationId: json['hostLocationId'] as String,
path: json['path'] as String,
hostId: json['hostId'] as String,
address: json['address'] as String? ?? '',
geo: _geoConverter.fromJson(json['geo'] as Map<String, dynamic>),
createdAt: (json['createdAt'] as Timestamp?)?.toDate(),
Expand All @@ -53,18 +49,15 @@ class ReadHostLocation {

class CreateHostLocation {
const CreateHostLocation({
required this.hostId,
required this.address,
required this.geo,
});

final String hostId;
final String address;
final Geo geo;

Map<String, dynamic> toJson() {
return {
'hostId': hostId,
'address': address,
'geo': _geoConverter.toJson(geo),
'createdAt': FieldValue.serverTimestamp(),
Expand All @@ -75,20 +68,17 @@ class CreateHostLocation {

class UpdateHostLocation {
const UpdateHostLocation({
this.hostId,
this.address,
this.geo,
this.createdAt,
});

final String? hostId;
final String? address;
final Geo? geo;
final DateTime? createdAt;

Map<String, dynamic> toJson() {
return {
if (hostId != null) 'hostId': hostId,
if (address != null) 'address': address,
if (geo != null) 'geo': _geoConverter.toJson(geo!),
if (createdAt != null) 'createdAt': createdAt,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutterfire_gen_annotation/flutterfire_gen_annotation.dart';

part 'sample_todo.flutterfire_gen.dart';
part 'todo.flutterfire_gen.dart';

@FirestoreDocument(path: 'sampleTodos', documentName: 'sampleTodo')
class SampleTodo {
const SampleTodo({
@FirestoreDocument(path: 'sampleTodos', documentName: 'todo')
class Todo {
const Todo({
required this.title,
required this.description,
required this.isDone,
Expand Down
Loading

0 comments on commit cac55ba

Please sign in to comment.