Skip to content

Commit

Permalink
dev: removes invitation script (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Escontrela committed Oct 26, 2021
1 parent aa03172 commit 8d48ea1
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 832 deletions.
24 changes: 0 additions & 24 deletions apps/asap-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import yargs from 'yargs/yargs';
import * as importers from './import';
import inviteUsersFactory from './invite';

// eslint-disable-next-line no-unused-expressions
yargs(process.argv.slice(2))
Expand All @@ -28,29 +27,6 @@ yargs(process.argv.slice(2))
handler: async ({ path, entity }) =>
importers[entity as 'users' | 'protocols'](path as string),
})
.command({
command: 'invite [Options]',
describe: 'invite people to the ASAP Hub',
builder: (cli) =>
cli
.positional('role', {
describe: 'specify a role to invite (optional)',
type: 'string',
default: undefined,
choices: ['Staff', 'Grantee', 'Guest'],
})
.option('reinvite', {
alias: 'r',
type: 'boolean',
description:
"flag to reinvite users that didn't complete the registration process",
}),

handler: async ({ role, reinvite }) => {
const inviteUsers = inviteUsersFactory();
inviteUsers(role as string | undefined, Boolean(reinvite));
},
})
.demandCommand(1)
.help('h')
.alias('h', 'help')
Expand Down
198 changes: 0 additions & 198 deletions apps/asap-cli/src/invite/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions apps/asap-cli/src/invite/send-mail.ts

This file was deleted.

86 changes: 85 additions & 1 deletion apps/asap-cli/test/import/users.fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RestTeam } from '@asap-hub/squidex';
import { RestTeam, RestUser } from '@asap-hub/squidex';

export const fetchTeamsResponse: { total: number; items: RestTeam[] } = {
total: 1,
Expand All @@ -17,3 +17,87 @@ export const fetchTeamsResponse: { total: number; items: RestTeam[] } = {
},
],
};

export const fetchUsersResponse: { total: number; items: RestUser[] } = {
total: 200,
items: [
{
id: 'userId1',
lastModified: '2020-09-25T11:06:27.164Z',
created: '2020-09-24T11:06:27.164Z',
data: {
avatar: { iv: [] },
lastModifiedDate: { iv: '2020-09-25T11:06:27.164Z' },
email: { iv: '[email protected]' },
firstName: { iv: 'First' },
lastName: { iv: 'Last' },
jobTitle: { iv: 'Title' },
institution: { iv: 'Institution' },
connections: { iv: [] },
biography: { iv: 'Biography' },
teams: { iv: [] },
questions: { iv: [] },
skills: { iv: [] },
role: { iv: 'Grantee' },
onboarded: {
iv: true,
},
labs: { iv: [] },
},
},
{
id: 'userId2',
lastModified: '2020-09-25T11:06:27.164Z',
created: '2020-09-24T11:06:27.164Z',
data: {
avatar: { iv: [] },
lastModifiedDate: { iv: '2020-09-25T11:06:27.164Z' },
email: { iv: '[email protected]' },
firstName: { iv: 'First' },
lastName: { iv: 'Last' },
jobTitle: { iv: 'Title' },
institution: { iv: 'Institution' },
connections: { iv: [] },
biography: { iv: 'Biography' },
questions: { iv: [{ question: 'Question?' }] },
teams: { iv: [] },
skills: { iv: [] },
role: { iv: 'Grantee' },
onboarded: {
iv: true,
},
labs: { iv: [] },
},
},
{
id: 'userId3',
lastModified: '2020-09-25T11:06:27.164Z',
created: '2020-09-24T11:06:27.164Z',
data: {
avatar: { iv: [] },
lastModifiedDate: { iv: '2020-09-25T11:06:27.164Z' },
email: { iv: '[email protected]' },
firstName: { iv: 'First' },
lastName: { iv: 'Last' },
jobTitle: { iv: 'Title' },
institution: { iv: 'Institution' },
connections: {
iv: [
{
code: 'ALREADY_HAS_CODE',
},
],
},
biography: { iv: 'Biography' },
questions: { iv: [{ question: 'Question?' }] },
teams: { iv: [] },
skills: { iv: [] },
role: { iv: 'Grantee' },
onboarded: {
iv: true,
},
labs: { iv: [] },
},
},
],
};
3 changes: 1 addition & 2 deletions apps/asap-cli/test/import/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { join } from 'path';
import { config } from '@asap-hub/squidex';
import { identity } from '../helpers/squidex';
import { users as importUsers } from '../../src/import';
import { fetchUsersResponse } from '../invite.fixtures';
import { fetchTeamsResponse } from './users.fixtures';
import { fetchTeamsResponse, fetchUsersResponse } from './users.fixtures';

const body = {
email: {
Expand Down
Loading

0 comments on commit 8d48ea1

Please sign in to comment.