mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
System inform (#2263)
* feat: Bind Notification Pipe (#2229) * chore: account page add bind notification modal * feat: timerlock schema and type * feat(fe): bind notification method modal * chore: fe adjust * feat: clean useless code * fix: cron lock * chore: adjust the code * chore: rename api * chore: remove unused code * chore: fe adjust * perf: bind inform ux * fix: time ts * chore: notification (#2251) * perf: send message code * perf: sub schema index * fix: timezone plugin * fix: format --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import dayjs from 'dayjs';
|
||||
import cronParser from 'cron-parser';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import timezone from 'dayjs/plugin/timezone';
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
export const formatTime2YMDHMW = (time?: Date) => dayjs(time).format('YYYY-MM-DD HH:mm:ss dddd');
|
||||
export const formatTime2YMDHM = (time?: Date) =>
|
||||
|
9
packages/global/common/type/utils.ts
Normal file
9
packages/global/common/type/utils.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
|
||||
{
|
||||
[K in Keys]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
||||
}[Keys];
|
||||
|
||||
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
|
||||
{
|
||||
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
||||
}[Keys];
|
@@ -1,11 +1,13 @@
|
||||
export enum UserAuthTypeEnum {
|
||||
register = 'register',
|
||||
findPassword = 'findPassword',
|
||||
wxLogin = 'wxLogin'
|
||||
wxLogin = 'wxLogin',
|
||||
bindNotification = 'bindNotification'
|
||||
}
|
||||
|
||||
export const userAuthTypeMap = {
|
||||
[UserAuthTypeEnum.register]: 'register',
|
||||
[UserAuthTypeEnum.findPassword]: 'findPassword',
|
||||
[UserAuthTypeEnum.wxLogin]: 'wxLogin'
|
||||
[UserAuthTypeEnum.wxLogin]: 'wxLogin',
|
||||
[UserAuthTypeEnum.bindNotification]: 'bindNotification'
|
||||
};
|
||||
|
@@ -15,3 +15,14 @@ export const InformLevelMap = {
|
||||
label: '紧急'
|
||||
}
|
||||
};
|
||||
|
||||
export enum SendInformTemplateCodeEnum {
|
||||
EXPIRE_SOON = 'EXPIRE_SOON',
|
||||
EXPIRED = 'EXPIRED',
|
||||
FREE_CLEAN = 'FREE_CLEAN',
|
||||
REGISTER = 'REGISTER',
|
||||
RESET_PASSWORD = 'RESET_PASSWORD',
|
||||
BIND_NOTIFICATION = 'BIND_NOTIFICATION',
|
||||
LACK_OF_POINTS = 'LACK_OF_POINTS',
|
||||
CUSTOM = 'CUSTOM'
|
||||
}
|
||||
|
11
packages/global/support/user/inform/type.d.ts
vendored
11
packages/global/support/user/inform/type.d.ts
vendored
@@ -1,13 +1,16 @@
|
||||
import { InformLevelEnum } from './constants';
|
||||
import { InformLevelEnum, SendInformTemplateCodeEnum } from './constants';
|
||||
|
||||
export type SendInformProps = {
|
||||
title: string;
|
||||
content: string;
|
||||
level: `${InformLevelEnum}`;
|
||||
templateCode: `${SendInformTemplateCodeEnum}`;
|
||||
templateParam: Record<string, any>;
|
||||
customLockMinutes?: number; // custom lock minutes
|
||||
};
|
||||
|
||||
export type SendInform2UserProps = SendInformProps & {
|
||||
tmbId: string;
|
||||
teamId: string;
|
||||
};
|
||||
|
||||
export type SendInform2User = SendInformProps & {
|
||||
type: `${InformTypeEnum}`;
|
||||
tmbId: string;
|
||||
|
4
packages/global/support/user/team/type.d.ts
vendored
4
packages/global/support/user/team/type.d.ts
vendored
@@ -18,7 +18,9 @@ export type TeamSchema = {
|
||||
};
|
||||
lafAccount: LafAccountType;
|
||||
defaultPermission: PermissionValueType;
|
||||
notificationAccount?: string;
|
||||
};
|
||||
|
||||
export type tagsType = {
|
||||
label: string;
|
||||
key: string;
|
||||
@@ -63,6 +65,7 @@ export type TeamTmbItemType = {
|
||||
role: `${TeamMemberRoleEnum}`;
|
||||
status: `${TeamMemberStatusEnum}`;
|
||||
lafAccount?: LafAccountType;
|
||||
notificationAccount?: string;
|
||||
permission: TeamPermission;
|
||||
};
|
||||
|
||||
@@ -72,7 +75,6 @@ export type TeamMemberItemType = {
|
||||
teamId: string;
|
||||
memberName: string;
|
||||
avatar: string;
|
||||
// TODO: this should be deprecated.
|
||||
role: `${TeamMemberRoleEnum}`;
|
||||
status: `${TeamMemberStatusEnum}`;
|
||||
permission: TeamPermission;
|
||||
|
6
packages/global/support/user/type.d.ts
vendored
6
packages/global/support/user/type.d.ts
vendored
@@ -1,12 +1,10 @@
|
||||
import { TeamPermission } from '../permission/user/controller';
|
||||
import { UserStatusEnum } from './constant';
|
||||
import { TeamTmbItemType } from './team/type';
|
||||
|
||||
export type UserModelSchema = {
|
||||
_id: string;
|
||||
username: string;
|
||||
email?: string;
|
||||
phonePrefix?: number;
|
||||
phone?: string;
|
||||
password: string;
|
||||
avatar: string;
|
||||
promotionRate: number;
|
||||
@@ -31,4 +29,6 @@ export type UserType = {
|
||||
openaiAccount: UserModelSchema['openaiAccount'];
|
||||
team: TeamTmbItemType;
|
||||
standardInfo?: standardInfoType;
|
||||
notificationAccount?: string;
|
||||
permission: TeamPermission;
|
||||
};
|
||||
|
Reference in New Issue
Block a user