保存
This commit is contained in:
20
mail-worker/src/api/account-api.js
Normal file
20
mail-worker/src/api/account-api.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import app from '../hono/hono';
|
||||
import accountService from '../service/account-service';
|
||||
import result from '../model/result';
|
||||
import userContext from '../security/user-context';
|
||||
|
||||
app.get('/account/list', async (c) => {
|
||||
const list = await accountService.list(c, c.req.query(), await userContext.getUserId(c));
|
||||
return c.json(result.ok(list));
|
||||
});
|
||||
|
||||
app.delete('/account/delete', async (c) => {
|
||||
await accountService.delete(c, c.req.query(), await userContext.getUserId(c));
|
||||
return c.json(result.ok());
|
||||
});
|
||||
|
||||
app.post('/account/add', async (c) => {
|
||||
const account = await accountService.add(c, await c.req.json(), await userContext.getUserId(c));
|
||||
return c.json(result.ok(account));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user