update team name
This commit is contained in:
parent
89e6e02664
commit
c957b152b7
2 changed files with 27 additions and 3 deletions
|
@ -30,6 +30,15 @@ export class GroupEndpoint extends ScimEndpoint implements IScimEndpoint {
|
|||
}
|
||||
|
||||
public async _put(ctx: Context): Promise<IApiResponse> {
|
||||
const u = SCIMGroup.fromPlain(ctx.content());
|
||||
const o = await ctx.rc.team.update({
|
||||
teamId: ctx.id(),
|
||||
data: {
|
||||
name: u.displayName,
|
||||
},
|
||||
});
|
||||
this.handleError(o);
|
||||
await ctx.store.saveGroup(ctx.id(), { externalId: u.externalId });
|
||||
const membersRaw = await ctx.rc.team.members(ctx.id());
|
||||
this.handleError(membersRaw);
|
||||
const targetIds = new Set<string>(
|
||||
|
|
|
@ -27,6 +27,14 @@ interface ITeamCreateBody {
|
|||
};
|
||||
}
|
||||
|
||||
interface ITeamUpdateBody {
|
||||
teamId: string;
|
||||
data: {
|
||||
name: string;
|
||||
type?: 0 | 1;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ITeam {
|
||||
_id: string;
|
||||
name: string;
|
||||
|
@ -85,6 +93,11 @@ interface ITeamMemberResponse {
|
|||
error?: string;
|
||||
}
|
||||
|
||||
interface ITeamUpdateResponse {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export class RcSdkTeam {
|
||||
private sdk: RcSdk;
|
||||
constructor(sdk: RcSdk) {
|
||||
|
@ -111,15 +124,17 @@ export class RcSdkTeam {
|
|||
return this.sdk.post(`teams.create`, body);
|
||||
}
|
||||
|
||||
public update(body: ITeamUpdateBody): Promise<ITeamUpdateResponse> {
|
||||
return this.sdk.post(`teams.update`, body);
|
||||
}
|
||||
|
||||
public removeMember(
|
||||
body: ITeamRemoveMemberBody,
|
||||
): Promise<ITeamMemberResponse> {
|
||||
return this.sdk.post(`teams.removeMember`, body);
|
||||
}
|
||||
|
||||
public addMembers(
|
||||
body: ITeamAddMemberBody,
|
||||
): Promise<ITeamMemberResponse> {
|
||||
public addMembers(body: ITeamAddMemberBody): Promise<ITeamMemberResponse> {
|
||||
return this.sdk.post(`teams.addMembers`, body);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue