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> {
|
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());
|
const membersRaw = await ctx.rc.team.members(ctx.id());
|
||||||
this.handleError(membersRaw);
|
this.handleError(membersRaw);
|
||||||
const targetIds = new Set<string>(
|
const targetIds = new Set<string>(
|
||||||
|
|
|
@ -27,6 +27,14 @@ interface ITeamCreateBody {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ITeamUpdateBody {
|
||||||
|
teamId: string;
|
||||||
|
data: {
|
||||||
|
name: string;
|
||||||
|
type?: 0 | 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface ITeam {
|
export interface ITeam {
|
||||||
_id: string;
|
_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -85,6 +93,11 @@ interface ITeamMemberResponse {
|
||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ITeamUpdateResponse {
|
||||||
|
success: boolean;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class RcSdkTeam {
|
export class RcSdkTeam {
|
||||||
private sdk: RcSdk;
|
private sdk: RcSdk;
|
||||||
constructor(sdk: RcSdk) {
|
constructor(sdk: RcSdk) {
|
||||||
|
@ -111,15 +124,17 @@ export class RcSdkTeam {
|
||||||
return this.sdk.post(`teams.create`, body);
|
return this.sdk.post(`teams.create`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public update(body: ITeamUpdateBody): Promise<ITeamUpdateResponse> {
|
||||||
|
return this.sdk.post(`teams.update`, body);
|
||||||
|
}
|
||||||
|
|
||||||
public removeMember(
|
public removeMember(
|
||||||
body: ITeamRemoveMemberBody,
|
body: ITeamRemoveMemberBody,
|
||||||
): Promise<ITeamMemberResponse> {
|
): Promise<ITeamMemberResponse> {
|
||||||
return this.sdk.post(`teams.removeMember`, body);
|
return this.sdk.post(`teams.removeMember`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addMembers(
|
public addMembers(body: ITeamAddMemberBody): Promise<ITeamMemberResponse> {
|
||||||
body: ITeamAddMemberBody,
|
|
||||||
): Promise<ITeamMemberResponse> {
|
|
||||||
return this.sdk.post(`teams.addMembers`, body);
|
return this.sdk.post(`teams.addMembers`, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue