Skip to content

Commit

Permalink
Convert to ES6 modules
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieltanchen committed Nov 22, 2024
1 parent 41366ce commit adfd339
Show file tree
Hide file tree
Showing 542 changed files with 2,391 additions and 2,058 deletions.
6 changes: 3 additions & 3 deletions app/controllers/attachment-ctrl/create-attachment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { AttachmentError } = require('../../middleware/error-handler');
import { AttachmentError } from '../../middleware/error-handler/index.js';

Check failure on line 3 in app/controllers/attachment-ctrl/create-attachment.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "../../middleware/error-handler/index.js"

module.exports = async({
export default async({
attachmentCtrl,
auditApiCallUuid,
expenseUuid,
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/attachment-ctrl/delete-attachment.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const { DeleteObjectCommand } = require('@aws-sdk/client-s3');
const Sequelize = require('sequelize');
import { DeleteObjectCommand } from '@aws-sdk/client-s3';
import Sequelize from 'sequelize';

const { AttachmentError } = require('../../middleware/error-handler');
import { AttachmentError } from '../../middleware/error-handler/index.js';

Check failure on line 4 in app/controllers/attachment-ctrl/delete-attachment.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "../../middleware/error-handler/index.js"

/**
* @param {object} attachmentCtrl Instance of AttachmentCtrl
* @param {string} attachmentUuid UUID of attachment to delete
* @param {string} auditApiCallUuid
*/
module.exports = async({
export default async({
attachmentCtrl,
attachmentUuid,
auditApiCallUuid,
Expand Down
16 changes: 7 additions & 9 deletions app/controllers/attachment-ctrl/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { S3Client } = require('@aws-sdk/client-s3');
const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
import { S3Client } from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';

const createAttachment = require('./create-attachment');
const deleteAttachment = require('./delete-attachment');
const updateAttachment = require('./update-attachment');
const uploadAttachment = require('./upload-attachment');
import createAttachment from './create-attachment.js';

Check failure on line 4 in app/controllers/attachment-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./create-attachment.js"
import deleteAttachment from './delete-attachment.js';

Check failure on line 5 in app/controllers/attachment-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./delete-attachment.js"
import updateAttachment from './update-attachment.js';

Check failure on line 6 in app/controllers/attachment-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./update-attachment.js"
import uploadAttachment from './upload-attachment.js';

Check failure on line 7 in app/controllers/attachment-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./upload-attachment.js"

class AttachmentCtrl {
export default class AttachmentCtrl {
constructor(parent, models) {
this.parent = parent;
this.models = models;
Expand Down Expand Up @@ -42,5 +42,3 @@ class AttachmentCtrl {
});
}
}

module.exports = AttachmentCtrl;
6 changes: 3 additions & 3 deletions app/controllers/attachment-ctrl/update-attachment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { AttachmentError } = require('../../middleware/error-handler');
import { AttachmentError } from '../../middleware/error-handler/index.js';

Check failure on line 3 in app/controllers/attachment-ctrl/update-attachment.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "../../middleware/error-handler/index.js"

/**
* @param {object} attachmentCtrl Instance of AttachmentCtrl
Expand All @@ -9,7 +9,7 @@ const { AttachmentError } = require('../../middleware/error-handler');
* @param {string} name
*
*/
module.exports = async({
export default async({
attachmentCtrl,
attachmentUuid,
auditApiCallUuid,
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/attachment-ctrl/upload-attachment.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const {
import {
CompleteMultipartUploadCommand,
CreateMultipartUploadCommand,
HeadObjectCommand,
UploadPartCommand,
} = require('@aws-sdk/client-s3');
const nconf = require('nconf');
const Sequelize = require('sequelize');
} from '@aws-sdk/client-s3';
import nconf from 'nconf';
import Sequelize from 'sequelize';

const { AttachmentError } = require('../../middleware/error-handler');
import { AttachmentError } from '../../middleware/error-handler/index.js';

Check failure on line 10 in app/controllers/attachment-ctrl/upload-attachment.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "../../middleware/error-handler/index.js"

/**
* @param {object} attachmentCtrl Instance of AttachmentCtrl
Expand All @@ -16,7 +16,7 @@ const { AttachmentError } = require('../../middleware/error-handler');
* @param {buffer} fileBody
* @param {string} fileName
*/
module.exports = async({
export default async({
attachmentCtrl,
attachmentUuid,
auditApiCallUuid,
Expand Down
12 changes: 5 additions & 7 deletions app/controllers/audit-ctrl/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const trackChanges = require('./track-changes');
const trackInstanceDestroy = require('./track-instance-destroy');
const trackInstanceUpdate = require('./track-instance-update');
const trackNewInstance = require('./track-new-instance');
import trackChanges from './track-changes.js';

Check failure on line 1 in app/controllers/audit-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./track-changes.js"
import trackInstanceDestroy from './track-instance-destroy.js';

Check failure on line 2 in app/controllers/audit-ctrl/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of file extension "js" for "./track-instance-destroy.js"
import trackInstanceUpdate from './track-instance-update.js';
import trackNewInstance from './track-new-instance.js';

class AuditCtrl {
export default class AuditCtrl {
constructor(parent, models) {
this.parent = parent;
this.models = models;
Expand Down Expand Up @@ -117,5 +117,3 @@ class AuditCtrl {
});
}
}

module.exports = AuditCtrl;
4 changes: 2 additions & 2 deletions app/controllers/audit-ctrl/track-changes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { AuditError } = require('../../middleware/error-handler');
import { AuditError } from '../../middleware/error-handler/index.js';

/**
* Track the changes in the change list. The change list must be a list of
Expand All @@ -13,7 +13,7 @@ const { AuditError } = require('../../middleware/error-handler');
* @param {object[]} [newList] List of Sequelize instances that have been created
* @param {object} transaction Sequelize transaction
*/
module.exports = async({
export default async({
auditCtrl,
auditApiCallUuid,
changeList = [],
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/audit-ctrl/track-instance-destroy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { AuditError } = require('../../middleware/error-handler');
import { AuditError } from '../../middleware/error-handler/index.js';

/**
* Save audit change for deletion of paranoid instances. Only delete instances
Expand All @@ -9,7 +9,7 @@ const { AuditError } = require('../../middleware/error-handler');
* @param {object} instance The Sequelize instance to track
* @param {object} transaction Sequelize transaction
*/
module.exports = async({
export default async({
auditCtrl,
auditLog,
instance,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/audit-ctrl/track-instance-update.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { AuditError } = require('../../middleware/error-handler');
import { AuditError } from '../../middleware/error-handler/index.js';

/**
* Save audit changes for the changed attributes for this instance using
Expand All @@ -12,7 +12,7 @@ const { AuditError } = require('../../middleware/error-handler');
* @param {object} instance The Sequelize instance to track
* @param {object} transaction Sequelize transaction
*/
module.exports = async({
export default async({
auditCtrl,
auditLog,
instance,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/audit-ctrl/track-new-instance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { AuditError } = require('../../middleware/error-handler');
import { AuditError } from '../../middleware/error-handler/index.js';

/**
* Save audit changes for all attributes for this instance. Use
Expand All @@ -11,7 +11,7 @@ const { AuditError } = require('../../middleware/error-handler');
* @param {object} instance The Sequelize instance to track
* @param {object} transaction Sequelize transaction
*/
module.exports = async({
export default async({
auditCtrl,
auditLog,
instance,
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/budget-ctrl/create-budget.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const Sequelize = require('sequelize');
const _ = require('lodash');
import Sequelize from 'sequelize';
import _ from 'lodash';

const { BudgetError } = require('../../middleware/error-handler');
import { BudgetError } from '../../middleware/error-handler/index.js';

module.exports = async({
export default async({
amount,
auditApiCallUuid,
budgetCtrl,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/budget-ctrl/delete-budget.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { BudgetError } = require('../../middleware/error-handler');
import { BudgetError } from '../../middleware/error-handler/index.js';

module.exports = async({
export default async({
auditApiCallUuid,
budgetCtrl,
budgetUuid,
Expand Down
10 changes: 4 additions & 6 deletions app/controllers/budget-ctrl/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const createBudget = require('./create-budget');
const deleteBudget = require('./delete-budget');
const updateBudget = require('./update-budget');
import createBudget from './create-budget.js';
import deleteBudget from './delete-budget.js';
import updateBudget from './update-budget.js';

class BudgetCtrl {
export default class BudgetCtrl {
constructor(parent, models) {
this.parent = parent;
this.models = models;
Expand All @@ -29,5 +29,3 @@ class BudgetCtrl {
});
}
}

module.exports = BudgetCtrl;
8 changes: 4 additions & 4 deletions app/controllers/budget-ctrl/update-budget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Sequelize = require('sequelize');
const _ = require('lodash');
import Sequelize from 'sequelize';
import _ from 'lodash';

const { BudgetError } = require('../../middleware/error-handler');
import { BudgetError } from '../../middleware/error-handler/index.js';

const Op = Sequelize.Op;

Expand All @@ -15,7 +15,7 @@ const Op = Sequelize.Op;
* @param {string} subcategoryUuid
* @param {integer} year
*/
module.exports = async({
export default async({
amount,
auditApiCallUuid,
budgetCtrl,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/create-category.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
* @param {object} categoryCtrl Instance of CategoryCtrl
* @param {string} name
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
name,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/create-subcategory.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
* @param {object} categoryCtrl Instance of CategoryCtrl
* @param {string} categoryUuid
* @param {string} name
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
categoryUuid,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/delete-category.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
* @param {object} categoryCtrl Instance of CategoryCtrl
* @param {string} categoryUuid UUID of the category to delete
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
categoryUuid,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/delete-subcategory.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
* @param {object} categoryCtrl Instance of CategoryCtrl
* @param {string} subcategoryUuid UUID of the subcategory to delete
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
subcategoryUuid,
Expand Down
16 changes: 7 additions & 9 deletions app/controllers/category-ctrl/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const createCategory = require('./create-category');
const createSubcategory = require('./create-subcategory');
const deleteCategory = require('./delete-category');
const deleteSubcategory = require('./delete-subcategory');
const updateCategory = require('./update-category');
const updateSubcategory = require('./update-subcategory');
import createCategory from './create-category.js';
import createSubcategory from './create-subcategory.js';
import deleteCategory from './delete-category.js';
import deleteSubcategory from './delete-subcategory.js';
import updateCategory from './update-category.js';
import updateSubcategory from './update-subcategory.js';

class CategoryCtrl {
export default class CategoryCtrl {
constructor(parent, models) {
this.parent = parent;
this.models = models;
Expand Down Expand Up @@ -85,5 +85,3 @@ class CategoryCtrl {
});
}
}

module.exports = CategoryCtrl;
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/update-category.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
* @param {object} categoryCtrl Instance of CategoryCtrl
* @param {string} categoryUuid UUID of the category to update
* @param {string} name
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
categoryUuid,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/category-ctrl/update-subcategory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { CategoryError } = require('../../middleware/error-handler');
import { CategoryError } from '../../middleware/error-handler/index.js';

/**
* @param {string} auditApiCallUuid
Expand All @@ -9,7 +9,7 @@ const { CategoryError } = require('../../middleware/error-handler');
* @param {string} name
* @param {string} subcategoryUuid
*/
module.exports = async({
export default async({
auditApiCallUuid,
categoryCtrl,
categoryUuid,
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/employer-ctrl/create-employer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Sequelize = require('sequelize');
import Sequelize from 'sequelize';

const { EmployerError } = require('../../middleware/error-handler');
import { EmployerError } from '../../middleware/error-handler/index.js';

module.exports = async({
export default async({
auditApiCallUuid,
employerCtrl,
name,
Expand Down
Loading

0 comments on commit adfd339

Please sign in to comment.