Initial commit
This commit is contained in:
12
shared/modules/todo/api.ts
Normal file
12
shared/modules/todo/api.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineEndpoints } from '../types.js'
|
||||
|
||||
export const TODO_ENDPOINTS = defineEndpoints({
|
||||
list: { path: '/', method: 'GET' },
|
||||
save: { path: '/save', method: 'POST' },
|
||||
add: { path: '/add', method: 'POST' },
|
||||
toggle: { path: '/toggle', method: 'POST' },
|
||||
update: { path: '/update', method: 'POST' },
|
||||
delete: { path: '/delete', method: 'DELETE' },
|
||||
})
|
||||
|
||||
export type TodoEndpoints = typeof TODO_ENDPOINTS
|
||||
16
shared/modules/todo/index.ts
Normal file
16
shared/modules/todo/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineApiModule } from '../types.js'
|
||||
import { TODO_ENDPOINTS } from './api.js'
|
||||
|
||||
export * from './types.js'
|
||||
export * from './api.js'
|
||||
|
||||
export const TODO_MODULE = defineApiModule({
|
||||
id: 'todo',
|
||||
name: 'TODO',
|
||||
basePath: '/todo',
|
||||
order: 30,
|
||||
version: '1.0.0',
|
||||
endpoints: TODO_ENDPOINTS,
|
||||
})
|
||||
|
||||
export type { TodoEndpoints } from './api.js'
|
||||
22
shared/modules/todo/types.ts
Normal file
22
shared/modules/todo/types.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { DayTodo } from '../../types/todo.js'
|
||||
|
||||
export interface TodoFilePath {
|
||||
relPath: string
|
||||
fullPath: string
|
||||
}
|
||||
|
||||
export interface ParsedTodoFile {
|
||||
fullPath: string
|
||||
dayTodos: DayTodo[]
|
||||
}
|
||||
|
||||
export interface GetTodoResult {
|
||||
dayTodos: DayTodo[]
|
||||
year: number
|
||||
month: number
|
||||
}
|
||||
|
||||
export interface MigrationContext {
|
||||
todayStr: string
|
||||
yesterdayStr: string
|
||||
}
|
||||
Reference in New Issue
Block a user