mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-07 00:17:12 +08:00
feat: support admin api bind address to user (#630)
This commit is contained in:
@@ -7,10 +7,16 @@ import { getJsonSetting } from "../utils"
|
||||
import { CONSTANTS } from "../constants";
|
||||
import { unbindTelegramByAddress } from '../telegram_api/common';
|
||||
|
||||
export default {
|
||||
const UserBindAddressModule = {
|
||||
bind: async (c: Context<HonoCustomType>) => {
|
||||
const { user_id } = c.get("userPayload");
|
||||
const { address_id } = c.get("jwtPayload");
|
||||
return await UserBindAddressModule.bindByID(c, user_id, address_id)
|
||||
},
|
||||
bindByID: async (
|
||||
c: Context<HonoCustomType>,
|
||||
user_id: number | string, address_id: number | string
|
||||
) => {
|
||||
if (!address_id || !user_id) {
|
||||
return c.text("No address or user token", 400)
|
||||
}
|
||||
@@ -96,6 +102,11 @@ export default {
|
||||
},
|
||||
getBindedAddresses: async (c: Context<HonoCustomType>) => {
|
||||
const { user_id } = c.get("userPayload");
|
||||
return await UserBindAddressModule.getBindedAddressesById(c, user_id);
|
||||
},
|
||||
getBindedAddressesById: async (
|
||||
c: Context<HonoCustomType>, user_id: number | string
|
||||
) => {
|
||||
if (!user_id) {
|
||||
return c.text("No user token", 400)
|
||||
}
|
||||
@@ -229,3 +240,5 @@ export default {
|
||||
return c.json({ success: true })
|
||||
}
|
||||
}
|
||||
|
||||
export default UserBindAddressModule;
|
||||
|
||||
Reference in New Issue
Block a user