fix: invite link (#4229)

* fix: invite link

* feat: create invite link and copy it directly
This commit is contained in:
Finley Ge
2025-03-19 19:59:55 +08:00
committed by archer
parent 077350e651
commit 73451dbc64
6 changed files with 70 additions and 34 deletions

View File

@@ -1,15 +1,18 @@
import {
TeamCollectionName,
TeamMemberCollectionName
} from '@fastgpt/global/support/user/team/constant';
import { TeamCollectionName } from '@fastgpt/global/support/user/team/constant';
import { connectionMongo, getMongoModel } from '../../../../common/mongo';
import { InvitationSchemaType } from './type';
import addDays from 'date-fns/esm/fp/addDays/index.js';
import { randomUUID } from 'crypto';
const { Schema } = connectionMongo;
export const InvitationCollectionName = 'team_invitation_links';
const InvitationSchema = new Schema({
linkId: {
type: String,
required: true,
unique: true,
default: () => randomUUID()
},
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName,

View File

@@ -2,6 +2,7 @@ import { TeamMemberSchema } from '@fastgpt/global/support/user/team/type';
export type InvitationSchemaType = {
_id: string;
linkId: string;
teamId: string;
usedTimesLimit?: number;
forbidden?: boolean;
@@ -25,11 +26,10 @@ export type InvitationLinkCreateType = {
expires: InvitationLinkExpiresType;
usedTimesLimit: 1 | -1;
};
export type InvitationLinkUpdateType = Partial<
Omit<InvitationSchemaType, 'members' | 'teamId' | '_id'>
> & {
linkId: string;
};
// export type InvitationLinkUpdateType = Partial<
// Omit<InvitationSchemaType, 'members' | 'teamId' | '_id'>
// >;
export type InvitationInfoType = InvitationSchemaType & {
teamAvatar: string;