34 lines
624 B
TypeScript
34 lines
624 B
TypeScript
import { RecordModel } from "pocketbase"
|
|
|
|
import { managePbError } from "../../utils/pbTools"
|
|
import pbClient from "../pbClient"
|
|
|
|
const DB_NAME = "message_group"
|
|
|
|
export interface ReceiveGroup {
|
|
name: string
|
|
email?: string[]
|
|
chatId?: string[]
|
|
openId?: string[]
|
|
unionId?: string[]
|
|
userId?: string[]
|
|
}
|
|
|
|
export type ReceiveGroupModel = ReceiveGroup & RecordModel
|
|
|
|
/**
|
|
* 根据ID获取指定消息组
|
|
* @param id
|
|
* @returns
|
|
*/
|
|
const getOne = (id: string) =>
|
|
managePbError<ReceiveGroupModel>(() =>
|
|
pbClient.collection(DB_NAME).getOne(id)
|
|
)
|
|
|
|
const receiveGroup = {
|
|
getOne,
|
|
}
|
|
|
|
export default receiveGroup
|