chore: Use ES modules for backend app
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import AppConfig from '../../models/app-config';
|
||||
import AppConfig from '../../models/app-config.js';
|
||||
|
||||
const createAppAuthClient = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'App');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import AppConfig from '../../models/app-config';
|
||||
import App from '../../models/app.js';
|
||||
import AppConfig from '../../models/app-config.js';
|
||||
|
||||
const createAppConfig = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'App');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import AppConfig from '../../models/app-config';
|
||||
import App from '../../models/app.js';
|
||||
import AppConfig from '../../models/app-config.js';
|
||||
|
||||
const createConnection = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Connection');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import Step from '../../models/step';
|
||||
import App from '../../models/app.js';
|
||||
import Step from '../../models/step.js';
|
||||
|
||||
const createFlow = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Flow');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import kebabCase from 'lodash/kebabCase';
|
||||
import Role from '../../models/role';
|
||||
import kebabCase from 'lodash/kebabCase.js';
|
||||
import Role from '../../models/role.js';
|
||||
|
||||
const createRole = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Role');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import Flow from '../../models/flow';
|
||||
import App from '../../models/app.js';
|
||||
import Flow from '../../models/flow.js';
|
||||
|
||||
const createStep = async (_parent, params, context) => {
|
||||
const conditions = context.currentUser.can('update', 'Flow');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import User from '../../models/user';
|
||||
import Role from '../../models/role';
|
||||
import User from '../../models/user.js';
|
||||
import Role from '../../models/role.js';
|
||||
|
||||
const createUser = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'User');
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { Duration } from 'luxon';
|
||||
import deleteUserQueue from '../../queues/delete-user.ee';
|
||||
import flowQueue from '../../queues/flow';
|
||||
import Flow from '../../models/flow';
|
||||
import ExecutionStep from '../../models/execution-step';
|
||||
import appConfig from '../../config/app';
|
||||
import deleteUserQueue from '../../queues/delete-user.ee.js';
|
||||
import flowQueue from '../../queues/flow.js';
|
||||
import Flow from '../../models/flow.js';
|
||||
import ExecutionStep from '../../models/execution-step.js';
|
||||
import appConfig from '../../config/app.js';
|
||||
|
||||
const deleteCurrentUser = async (_parent, params, context) => {
|
||||
const id = context.currentUser.id;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Flow from '../../models/flow';
|
||||
import ExecutionStep from '../../models/execution-step';
|
||||
import globalVariable from '../../helpers/global-variable';
|
||||
import logger from '../../helpers/logger';
|
||||
import Flow from '../../models/flow.js';
|
||||
import ExecutionStep from '../../models/execution-step.js';
|
||||
import globalVariable from '../../helpers/global-variable.js';
|
||||
import logger from '../../helpers/logger.js';
|
||||
|
||||
const deleteFlow = async (_parent, params, context) => {
|
||||
const conditions = context.currentUser.can('delete', 'Flow');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import Role from '../../models/role';
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
||||
import Role from '../../models/role.js';
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||
|
||||
const deleteRole = async (_parent, params, context) => {
|
||||
context.currentUser.can('delete', 'Role');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Duration } from 'luxon';
|
||||
import User from '../../models/user';
|
||||
import deleteUserQueue from '../../queues/delete-user.ee';
|
||||
import User from '../../models/user.js';
|
||||
import deleteUserQueue from '../../queues/delete-user.ee.js';
|
||||
|
||||
const deleteUser = async (_parent, params, context) => {
|
||||
context.currentUser.can('delete', 'User');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import testRun from '../../services/test-run';
|
||||
import Step from '../../models/step';
|
||||
import testRun from '../../services/test-run.js';
|
||||
import Step from '../../models/step.js';
|
||||
|
||||
const executeFlow = async (_parent, params, context) => {
|
||||
const conditions = context.currentUser.can('update', 'Flow');
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import appConfig from '../../config/app';
|
||||
import User from '../../models/user';
|
||||
import emailQueue from '../../queues/email';
|
||||
import appConfig from '../../config/app.js';
|
||||
import User from '../../models/user.js';
|
||||
import emailQueue from '../../queues/email.js';
|
||||
import {
|
||||
REMOVE_AFTER_30_DAYS_OR_150_JOBS,
|
||||
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||
} from '../../helpers/remove-job-configuration';
|
||||
} from '../../helpers/remove-job-configuration.js';
|
||||
|
||||
const forgotPassword = async (_parent, params) => {
|
||||
const { email } = params.input;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import globalVariable from '../../helpers/global-variable';
|
||||
import App from '../../models/app';
|
||||
import globalVariable from '../../helpers/global-variable.js';
|
||||
import App from '../../models/app.js';
|
||||
|
||||
const generateAuthUrl = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Connection');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import User from '../../models/user';
|
||||
import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id';
|
||||
import User from '../../models/user.js';
|
||||
import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id.js';
|
||||
|
||||
const login = async (_parent, params) => {
|
||||
const user = await User.query().findOne({
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import User from '../../models/user';
|
||||
import Role from '../../models/role';
|
||||
import User from '../../models/user.js';
|
||||
import Role from '../../models/role.js';
|
||||
|
||||
const registerUser = async (_parent, params) => {
|
||||
const { fullName, email, password } = params.input;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import User from '../../models/user';
|
||||
import User from '../../models/user.js';
|
||||
|
||||
const resetPassword = async (_parent, params) => {
|
||||
const { token, password } = params.input;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import AppAuthClient from '../../models/app-auth-client';
|
||||
import AppAuthClient from '../../models/app-auth-client.js';
|
||||
|
||||
const updateAppAuthClient = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'App');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import AppConfig from '../../models/app-config';
|
||||
import AppConfig from '../../models/app-config.js';
|
||||
|
||||
const updateAppConfig = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'App');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import Config from '../../models/config';
|
||||
import Config from '../../models/config.js';
|
||||
|
||||
const updateConfig = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'Config');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import AppAuthClient from '../../models/app-auth-client';
|
||||
import AppAuthClient from '../../models/app-auth-client.js';
|
||||
|
||||
const updateConnection = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Connection');
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import Flow from '../../models/flow';
|
||||
import flowQueue from '../../queues/flow';
|
||||
import Flow from '../../models/flow.js';
|
||||
import flowQueue from '../../queues/flow.js';
|
||||
import {
|
||||
REMOVE_AFTER_30_DAYS_OR_150_JOBS,
|
||||
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||
} from '../../helpers/remove-job-configuration';
|
||||
import globalVariable from '../../helpers/global-variable';
|
||||
} from '../../helpers/remove-job-configuration.js';
|
||||
import globalVariable from '../../helpers/global-variable.js';
|
||||
|
||||
const JOB_NAME = 'flow';
|
||||
const EVERY_15_MINUTES_CRON = '*/15 * * * *';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import Role from '../../models/role';
|
||||
import Permission from '../../models/permission';
|
||||
import permissionCatalog from '../../helpers/permission-catalog.ee';
|
||||
import Role from '../../models/role.js';
|
||||
import Permission from '../../models/permission.js';
|
||||
import permissionCatalog from '../../helpers/permission-catalog.ee.js';
|
||||
|
||||
const updateRole = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'Role');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import App from '../../models/app';
|
||||
import Step from '../../models/step';
|
||||
import Connection from '../../models/connection';
|
||||
import App from '../../models/app.js';
|
||||
import Step from '../../models/step.js';
|
||||
import Connection from '../../models/connection.js';
|
||||
|
||||
const updateStep = async (_parent, params, context) => {
|
||||
const { isCreator } = context.currentUser.can('update', 'Flow');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import User from '../../models/user';
|
||||
import User from '../../models/user.js';
|
||||
|
||||
const updateUser = async (_parent, params, context) => {
|
||||
context.currentUser.can('update', 'User');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||
|
||||
const upsertSamlAuthProvider = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'SamlAuthProvider');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
||||
import SamlAuthProvidersRoleMapping from '../../models/saml-auth-providers-role-mapping.ee';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee.js';
|
||||
import SamlAuthProvidersRoleMapping from '../../models/saml-auth-providers-role-mapping.ee.js';
|
||||
import isEmpty from 'lodash/isEmpty.js';
|
||||
|
||||
const upsertSamlAuthProvidersRoleMappings = async (
|
||||
_parent,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import App from '../../models/app';
|
||||
import globalVariable from '../../helpers/global-variable';
|
||||
import App from '../../models/app.js';
|
||||
import globalVariable from '../../helpers/global-variable.js';
|
||||
|
||||
const verifyConnection = async (_parent, params, context) => {
|
||||
context.currentUser.can('create', 'Connection');
|
||||
|
Reference in New Issue
Block a user