feat: add payment module
This commit is contained in:
4
modules/payment/routes/wallets/accounts/handle.ts
Normal file
4
modules/payment/routes/wallets/accounts/handle.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { getAccountsByWalletId } from "../../../repositories/account.ts";
|
||||
import route from "./spec.ts";
|
||||
|
||||
export default route.access("public").handle(async ({ params: { id } }) => getAccountsByWalletId(id));
|
||||
9
modules/payment/routes/wallets/accounts/spec.ts
Normal file
9
modules/payment/routes/wallets/accounts/spec.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { route } from "@platform/relay";
|
||||
import z from "zod";
|
||||
|
||||
import { AccountSchema } from "../../../schemas/account.ts";
|
||||
|
||||
export default route
|
||||
.get("/api/v1/payment/wallets/:id/accounts")
|
||||
.params({ id: z.uuid() })
|
||||
.response(z.array(AccountSchema));
|
||||
4
modules/payment/routes/wallets/create/handle.ts
Normal file
4
modules/payment/routes/wallets/create/handle.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { createWallet } from "../../../repositories/wallet.ts";
|
||||
import route from "./spec.ts";
|
||||
|
||||
export default route.access("public").handle(async ({ body }) => createWallet(body));
|
||||
6
modules/payment/routes/wallets/create/spec.ts
Normal file
6
modules/payment/routes/wallets/create/spec.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { route } from "@platform/relay";
|
||||
import z from "zod";
|
||||
|
||||
import { WalletInsertSchema } from "../../../schemas/wallet.ts";
|
||||
|
||||
export default route.post("/api/v1/payment/wallets").body(WalletInsertSchema).response(z.uuid());
|
||||
Reference in New Issue
Block a user