Browse Source

feat: Enable validation and invite function for multiple emails

Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: frankmagoba <franklinmagoba4@gmail.com>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
pull/6275/head
gitstart 1 year ago
parent
commit
38ec73102b
  1. 12
      packages/nocodb/src/services/project-users/project-users.service.ts

12
packages/nocodb/src/services/project-users/project-users.service.ts

@ -42,16 +42,18 @@ export class ProjectUsersService {
projectUser: ProjectUserReqType; projectUser: ProjectUserReqType;
req: any; req: any;
}): Promise<any> { }): Promise<any> {
validatePayload(
'swagger.json#/components/schemas/ProjectUserReq',
param.projectUser,
);
const emails = (param.projectUser.email || '') const emails = (param.projectUser.email || '')
.toLowerCase() .toLowerCase()
.split(/\s*,\s*/) .split(/\s*,\s*/)
.map((v) => v.trim()); .map((v) => v.trim());
emails.forEach((email) => {
validatePayload('swagger.json#/components/schemas/ProjectUserReq', {
...param.projectUser,
email,
});
});
// check for invalid emails // check for invalid emails
const invalidEmails = emails.filter((v) => !validator.isEmail(v)); const invalidEmails = emails.filter((v) => !validator.isEmail(v));
if (!emails.length) { if (!emails.length) {

Loading…
Cancel
Save