mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-08-09 07:23:50 +08:00
feat: add admin mail detail API (#1099)
* feat: add admin mail detail API * docs: clarify admin mail detail response
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Context } from "hono";
|
||||
import { handleMailListQuery } from "../common";
|
||||
import { resolveRawEmailRow } from "../gzip";
|
||||
|
||||
export default {
|
||||
getMails: async (c: Context<HonoCustomType>) => {
|
||||
@@ -24,6 +25,14 @@ export default {
|
||||
[], limit, offset
|
||||
);
|
||||
},
|
||||
getMail: async (c: Context<HonoCustomType>) => {
|
||||
const { id } = c.req.param();
|
||||
const result = await c.env.DB.prepare(
|
||||
`SELECT * FROM raw_mails WHERE id = ?`
|
||||
).bind(id).first();
|
||||
if (!result) return c.json(null);
|
||||
return c.json(await resolveRawEmailRow(result));
|
||||
},
|
||||
deleteMail: async (c: Context<HonoCustomType>) => {
|
||||
const { id } = c.req.param();
|
||||
const { success } = await c.env.DB.prepare(
|
||||
|
||||
@@ -33,6 +33,7 @@ api.post('/admin/address/:id/reset_password', address_api.resetPassword)
|
||||
// mail api
|
||||
api.get('/admin/mails', admin_mail_api.getMails)
|
||||
api.get('/admin/mails_unknow', admin_mail_api.getUnknowMails)
|
||||
api.get('/admin/mails/:id', admin_mail_api.getMail)
|
||||
api.delete('/admin/mails/:id', admin_mail_api.deleteMail)
|
||||
|
||||
// address sender
|
||||
|
||||
Reference in New Issue
Block a user