-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
地方公共団体(市町村、都道府県)を表すスキーマ | ||
*/ | ||
import { z } from "zod"; | ||
|
||
// 地方の列挙型 | ||
const Region = z.enum([ | ||
"北海道", | ||
"東北", | ||
"関東", | ||
"中部", | ||
"近畿", | ||
"中国", | ||
"四国", | ||
"九州", | ||
]); | ||
|
||
export type Region = z.infer<typeof Region>; | ||
|
||
// 都道府県の列挙型 | ||
const Prefecture = z.enum([ | ||
"北海道", | ||
"青森県", | ||
"岩手県", | ||
"宮城県", | ||
"秋田県", | ||
"山形県", | ||
"福島県", | ||
"茨城県", | ||
"栃木県", | ||
"群馬県", | ||
"埼玉県", | ||
"千葉県", | ||
"東京都", | ||
"神奈川県", | ||
"新潟県", | ||
"富山県", | ||
"石川県", | ||
"福井県", | ||
"山梨県", | ||
"長野県", | ||
"岐阜県", | ||
"静岡県", | ||
"愛知県", | ||
"三重県", | ||
"滋賀県", | ||
"京都府", | ||
"大阪府", | ||
"兵庫県", | ||
"奈良県", | ||
"和歌山県", | ||
"鳥取県", | ||
"島根県", | ||
"岡山県", | ||
"広島県", | ||
"山口県", | ||
"徳島県", | ||
"香川県", | ||
"愛媛県", | ||
"高知県", | ||
"福岡県", | ||
"佐賀県", | ||
"長崎県", | ||
"熊本県", | ||
"大分県", | ||
"宮崎県", | ||
"鹿児島県", | ||
"沖縄県", | ||
]); | ||
|
||
export type Prefecture = z.infer<typeof Prefecture>; | ||
|
||
const governmentObj = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
code: z.number(), | ||
region: Region, | ||
prefecture: Prefecture, | ||
}); | ||
|
||
export type Government = z.infer<typeof governmentObj>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
地域コミュニティ施策を表すスキーマ | ||
*/ | ||
import { z } from "zod"; | ||
|
||
// 部署 | ||
const branchObj = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
govCode: z.number(), | ||
createdAt: z.date(), | ||
updatedAt: z.date(), | ||
}); | ||
|
||
// 条例・規則・要綱等 | ||
const lawObj = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
createdAt: z.date(), | ||
updatedAt: z.date(), | ||
}); | ||
|
||
// 施策 | ||
const policyObj = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
branch: branchObj, | ||
law: lawObj, | ||
createdAt: z.date(), | ||
updatedAt: z.date(), | ||
}); | ||
|
||
export type Policy = z.infer<typeof policyObj>; | ||
|
||
/* | ||
sample data | ||
{ | ||
id: "hogehuga", | ||
name: "まちづくり交付金" | ||
branch: { | ||
id:"hoge", | ||
name:"地域振興課", | ||
govCode: 342131, | ||
law: "廿日市市まちづくり交付金交付要綱" | ||
createdAt: "2024-04-01T00:00:00" | ||
updatedAt: "2024-04-01T00:00:00" | ||
} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
/* | ||
In memory storage service | ||
*/ | ||
|
||
import type { Government } from "../schema/government"; | ||
|
||
const governments: Government[] = [ | ||
{ | ||
id: "1", | ||
name: "広島市", | ||
code: 341002, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "2", | ||
name: "広島市中区", | ||
code: 341011, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "3", | ||
name: "広島市東区", | ||
code: 341029, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "4", | ||
name: "広島市南区", | ||
code: 341037, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "5", | ||
name: "広島市西区", | ||
code: 341045, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "6", | ||
name: "広島市安佐南区", | ||
code: 341053, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "7", | ||
name: "広島市安佐北区", | ||
code: 341061, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "8", | ||
name: "広島市安芸区", | ||
code: 341070, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "9", | ||
name: "広島市佐伯区", | ||
code: 341088, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "10", | ||
name: "呉市", | ||
code: 342025, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "11", | ||
name: "竹原市", | ||
code: 342033, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "12", | ||
name: "三原市", | ||
code: 342041, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "13", | ||
name: "尾道市", | ||
code: 342050, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "14", | ||
name: "福山市", | ||
code: 342076, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "15", | ||
name: "府中市", | ||
code: 342084, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "16", | ||
name: "三次市", | ||
code: 342092, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "17", | ||
name: "庄原市", | ||
code: 342106, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "18", | ||
name: "大竹市", | ||
code: 342114, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "19", | ||
name: "東広島市", | ||
code: 342122, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "20", | ||
name: "廿日市市", | ||
code: 342131, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "21", | ||
name: "安芸高田市", | ||
code: 342149, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "22", | ||
name: "江田島市", | ||
code: 342157, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "23", | ||
name: "府中町", | ||
code: 343021, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "24", | ||
name: "海田町", | ||
code: 343048, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "25", | ||
name: "熊野町", | ||
code: 343072, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "26", | ||
name: "坂町", | ||
code: 343099, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "27", | ||
name: "安芸太田町", | ||
code: 343684, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "28", | ||
name: "北広島町", | ||
code: 343684, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "29", | ||
name: "大崎上島町", | ||
code: 344311, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "30", | ||
name: "世羅町", | ||
code: 344621, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
{ | ||
id: "31", | ||
name: "神石高原町", | ||
code: 345458, | ||
region: "中国", | ||
prefecture: "広島県", | ||
}, | ||
]; | ||
|
||
export class MemoryService { | ||
private governments: Government[] = governments; | ||
|
||
public async getGovernments(): Promise<Government[]> { | ||
return this.governments; | ||
} | ||
} |