This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
-
-
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.
- Loading branch information
1 parent
b2957b0
commit 827ec69
Showing
29 changed files
with
1,335 additions
and
333 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
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 |
---|---|---|
@@ -1,12 +1,6 @@ | ||
require('dotenv').config(); | ||
|
||
module.exports = [ | ||
{ | ||
input: 'src/pages/api', | ||
baseURL: `${process.env.NEXT_PUBLIC_API_ENDOPOINT ?? 'http://localhost:3000'}`, | ||
}, | ||
{ | ||
input: 'src/infra/server/shared/database/notion/api', | ||
baseURL: `${process.env.NOTION_BASE_URL ?? 'https://api.notion.com/v1'}`, | ||
} | ||
]; | ||
module.exports = { | ||
input: 'src/pages/api', | ||
baseURL: `${process.env.NEXT_PUBLIC_API_ENDOPOINT ?? 'http://localhost:3000'}`, | ||
}; |
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
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 |
---|---|---|
@@ -1,21 +1,15 @@ | ||
{ | ||
"title": [ | ||
"table": "tags", | ||
"name": "タグ", | ||
"columns": [ | ||
{ | ||
"type": "text", | ||
"text": { | ||
"content": "タグ", | ||
"link": null | ||
} | ||
} | ||
], | ||
"properties": { | ||
"タグ名": { | ||
"title": {} | ||
"name": "タグ名", | ||
"type": "title" | ||
}, | ||
"ユーザー": { | ||
"relation": { | ||
"database_id": "${TAG_DB_ID}" | ||
} | ||
{ | ||
"name": "ユーザー", | ||
"type": "relation", | ||
"relation": "users" | ||
} | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,43 +1,41 @@ | ||
{ | ||
"title": [ | ||
"table": "tasks", | ||
"name": "タスク", | ||
"columns": [ | ||
{ | ||
"type": "text", | ||
"text": { | ||
"content": "タスク", | ||
"link": null | ||
} | ||
} | ||
], | ||
"properties": { | ||
"タスク名": { | ||
"title": {} | ||
"name": "タスク名", | ||
"type": "title" | ||
}, | ||
"メモ": { | ||
"rich_text": {} | ||
{ | ||
"name": "メモ", | ||
"type": "text" | ||
}, | ||
"ステータス": { | ||
"rich_text": {} | ||
{ | ||
"name": "ステータス", | ||
"type": "text" | ||
}, | ||
"期日": { | ||
"date": {} | ||
{ | ||
"name": "期日", | ||
"type": "datetime" | ||
}, | ||
"作業見積": { | ||
"number": { | ||
"format": "number" | ||
} | ||
{ | ||
"name": "作業見積", | ||
"type": "int" | ||
}, | ||
"作業見積単位": { | ||
"rich_text": {} | ||
{ | ||
"name": "作業見積単位", | ||
"type": "text" | ||
}, | ||
"ユーザー": { | ||
"relation": { | ||
"database_id": "${USER_DB_ID}" | ||
} | ||
{ | ||
"name": "ユーザー", | ||
"type": "relation", | ||
"relation": "users" | ||
}, | ||
"タグ": { | ||
"relation": { | ||
"database_id": "${TAG_DB_ID}" | ||
} | ||
{ | ||
"name": "タグ", | ||
"type": "relation", | ||
"relation": "tags", | ||
"multiple": true | ||
} | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
{ | ||
"title": [ | ||
"table": "users", | ||
"name": "ユーザー", | ||
"columns": [ | ||
{ | ||
"type": "text", | ||
"text": { | ||
"content": "ユーザー", | ||
"link": null | ||
} | ||
"name": "ユーザー識別子", | ||
"type": "title" | ||
} | ||
], | ||
"properties": { | ||
"ユーザー識別子": { | ||
"title": {} | ||
} | ||
} | ||
} | ||
] | ||
} |
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
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 |
---|---|---|
@@ -1,21 +1,17 @@ | ||
import type { RestHandler } from 'msw'; | ||
import { rest } from 'msw'; | ||
import { setupServer } from 'msw/node'; | ||
import aspida from '@aspida/axios'; | ||
import notionApi from '@/server/shared/database/notion/api/$api'; | ||
import type { ApiInstance } from '@/server/shared/database/notion/api/$api'; | ||
|
||
const mockNotionBaseUrl = 'https://example.com'; | ||
export const mockNotionBaseUrl = 'https://example.com'; | ||
type Method = keyof typeof rest; | ||
export const createHandler = (method: Method, path: string, status: number, jsonBody: any): RestHandler => rest[method](path, (req, res, ctx) => res( | ||
ctx.status(status), | ||
ctx.json(jsonBody), | ||
)); | ||
export const createNotionHandler = (method: Method, path: string, status: number, jsonBody: any): RestHandler => createHandler(method, `${mockNotionBaseUrl}${path}`, status, jsonBody); | ||
export const createNotionHandler = (method: Method, path: string, status: number, jsonBody: any): RestHandler => createHandler(method, `${mockNotionBaseUrl}/v1${path}`, status, jsonBody); | ||
export const useMockServer = (handlers: RestHandler[]) => { | ||
const server = setupServer(...handlers); | ||
beforeAll(() => server.listen({ onUnhandledRequest: 'error' })); | ||
afterEach(() => server.resetHandlers()); | ||
afterAll(() => server.close()); | ||
}; | ||
export const getNotionApi = () => notionApi(aspida(undefined, { baseURL: mockNotionBaseUrl })) as ApiInstance; |
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 |
---|---|---|
@@ -1,22 +1,15 @@ | ||
import type { MigrationSchemas } from '^/usecase/migrationUseCase'; | ||
import { container } from 'tsyringe'; | ||
import Env from '@/server/shared/env'; | ||
import { IndexPageProps } from '@/web/pages/index/server'; | ||
import api from '@/server/shared/database/notion/api/$api'; | ||
import aspida from '@aspida/axios'; | ||
import userSchema from '../../schema/user.json'; | ||
import tagSchema from '../../schema/tag.json'; | ||
import taskSchema from '../../schema/task.json'; | ||
import Env from '@/server/shared/env'; | ||
import userSchema from '../../schema/user.json'; | ||
|
||
container.registerInstance('NotionClient', api(aspida())); | ||
container.registerInstance('IEnv', Env); | ||
|
||
// pages | ||
container.registerSingleton('IIndexPageProps', IndexPageProps); | ||
|
||
// schema | ||
container.registerInstance('MigrationSchemas', { | ||
'USER_DB_ID': userSchema, | ||
'TAG_DB_ID': tagSchema, | ||
'TASK_DB_ID': taskSchema, | ||
} as MigrationSchemas); | ||
container.registerInstance('MigrationSchemas', [userSchema, tagSchema, taskSchema] as MigrationSchemas); |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default interface IEnv { | ||
getValue(key: string): string | never; | ||
}; | ||
} |
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
6 changes: 6 additions & 0 deletions
6
src/infra/server/shared/database/notion/__fixtures__/query_database_empty.json
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,6 @@ | ||
{ | ||
"object": "list", | ||
"results": [], | ||
"has_more": false, | ||
"next_cursor": null | ||
} |
Oops, something went wrong.