Skip to content

Commit da549f4

Browse files
committed
bug fix
1 parent 65dc3e8 commit da549f4

File tree

10 files changed

+78
-9
lines changed

10 files changed

+78
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import '../../converters/date_time_timestamp_converter.dart';
2+
import 'package:cloud_firestore/cloud_firestore.dart';
3+
import 'package:freezed_annotation/freezed_annotation.dart';
4+
5+
part 'maintenance.freezed.dart';
6+
part 'maintenance.g.dart';
7+
8+
@freezed
9+
class Maintenance with _$Maintenance {
10+
factory Maintenance({
11+
required String status,
12+
@DateTimeTimestampConverter() DateTime? createdAt,
13+
@DateTimeTimestampConverter() DateTime? updatedAt,
14+
}) = _Maintenance;
15+
Maintenance._();
16+
17+
factory Maintenance.fromJson(Map<String, dynamic> json) =>
18+
_$MaintenanceFromJson(json);
19+
20+
static String get collectionPath => throw UnimplementedError(); // appService/${appServiceId}/maintenance
21+
static String docPath(String id) => throw UnimplementedError(); // appService/${appServiceId}/maintenance/$id
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Doc, Field, Codable, Model, Timestamp, CollectionReference, Collection, firestore } from '@1amageek/ballcap-admin'
2+
3+
export class Maintenance extends Doc {
4+
static collectionReference(): CollectionReference {
5+
return firestore.collection('appService').doc('v1').collection('maintenance')
6+
}
7+
8+
@Field status: string
9+
10+
}

example/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "shohei",
1010
"license": "MIT",
1111
"devDependencies": {
12-
"fdmd": "0.0.19"
12+
"fdmd": "0.0.21"
1313
}
1414
}

example/yaml/db.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ domains:
1616
- name: Master
1717
path: /master
1818
description: マスター管理
19+
- name: AppService
20+
path: /appService
21+
description: アプリシステムの状態
1922
docs:
2023
- name: Poster
2124
path: /social/${socialId}/posters/${posterId}
@@ -86,6 +89,20 @@ docs:
8689
- field: codes
8790
type: string,array,nullable
8891
example: ['000000', FFFFFF]
92+
- name: Maintenance
93+
path: /appService/${appServiceId}/maintenance/${maintenanceId}
94+
description: メンテナンス情報
95+
codeGenerate: true
96+
data:
97+
- field: status
98+
type: string
99+
example: active
100+
- field: createdAt
101+
type: timestamp,nullable
102+
example: '2021-09-16T13:10:52+09:00'
103+
- field: updatedAt
104+
type: timestamp,nullable
105+
example: '2021-09-16T13:10:52+09:00'
89106
maps:
90107
- name: ThumbnailImage
91108
description: 画像情報

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fdmd",
3-
"version": "0.0.19",
3+
"version": "0.0.21",
44
"description": "firestore data modeling design tool",
55
"main": "index.js",
66
"bin": {

publish.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm publish

src/repositories/dart_freezed_generator_repository.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class DartFreezedGeneratorRepository {
119119
? fdmd.docs
120120
.filter((e) => Utils.isNotNull(e.name) && e.codeGenerate === true)
121121
.map((doc) => {
122-
const domainName = Doc.getDomainNameFromPath(doc.path)
122+
const domainName = Utils.camelToSnake(Doc.getDomainNameFromPath(doc.path))
123123
const docSnakeName = Utils.camelToSnake(doc.name)
124124
const docPath = `${outputPath}/${domainName}/${docSnakeName}`
125125
const dataFields = fdmd.getDataFields(doc)
@@ -162,9 +162,9 @@ export class DartFreezedGeneratorRepository {
162162
: []
163163
for (const data of outputDocsData) {
164164
const doc = data.doc
165-
const domainName = Doc.getDomainNameFromPath(doc.path)
165+
const domainSnakeName = Utils.camelToSnake(Doc.getDomainNameFromPath(doc.path))
166166
const docSnakeName = Utils.camelToSnake(doc.name)
167-
const docPath = `${outputPath}/${domainName}/${docSnakeName}`
167+
const docPath = `${outputPath}/${domainSnakeName}/${docSnakeName}`
168168
fs.mkdirSync(docPath, { recursive: true })
169169
const template = fs.readFileSync(`${tempPath}/dart_doc_freezed.temp`, 'utf8')
170170
const code = template

src/repositories/ts_ballcap_admin_generator_repository.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class TsBallcapAdminGeneratorRepository {
113113
? fdmd.docs
114114
.filter((e) => Utils.isNotNull(e.name) && e.codeGenerate === true)
115115
.map((doc) => {
116-
const domainName = Doc.getDomainNameFromPath(doc.path)
116+
const domainName = Utils.camelToSnake(Doc.getDomainNameFromPath(doc.path))
117117
const docSnakeName = Utils.camelToSnake(doc.name)
118118
const docPath = `${outputPath}/${domainName}`
119119
const dataFields = fdmd.getDataFields(doc)
@@ -148,6 +148,7 @@ export class TsBallcapAdminGeneratorRepository {
148148
: []
149149
for (const data of outputDocsData) {
150150
const doc = data.doc
151+
// const domainCamelName = Utils.camelToSnake(Doc.getDomainNameFromPath(doc.path))
151152
const domainName = Doc.getDomainNameFromPath(doc.path)
152153
const docCamelName = Utils.snakeToCamel(Utils.firstCharUpper(doc.name))
153154
const template = fs.readFileSync(`${tempPath}/ts_ballcap_admin_doc.temp`, 'utf8')

yaml/db.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ domains:
1616
- name: Master
1717
path: /master
1818
description: マスター管理
19+
- name: AppService
20+
path: /appService
21+
description: アプリシステムの状態
1922
docs:
2023
- name: Poster
2124
path: /social/${socialId}/posters/${posterId}
@@ -86,6 +89,20 @@ docs:
8689
- field: codes
8790
type: string,array,nullable
8891
example: ['000000', FFFFFF]
92+
- name: Maintenance
93+
path: /appService/${appServiceId}/maintenance/${maintenanceId}
94+
description: メンテナンス情報
95+
codeGenerate: true
96+
data:
97+
- field: status
98+
type: string
99+
example: active
100+
- field: createdAt
101+
type: timestamp,nullable
102+
example: '2021-09-16T13:10:52+09:00'
103+
- field: updatedAt
104+
type: timestamp,nullable
105+
example: '2021-09-16T13:10:52+09:00'
89106
maps:
90107
- name: ThumbnailImage
91108
description: 画像情報

0 commit comments

Comments
 (0)