Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8e45a42a6b | ||
![]() |
9a7cdf42e1 | ||
![]() |
c36b652d5b | ||
![]() |
553070fc23 | ||
![]() |
5d69f7e24f | ||
![]() |
bc0e2bada0 | ||
![]() |
80b6cc1d94 | ||
![]() |
bce3273e64 | ||
![]() |
3abf61152a | ||
![]() |
14923d4cd6 | ||
![]() |
6fdc4bf900 | ||
![]() |
d21e1f75b5 | ||
![]() |
84a0b37fcc | ||
![]() |
f135a0f09e | ||
![]() |
0f24c99456 | ||
![]() |
9eae0ab947 | ||
![]() |
3bf1f79c79 | ||
![]() |
b21074c871 |
@@ -0,0 +1,120 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action.js';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Change a scheduled event',
|
||||||
|
key: 'changeScheduledEvent',
|
||||||
|
description: 'Changes a scheduled event',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Scheduled Event',
|
||||||
|
key: 'scheduledEventId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: false,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listScheduledEvents',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Status',
|
||||||
|
key: 'status',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: false,
|
||||||
|
description:
|
||||||
|
'After the status has been changed to COMPLETED or CANCELED, it becomes immutable and cannot be modified further.',
|
||||||
|
variables: true,
|
||||||
|
options: [
|
||||||
|
{ label: 'SCHEDULED', value: 1 },
|
||||||
|
{ label: 'ACTIVE', value: 2 },
|
||||||
|
{ label: 'COMPLETED', value: 3 },
|
||||||
|
{ label: 'CANCELED', value: 4 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Type',
|
||||||
|
key: 'entityType',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
variables: true,
|
||||||
|
options: [
|
||||||
|
{ label: 'Stage channel', value: 1 },
|
||||||
|
{ label: 'Voice channel', value: 2 },
|
||||||
|
{ label: 'External', value: 3 },
|
||||||
|
],
|
||||||
|
additionalFields: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicFields',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listScheduledEventFieldsForChange',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'parameters.entityType',
|
||||||
|
value: '{parameters.entityType}',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Name',
|
||||||
|
key: 'name',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Description',
|
||||||
|
key: 'description',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Image',
|
||||||
|
key: 'image',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description:
|
||||||
|
'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const data = {
|
||||||
|
channel_id: $.step.parameters.channel_id,
|
||||||
|
name: $.step.parameters.name,
|
||||||
|
scheduled_start_time: $.step.parameters.scheduledStartTime,
|
||||||
|
scheduled_end_time: $.step.parameters.scheduledEndTime,
|
||||||
|
description: $.step.parameters.description,
|
||||||
|
entity_type: $.step.parameters.entityType,
|
||||||
|
image: $.step.parameters.image,
|
||||||
|
};
|
||||||
|
|
||||||
|
const isExternal = $.step.parameters.entityType === 3;
|
||||||
|
|
||||||
|
if (isExternal) {
|
||||||
|
data.entity_metadata = {
|
||||||
|
location: $.step.parameters.location,
|
||||||
|
};
|
||||||
|
|
||||||
|
data.channel_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await $.http?.patch(
|
||||||
|
`/guilds/${$.auth.data.guildId}/scheduled-events/${$.step.parameters.scheduledEventId}`,
|
||||||
|
data
|
||||||
|
);
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
@@ -1,4 +1,9 @@
|
|||||||
|
import changeScheduledEvent from './change-scheduled-event/index.js';
|
||||||
import sendMessageToChannel from './send-message-to-channel/index.js';
|
import sendMessageToChannel from './send-message-to-channel/index.js';
|
||||||
import createScheduledEvent from './create-scheduled-event/index.js';
|
import createScheduledEvent from './create-scheduled-event/index.js';
|
||||||
|
|
||||||
export default [sendMessageToChannel, createScheduledEvent];
|
export default [
|
||||||
|
changeScheduledEvent,
|
||||||
|
sendMessageToChannel,
|
||||||
|
createScheduledEvent,
|
||||||
|
];
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import listChannels from './list-channels/index.js';
|
import listChannels from './list-channels/index.js';
|
||||||
|
import listScheduledEvents from './list-scheduled-events/index.js';
|
||||||
import listVoiceChannels from './list-voice-channels/index.js';
|
import listVoiceChannels from './list-voice-channels/index.js';
|
||||||
|
|
||||||
export default [listChannels, listVoiceChannels];
|
export default [listChannels, listScheduledEvents, listVoiceChannels];
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List scheduled events',
|
||||||
|
key: 'listScheduledEvents',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const scheduledEvents = {
|
||||||
|
data: [],
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await $.http.get(
|
||||||
|
`/guilds/${$.auth.data.guildId}/scheduled-events`
|
||||||
|
);
|
||||||
|
|
||||||
|
scheduledEvents.data = response.data.map((scheduledEvent) => {
|
||||||
|
return {
|
||||||
|
value: scheduledEvent.id,
|
||||||
|
name: scheduledEvent.name,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return scheduledEvents;
|
||||||
|
},
|
||||||
|
};
|
@@ -1,3 +1,7 @@
|
|||||||
import listExternalScheduledEventFields from './list-external-scheduled-event-fields/index.js';
|
import listExternalScheduledEventFields from './list-external-scheduled-event-fields/index.js';
|
||||||
|
import listScheduledEventFieldsForChange from './list-scheduled-event-fields-for-change/index.js';
|
||||||
|
|
||||||
export default [listExternalScheduledEventFields];
|
export default [
|
||||||
|
listExternalScheduledEventFields,
|
||||||
|
listScheduledEventFieldsForChange,
|
||||||
|
];
|
||||||
|
@@ -0,0 +1,87 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List scheduled event fields for change',
|
||||||
|
key: 'listScheduledEventFieldsForChange',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const isExternal = $.step.parameters.entityType === 3;
|
||||||
|
|
||||||
|
if (isExternal) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: 'Location',
|
||||||
|
key: 'location',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description:
|
||||||
|
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Start-Time',
|
||||||
|
key: 'scheduledStartTime',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: 'The time the event will start [ISO8601]',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'End-Time',
|
||||||
|
key: 'scheduledEndTime',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description:
|
||||||
|
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: 'Channel',
|
||||||
|
key: 'channel_id',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description:
|
||||||
|
'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listVoiceChannels',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Location',
|
||||||
|
key: 'location',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description:
|
||||||
|
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Start-Time',
|
||||||
|
key: 'scheduledStartTime',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description: 'The time the event will start [ISO8601]',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'End-Time',
|
||||||
|
key: 'scheduledEndTime',
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
description:
|
||||||
|
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 112 KiB |
@@ -1,21 +0,0 @@
|
|||||||
import verifyCredentials from './verify-credentials.js';
|
|
||||||
import isStillVerified from './is-still-verified.js';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
key: 'apiKey',
|
|
||||||
label: 'API Key',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
readOnly: false,
|
|
||||||
value: null,
|
|
||||||
placeholder: null,
|
|
||||||
description: 'PDFMonkey API secret key of your account.',
|
|
||||||
clickToCopy: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
verifyCredentials,
|
|
||||||
isStillVerified,
|
|
||||||
};
|
|
@@ -1,8 +0,0 @@
|
|||||||
import getCurrentUser from '../common/get-current-user.js';
|
|
||||||
|
|
||||||
const isStillVerified = async ($) => {
|
|
||||||
const currentUser = await getCurrentUser($);
|
|
||||||
return !!currentUser.id;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default isStillVerified;
|
|
@@ -1,15 +0,0 @@
|
|||||||
import getCurrentUser from '../common/get-current-user.js';
|
|
||||||
|
|
||||||
const verifyCredentials = async ($) => {
|
|
||||||
const currentUser = await getCurrentUser($);
|
|
||||||
const screenName = [currentUser.desired_name, currentUser.email]
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(' @ ');
|
|
||||||
|
|
||||||
await $.auth.set({
|
|
||||||
screenName,
|
|
||||||
apiKey: $.auth.data.apiKey,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export default verifyCredentials;
|
|
@@ -1,9 +0,0 @@
|
|||||||
const addAuthHeader = ($, requestConfig) => {
|
|
||||||
if ($.auth.data?.apiKey) {
|
|
||||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return requestConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default addAuthHeader;
|
|
@@ -1,8 +0,0 @@
|
|||||||
const getCurrentUser = async ($) => {
|
|
||||||
const response = await $.http.get('/v1/current_user');
|
|
||||||
const currentUser = response.data.current_user;
|
|
||||||
|
|
||||||
return currentUser;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getCurrentUser;
|
|
@@ -1,16 +0,0 @@
|
|||||||
import defineApp from '../../helpers/define-app.js';
|
|
||||||
import addAuthHeader from './common/add-auth-header.js';
|
|
||||||
import auth from './auth/index.js';
|
|
||||||
|
|
||||||
export default defineApp({
|
|
||||||
name: 'PDFMonkey',
|
|
||||||
key: 'pdf-monkey',
|
|
||||||
iconUrl: '{BASE_URL}/apps/pdf-monkey/assets/favicon.svg',
|
|
||||||
authDocUrl: 'https://automatisch.io/docs/apps/pdf-monkey/connection',
|
|
||||||
supportsConnections: true,
|
|
||||||
baseUrl: 'https://pdfmonkey.io',
|
|
||||||
apiBaseUrl: 'https://api.pdfmonkey.io/api',
|
|
||||||
primaryColor: 'db2777',
|
|
||||||
beforeRequest: [addAuthHeader],
|
|
||||||
auth,
|
|
||||||
});
|
|
@@ -0,0 +1,6 @@
|
|||||||
|
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||||
|
import permissionCatalog from '../../../../../helpers/permission-catalog.ee.js';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
renderObject(response, permissionCatalog);
|
||||||
|
};
|
@@ -0,0 +1,32 @@
|
|||||||
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../../app.js';
|
||||||
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
|
import getPermissionsCatalogMock from '../../../../../../test/mocks/rest/api/v1/admin/permissions/get-permissions-catalog.ee.js';
|
||||||
|
import * as license from '../../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/admin/permissions/catalog', () => {
|
||||||
|
let role, currentUser, token;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
role = await createRole({ key: 'admin' });
|
||||||
|
currentUser = await createUser({ roleId: role.id });
|
||||||
|
|
||||||
|
token = createAuthTokenByUserId(currentUser.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return roles', async () => {
|
||||||
|
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||||
|
|
||||||
|
const response = await request(app)
|
||||||
|
.get('/api/v1/admin/permissions/catalog')
|
||||||
|
.set('Authorization', token)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedPayload = await getPermissionsCatalogMock();
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedPayload);
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||||
|
import Role from '../../../../../models/role.js';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
const role = await Role.query()
|
||||||
|
.leftJoinRelated({
|
||||||
|
permissions: true,
|
||||||
|
})
|
||||||
|
.withGraphFetched({
|
||||||
|
permissions: true,
|
||||||
|
})
|
||||||
|
.findById(request.params.roleId)
|
||||||
|
.throwIfNotFound();
|
||||||
|
|
||||||
|
renderObject(response, role);
|
||||||
|
};
|
@@ -0,0 +1,38 @@
|
|||||||
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../../app.js';
|
||||||
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
|
import { createPermission } from '../../../../../../test/factories/permission.js';
|
||||||
|
import getRoleMock from '../../../../../../test/mocks/rest/api/v1/admin/roles/get-role.ee.js';
|
||||||
|
import * as license from '../../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/admin/roles/:roleId', () => {
|
||||||
|
let role, currentUser, token, permissionOne, permissionTwo;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
role = await createRole({ key: 'admin' });
|
||||||
|
permissionOne = await createPermission({ roleId: role.id });
|
||||||
|
permissionTwo = await createPermission({ roleId: role.id });
|
||||||
|
currentUser = await createUser({ roleId: role.id });
|
||||||
|
|
||||||
|
token = createAuthTokenByUserId(currentUser.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return roles', async () => {
|
||||||
|
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||||
|
|
||||||
|
const response = await request(app)
|
||||||
|
.get(`/api/v1/admin/roles/${role.id}`)
|
||||||
|
.set('Authorization', token)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedPayload = await getRoleMock(role, [
|
||||||
|
permissionOne,
|
||||||
|
permissionTwo,
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedPayload);
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { renderObject } from '../../../../../helpers/renderer.js';
|
||||||
|
import Role from '../../../../../models/role.js';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
const roles = await Role.query().orderBy('name');
|
||||||
|
|
||||||
|
renderObject(response, roles);
|
||||||
|
};
|
@@ -0,0 +1,33 @@
|
|||||||
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../../app.js';
|
||||||
|
import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
|
import getRolesMock from '../../../../../../test/mocks/rest/api/v1/admin/roles/get-roles.ee.js';
|
||||||
|
import * as license from '../../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/admin/roles', () => {
|
||||||
|
let roleOne, roleTwo, currentUser, token;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
roleOne = await createRole({ key: 'admin' });
|
||||||
|
roleTwo = await createRole({ key: 'user' });
|
||||||
|
currentUser = await createUser({ roleId: roleOne.id });
|
||||||
|
|
||||||
|
token = createAuthTokenByUserId(currentUser.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return roles', async () => {
|
||||||
|
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||||
|
|
||||||
|
const response = await request(app)
|
||||||
|
.get('/api/v1/admin/roles')
|
||||||
|
.set('Authorization', token)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedPayload = await getRolesMock([roleOne, roleTwo]);
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedPayload);
|
||||||
|
});
|
||||||
|
});
|
@@ -5,7 +5,7 @@ import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by
|
|||||||
import { createRole } from '../../../../../../test/factories/role.js';
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
import { createUser } from '../../../../../../test/factories/user.js';
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
import { createSamlAuthProvider } from '../../../../../../test/factories/saml-auth-provider.ee.js';
|
import { createSamlAuthProvider } from '../../../../../../test/factories/saml-auth-provider.ee.js';
|
||||||
import getSamlAuthProviderMock from '../../../../../../test/mocks/rest/api/v1/saml-auth-providers/get-saml-auth-provider.ee.js';
|
import getSamlAuthProviderMock from '../../../../../../test/mocks/rest/api/v1/admin/saml-auth-providers/get-saml-auth-provider.ee.js';
|
||||||
import * as license from '../../../../../helpers/license.ee.js';
|
import * as license from '../../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
describe('GET /api/v1/admin/saml-auth-provider/:samlAuthProviderId', () => {
|
describe('GET /api/v1/admin/saml-auth-provider/:samlAuthProviderId', () => {
|
||||||
|
@@ -5,7 +5,7 @@ import createAuthTokenByUserId from '../../../../../helpers/create-auth-token-by
|
|||||||
import { createRole } from '../../../../../../test/factories/role.js';
|
import { createRole } from '../../../../../../test/factories/role.js';
|
||||||
import { createUser } from '../../../../../../test/factories/user.js';
|
import { createUser } from '../../../../../../test/factories/user.js';
|
||||||
import { createSamlAuthProvider } from '../../../../../../test/factories/saml-auth-provider.ee.js';
|
import { createSamlAuthProvider } from '../../../../../../test/factories/saml-auth-provider.ee.js';
|
||||||
import getSamlAuthProvidersMock from '../../../../../../test/mocks/rest/api/v1/saml-auth-providers/get-saml-auth-providers.ee.js';
|
import getSamlAuthProvidersMock from '../../../../../../test/mocks/rest/api/v1/admin/saml-auth-providers/get-saml-auth-providers.ee.js';
|
||||||
import * as license from '../../../../../helpers/license.ee.js';
|
import * as license from '../../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
describe('GET /api/v1/admin/saml-auth-providers', () => {
|
describe('GET /api/v1/admin/saml-auth-providers', () => {
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
import { renderObject } from '../../../../helpers/renderer.js';
|
||||||
|
import axios from '../../../../helpers/axios-with-proxy.js';
|
||||||
|
import logger from '../../../../helpers/logger.js';
|
||||||
|
|
||||||
|
const NOTIFICATIONS_URL =
|
||||||
|
'https://notifications.automatisch.io/notifications.json';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
let notifications = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.get(NOTIFICATIONS_URL);
|
||||||
|
notifications = response.data;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Error fetching notifications API endpoint!', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderObject(response, notifications);
|
||||||
|
};
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { describe, it } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../app.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/automatisch/notifications', () => {
|
||||||
|
it('should return Automatisch notifications', async () => {
|
||||||
|
await request(app).get('/api/v1/automatisch/notifications').expect(200);
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { renderObject } from '../../../../helpers/renderer.js';
|
||||||
|
import Billing from '../../../../helpers/billing/index.ee.js';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
const paddleInfo = Billing.paddleInfo;
|
||||||
|
|
||||||
|
renderObject(response, paddleInfo);
|
||||||
|
};
|
@@ -0,0 +1,33 @@
|
|||||||
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../app.js';
|
||||||
|
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
import { createUser } from '../../../../../test/factories/user.js';
|
||||||
|
import getPaddleInfoMock from '../../../../../test/mocks/rest/api/v1/payment/get-paddle-info.js';
|
||||||
|
import appConfig from '../../../../config/app.js';
|
||||||
|
import billing from '../../../../helpers/billing/index.ee.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/payment/paddle-info', () => {
|
||||||
|
let user, token;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
user = await createUser();
|
||||||
|
token = createAuthTokenByUserId(user.id);
|
||||||
|
|
||||||
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||||
|
vi.spyOn(billing.paddleInfo, 'vendorId', 'get').mockReturnValue(
|
||||||
|
'sampleVendorId'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return payment plans', async () => {
|
||||||
|
const response = await request(app)
|
||||||
|
.get('/api/v1/payment/paddle-info')
|
||||||
|
.set('Authorization', token)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedResponsePayload = await getPaddleInfoMock();
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedResponsePayload);
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { renderObject } from '../../../../helpers/renderer.js';
|
||||||
|
import Billing from '../../../../helpers/billing/index.ee.js';
|
||||||
|
|
||||||
|
export default async (request, response) => {
|
||||||
|
const paymentPlans = Billing.paddlePlans;
|
||||||
|
|
||||||
|
renderObject(response, paymentPlans);
|
||||||
|
};
|
@@ -0,0 +1,29 @@
|
|||||||
|
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||||
|
import request from 'supertest';
|
||||||
|
import app from '../../../../app.js';
|
||||||
|
import createAuthTokenByUserId from '../../../../helpers/create-auth-token-by-user-id.js';
|
||||||
|
import { createUser } from '../../../../../test/factories/user.js';
|
||||||
|
import getPaymentPlansMock from '../../../../../test/mocks/rest/api/v1/payment/get-plans.js';
|
||||||
|
import appConfig from '../../../../config/app.js';
|
||||||
|
|
||||||
|
describe('GET /api/v1/payment/plans', () => {
|
||||||
|
let user, token;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
user = await createUser();
|
||||||
|
token = createAuthTokenByUserId(user.id);
|
||||||
|
|
||||||
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return payment plans', async () => {
|
||||||
|
const response = await request(app)
|
||||||
|
.get('/api/v1/payment/plans')
|
||||||
|
.set('Authorization', token)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedResponsePayload = await getPaymentPlansMock();
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedResponsePayload);
|
||||||
|
});
|
||||||
|
});
|
17
packages/backend/src/routes/api/v1/admin/permissions.ee.js
Normal file
17
packages/backend/src/routes/api/v1/admin/permissions.ee.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { authenticateUser } from '../../../../helpers/authentication.js';
|
||||||
|
import { authorizeAdmin } from '../../../../helpers/authorization.js';
|
||||||
|
import { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
|
||||||
|
import getPermissionsCatalogAction from '../../../../controllers/api/v1/admin/permissions/get-permissions-catalog.ee.js';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/catalog',
|
||||||
|
authenticateUser,
|
||||||
|
authorizeAdmin,
|
||||||
|
checkIsEnterprise,
|
||||||
|
getPermissionsCatalogAction
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
26
packages/backend/src/routes/api/v1/admin/roles.ee.js
Normal file
26
packages/backend/src/routes/api/v1/admin/roles.ee.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { authenticateUser } from '../../../../helpers/authentication.js';
|
||||||
|
import { authorizeAdmin } from '../../../../helpers/authorization.js';
|
||||||
|
import { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
|
||||||
|
import getRolesAction from '../../../../controllers/api/v1/admin/roles/get-roles.ee.js';
|
||||||
|
import getRoleAction from '../../../../controllers/api/v1/admin/roles/get-role.ee.js';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/',
|
||||||
|
authenticateUser,
|
||||||
|
authorizeAdmin,
|
||||||
|
checkIsEnterprise,
|
||||||
|
getRolesAction
|
||||||
|
);
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/:roleId',
|
||||||
|
authenticateUser,
|
||||||
|
authorizeAdmin,
|
||||||
|
checkIsEnterprise,
|
||||||
|
getRoleAction
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
@@ -0,0 +1,26 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { authenticateUser } from '../../../../helpers/authentication.js';
|
||||||
|
import { authorizeAdmin } from '../../../../helpers/authorization.js';
|
||||||
|
import { checkIsEnterprise } from '../../../../helpers/check-is-enterprise.js';
|
||||||
|
import getSamlAuthProvidersAction from '../../../../controllers/api/v1/admin/saml-auth-providers/get-saml-auth-providers.ee.js';
|
||||||
|
import getSamlAuthProviderAction from '../../../../controllers/api/v1/admin/saml-auth-providers/get-saml-auth-provider.ee.js';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/',
|
||||||
|
authenticateUser,
|
||||||
|
authorizeAdmin,
|
||||||
|
checkIsEnterprise,
|
||||||
|
getSamlAuthProvidersAction
|
||||||
|
);
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/:samlAuthProviderId',
|
||||||
|
authenticateUser,
|
||||||
|
authorizeAdmin,
|
||||||
|
checkIsEnterprise,
|
||||||
|
getSamlAuthProviderAction
|
||||||
|
);
|
||||||
|
|
||||||
|
export default router;
|
@@ -1,8 +1,10 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import versionAction from '../../../controllers/api/v1/automatisch/version.js';
|
import versionAction from '../../../controllers/api/v1/automatisch/version.js';
|
||||||
|
import notificationsAction from '../../../controllers/api/v1/automatisch/notifications.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get('/version', versionAction);
|
router.get('/version', versionAction);
|
||||||
|
router.get('/notifications', notificationsAction);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
12
packages/backend/src/routes/api/v1/payment.ee.js
Normal file
12
packages/backend/src/routes/api/v1/payment.ee.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { authenticateUser } from '../../../helpers/authentication.js';
|
||||||
|
import checkIsCloud from '../../../helpers/check-is-cloud.js';
|
||||||
|
import getPlansAction from '../../../controllers/api/v1/payment/get-plans.ee.js';
|
||||||
|
import getPaddleInfoAction from '../../../controllers/api/v1/payment/get-paddle-info.ee.js';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.get('/plans', authenticateUser, checkIsCloud, getPlansAction);
|
||||||
|
router.get('/paddle-info', authenticateUser, checkIsCloud, getPaddleInfoAction);
|
||||||
|
|
||||||
|
export default router;
|
@@ -1,26 +0,0 @@
|
|||||||
import { Router } from 'express';
|
|
||||||
import { authenticateUser } from '../../../helpers/authentication.js';
|
|
||||||
import { authorizeAdmin } from '../../../helpers/authorization.js';
|
|
||||||
import { checkIsEnterprise } from '../../../helpers/check-is-enterprise.js';
|
|
||||||
import getSamlAuthProvidersAction from '../../../controllers/api/v1/admin/saml-auth-providers/get-saml-auth-providers.ee.js';
|
|
||||||
import getSamlAuthProviderAction from '../../../controllers/api/v1/admin/saml-auth-providers/get-saml-auth-provider.ee.js';
|
|
||||||
|
|
||||||
const router = Router();
|
|
||||||
|
|
||||||
router.get(
|
|
||||||
'/',
|
|
||||||
authenticateUser,
|
|
||||||
authorizeAdmin,
|
|
||||||
checkIsEnterprise,
|
|
||||||
getSamlAuthProvidersAction
|
|
||||||
);
|
|
||||||
|
|
||||||
router.get(
|
|
||||||
'/:samlAuthProviderId',
|
|
||||||
authenticateUser,
|
|
||||||
authorizeAdmin,
|
|
||||||
checkIsEnterprise,
|
|
||||||
getSamlAuthProviderAction
|
|
||||||
);
|
|
||||||
|
|
||||||
export default router;
|
|
@@ -5,7 +5,10 @@ import paddleRouter from './paddle.ee.js';
|
|||||||
import healthcheckRouter from './healthcheck.js';
|
import healthcheckRouter from './healthcheck.js';
|
||||||
import automatischRouter from './api/v1/automatisch.js';
|
import automatischRouter from './api/v1/automatisch.js';
|
||||||
import usersRouter from './api/v1/users.js';
|
import usersRouter from './api/v1/users.js';
|
||||||
import samlAuthProvidersRouter from './api/v1/saml-auth-providers.ee.js';
|
import paymentRouter from './api/v1/payment.ee.js';
|
||||||
|
import samlAuthProvidersRouter from './api/v1/admin/saml-auth-providers.ee.js';
|
||||||
|
import rolesRouter from './api/v1/admin/roles.ee.js';
|
||||||
|
import permissionsRouter from './api/v1/admin/permissions.ee.js';
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
@@ -15,6 +18,9 @@ router.use('/paddle', paddleRouter);
|
|||||||
router.use('/healthcheck', healthcheckRouter);
|
router.use('/healthcheck', healthcheckRouter);
|
||||||
router.use('/api/v1/automatisch', automatischRouter);
|
router.use('/api/v1/automatisch', automatischRouter);
|
||||||
router.use('/api/v1/users', usersRouter);
|
router.use('/api/v1/users', usersRouter);
|
||||||
|
router.use('/api/v1/payment', paymentRouter);
|
||||||
router.use('/api/v1/admin/saml-auth-providers', samlAuthProvidersRouter);
|
router.use('/api/v1/admin/saml-auth-providers', samlAuthProvidersRouter);
|
||||||
|
router.use('/api/v1/admin/roles', rolesRouter);
|
||||||
|
router.use('/api/v1/admin/permissions', permissionsRouter);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
|
import permissionSerializer from './permission.js';
|
||||||
|
|
||||||
const roleSerializer = (role) => {
|
const roleSerializer = (role) => {
|
||||||
return {
|
let roleData = {
|
||||||
id: role.id,
|
id: role.id,
|
||||||
name: role.name,
|
name: role.name,
|
||||||
key: role.key,
|
key: role.key,
|
||||||
@@ -8,6 +10,14 @@ const roleSerializer = (role) => {
|
|||||||
updatedAt: role.updatedAt,
|
updatedAt: role.updatedAt,
|
||||||
isAdmin: role.isAdmin,
|
isAdmin: role.isAdmin,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (role.permissions) {
|
||||||
|
roleData.permissions = role.permissions.map((permission) =>
|
||||||
|
permissionSerializer(permission)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return roleData;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default roleSerializer;
|
export default roleSerializer;
|
||||||
|
@@ -1,12 +1,25 @@
|
|||||||
import { describe, it, expect, beforeEach } from 'vitest';
|
import { describe, it, expect, beforeEach } from 'vitest';
|
||||||
import { createRole } from '../../test/factories/role';
|
import { createRole } from '../../test/factories/role';
|
||||||
import roleSerializer from './role';
|
import roleSerializer from './role';
|
||||||
|
import { createPermission } from '../../test/factories/permission';
|
||||||
|
|
||||||
describe('roleSerializer', () => {
|
describe('roleSerializer', () => {
|
||||||
let role;
|
let role, permissionOne, permissionTwo;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
role = await createRole();
|
role = await createRole();
|
||||||
|
|
||||||
|
permissionOne = await createPermission({
|
||||||
|
roleId: role.id,
|
||||||
|
action: 'read',
|
||||||
|
subject: 'User',
|
||||||
|
});
|
||||||
|
|
||||||
|
permissionTwo = await createPermission({
|
||||||
|
roleId: role.id,
|
||||||
|
action: 'read',
|
||||||
|
subject: 'Role',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return role data', async () => {
|
it('should return role data', async () => {
|
||||||
@@ -22,4 +35,14 @@ describe('roleSerializer', () => {
|
|||||||
|
|
||||||
expect(roleSerializer(role)).toEqual(expectedPayload);
|
expect(roleSerializer(role)).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return role data with the permissions', async () => {
|
||||||
|
role.permissions = [permissionOne, permissionTwo];
|
||||||
|
|
||||||
|
const expectedPayload = {
|
||||||
|
permissions: [permissionOne, permissionTwo],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(roleSerializer(role)).toMatchObject(expectedPayload);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -9,7 +9,6 @@ const userSerializer = (user) => {
|
|||||||
createdAt: user.createdAt,
|
createdAt: user.createdAt,
|
||||||
updatedAt: user.updatedAt,
|
updatedAt: user.updatedAt,
|
||||||
fullName: user.fullName,
|
fullName: user.fullName,
|
||||||
roleId: user.roleId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (user.role) {
|
if (user.role) {
|
||||||
|
@@ -33,7 +33,6 @@ describe('userSerializer', () => {
|
|||||||
email: user.email,
|
email: user.email,
|
||||||
fullName: user.fullName,
|
fullName: user.fullName,
|
||||||
id: user.id,
|
id: user.id,
|
||||||
roleId: user.roleId,
|
|
||||||
updatedAt: user.updatedAt,
|
updatedAt: user.updatedAt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -0,0 +1,64 @@
|
|||||||
|
const getPermissionsCatalogMock = async () => {
|
||||||
|
const data = {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
key: 'create',
|
||||||
|
label: 'Create',
|
||||||
|
subjects: ['Connection', 'Flow'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'read',
|
||||||
|
label: 'Read',
|
||||||
|
subjects: ['Connection', 'Execution', 'Flow'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'update',
|
||||||
|
label: 'Update',
|
||||||
|
subjects: ['Connection', 'Flow'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
label: 'Delete',
|
||||||
|
subjects: ['Connection', 'Flow'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'publish',
|
||||||
|
label: 'Publish',
|
||||||
|
subjects: ['Flow'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
conditions: [
|
||||||
|
{
|
||||||
|
key: 'isCreator',
|
||||||
|
label: 'Is creator',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
subjects: [
|
||||||
|
{
|
||||||
|
key: 'Connection',
|
||||||
|
label: 'Connection',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Flow',
|
||||||
|
label: 'Flow',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Execution',
|
||||||
|
label: 'Execution',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: data,
|
||||||
|
meta: {
|
||||||
|
count: 1,
|
||||||
|
currentPage: null,
|
||||||
|
isArray: false,
|
||||||
|
totalPages: null,
|
||||||
|
type: 'Object',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getPermissionsCatalogMock;
|
@@ -0,0 +1,33 @@
|
|||||||
|
const getRoleMock = async (role, permissions) => {
|
||||||
|
const data = {
|
||||||
|
id: role.id,
|
||||||
|
key: role.key,
|
||||||
|
name: role.name,
|
||||||
|
isAdmin: role.isAdmin,
|
||||||
|
description: role.description,
|
||||||
|
createdAt: role.createdAt.toISOString(),
|
||||||
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
|
permissions: permissions.map((permission) => ({
|
||||||
|
id: permission.id,
|
||||||
|
action: permission.action,
|
||||||
|
conditions: permission.conditions,
|
||||||
|
roleId: permission.roleId,
|
||||||
|
subject: permission.subject,
|
||||||
|
createdAt: permission.createdAt.toISOString(),
|
||||||
|
updatedAt: permission.updatedAt.toISOString(),
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: data,
|
||||||
|
meta: {
|
||||||
|
count: 1,
|
||||||
|
currentPage: null,
|
||||||
|
isArray: false,
|
||||||
|
totalPages: null,
|
||||||
|
type: 'Role',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getRoleMock;
|
@@ -0,0 +1,26 @@
|
|||||||
|
const getRolesMock = async (roles) => {
|
||||||
|
const data = roles.map((role) => {
|
||||||
|
return {
|
||||||
|
id: role.id,
|
||||||
|
key: role.key,
|
||||||
|
name: role.name,
|
||||||
|
isAdmin: role.isAdmin,
|
||||||
|
description: role.description,
|
||||||
|
createdAt: role.createdAt.toISOString(),
|
||||||
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: data,
|
||||||
|
meta: {
|
||||||
|
count: data.length,
|
||||||
|
currentPage: null,
|
||||||
|
isArray: true,
|
||||||
|
totalPages: null,
|
||||||
|
type: 'Role',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getRolesMock;
|
@@ -1,4 +1,4 @@
|
|||||||
const getSamlAuthProvidersMock = async (samlAuthProvider) => {
|
const getSamlAuthProviderMock = async (samlAuthProvider) => {
|
||||||
const data = {
|
const data = {
|
||||||
active: samlAuthProvider.active,
|
active: samlAuthProvider.active,
|
||||||
certificate: samlAuthProvider.certificate,
|
certificate: samlAuthProvider.certificate,
|
||||||
@@ -26,4 +26,4 @@ const getSamlAuthProvidersMock = async (samlAuthProvider) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getSamlAuthProvidersMock;
|
export default getSamlAuthProviderMock;
|
@@ -0,0 +1,17 @@
|
|||||||
|
const getPaddleInfoMock = async () => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
sandbox: true,
|
||||||
|
vendorId: 'sampleVendorId',
|
||||||
|
},
|
||||||
|
meta: {
|
||||||
|
count: 1,
|
||||||
|
currentPage: null,
|
||||||
|
isArray: false,
|
||||||
|
totalPages: null,
|
||||||
|
type: 'Object',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getPaddleInfoMock;
|
22
packages/backend/test/mocks/rest/api/v1/payment/get-plans.js
Normal file
22
packages/backend/test/mocks/rest/api/v1/payment/get-plans.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const getPaymentPlansMock = async () => {
|
||||||
|
return {
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
limit: '10,000',
|
||||||
|
name: '10k - monthly',
|
||||||
|
price: '€20',
|
||||||
|
productId: '47384',
|
||||||
|
quota: 10000,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
meta: {
|
||||||
|
count: 1,
|
||||||
|
currentPage: null,
|
||||||
|
isArray: true,
|
||||||
|
totalPages: null,
|
||||||
|
type: 'Object',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getPaymentPlansMock;
|
@@ -15,7 +15,6 @@ const getCurrentUserMock = (currentUser, role) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.toISOString(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
roleId: role.id,
|
|
||||||
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
||||||
updatedAt: currentUser.updatedAt.toISOString(),
|
updatedAt: currentUser.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
|
@@ -14,7 +14,6 @@ const getUserMock = (currentUser, role) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.toISOString(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
roleId: role.id,
|
|
||||||
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
trialExpiryDate: currentUser.trialExpiryDate.toISOString(),
|
||||||
updatedAt: currentUser.updatedAt.toISOString(),
|
updatedAt: currentUser.updatedAt.toISOString(),
|
||||||
},
|
},
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
const getUsersMock = async (users, roles) => {
|
const getUsersMock = async (users, roles) => {
|
||||||
const data = users.map((user) => {
|
const data = users.map((user) => {
|
||||||
const role = roles.find((r) => r.id === user.roleId);
|
const role = roles.find((r) => r.id === user.roleId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
createdAt: user.createdAt.toISOString(),
|
createdAt: user.createdAt.toISOString(),
|
||||||
email: user.email,
|
email: user.email,
|
||||||
@@ -16,8 +17,7 @@ const getUsersMock = async (users, roles) => {
|
|||||||
name: role.name,
|
name: role.name,
|
||||||
updatedAt: role.updatedAt.toISOString(),
|
updatedAt: role.updatedAt.toISOString(),
|
||||||
}
|
}
|
||||||
: null, // Fallback to null if role not found
|
: null,
|
||||||
roleId: user.roleId,
|
|
||||||
trialExpiryDate: user.trialExpiryDate.toISOString(),
|
trialExpiryDate: user.trialExpiryDate.toISOString(),
|
||||||
updatedAt: user.updatedAt.toISOString(),
|
updatedAt: user.updatedAt.toISOString(),
|
||||||
};
|
};
|
||||||
|
@@ -252,12 +252,6 @@ export default defineConfig({
|
|||||||
{ text: 'Connection', link: '/apps/openai/connection' },
|
{ text: 'Connection', link: '/apps/openai/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: 'PDFMonkey',
|
|
||||||
collapsible: true,
|
|
||||||
collapsed: true,
|
|
||||||
items: [{ text: 'Connection', link: '/apps/pdf-monkey/connection' }],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: 'Pipedrive',
|
text: 'Pipedrive',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
@@ -311,7 +305,7 @@ export default defineConfig({
|
|||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Actions', link: '/apps/removebg/actions' },
|
{ text: 'Actions', link: '/apps/removebg/actions' },
|
||||||
{ text: 'Connection', link: '/apps/removebg/connection' },
|
{ text: 'Connection', link: '/apps/removebg/connection' }
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
favicon: /favicons/discord.svg
|
favicon: /favicons/discord.svg
|
||||||
items:
|
items:
|
||||||
|
- name: Change a scheduled event
|
||||||
|
desc: Changes a scheduled event.
|
||||||
- name: Send a message to channel
|
- name: Send a message to channel
|
||||||
desc: Sends a message to a specific channel you specify.
|
desc: Sends a message to a specific channel you specify.
|
||||||
- name: Create a scheduled event
|
- name: Create a scheduled event
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
# PDFMonkey
|
|
||||||
|
|
||||||
:::info
|
|
||||||
This page explains the steps you need to follow to set up the PDFMonkey
|
|
||||||
connection in Automatisch. If any of the steps are outdated, please let us know!
|
|
||||||
:::
|
|
||||||
|
|
||||||
1. Login to your PDFMonkey account: [https://dashboard.pdfmonkey.io/login](https://dashboard.pdfmonkey.io/login).
|
|
||||||
2. Go to **My Account** section from your profile.
|
|
||||||
3. Copy `API SECRET KEY` from the page to the `API Key` field on Automatisch.
|
|
||||||
4. Now, you can start using the PDFMonkey connection with Automatisch.
|
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 112 KiB |
Reference in New Issue
Block a user