Refactor to vertical slice
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type { AppContext } from '@/types/hono';
|
||||
import type { AdminUpdatePlanInput } from '@repo/api-contract';
|
||||
import { updatePlan } from './update-plan.business';
|
||||
|
||||
type UpdatePlanParams = { code: string };
|
||||
|
||||
export async function updatePlanHandler(c: AppContext) {
|
||||
const { code } = c.req.valid('param' as never) as UpdatePlanParams;
|
||||
const body = c.req.valid('json' as never) as AdminUpdatePlanInput;
|
||||
|
||||
const result = await updatePlan(code, body);
|
||||
|
||||
if (!result.ok) {
|
||||
return c.json({ message: result.message }, 404);
|
||||
}
|
||||
|
||||
return c.json(result.data);
|
||||
}
|
||||
Reference in New Issue
Block a user