Skip to content

Commit

Permalink
merged cron enums, now only one file dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Ijlal Ahmad <[email protected]>
  • Loading branch information
Thre4dripper committed Oct 16, 2024
1 parent 73b1390 commit a396937
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src-javascript/app/crons/demo.cron.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const MasterController = require('../utils/MasterController');
const CronBuilder = require('../utils/CronBuilder');
const { CronWeekday } = require('../enums/CronWeekday');
const { CronWeekday } = require('../enums/CronJob');

class DemoCron extends MasterController {
cronController() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ const CronMonth = {
December: 'dec',
};

const CronWeekday = {
Sunday: 'sun',
Monday: 'mon',
Tuesday: 'tue',
Wednesday: 'wed',
Thursday: 'thu',
Friday: 'fri',
Saturday: 'sat',
};

module.exports.CronMonth = CronMonth;
module.exports.CronWeekday = CronWeekday;
11 changes: 0 additions & 11 deletions src-javascript/app/enums/CronWeekday.js

This file was deleted.

3 changes: 1 addition & 2 deletions src-javascript/app/utils/CronBuilder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { CronMonth } = require('../enums/CronMonth');
const { CronWeekday } = require('../enums/CronWeekday');
const { CronMonth, CronWeekday } = require('../enums/CronJob');

class CronBuilder {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions src-javascript/app/utils/MasterController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MasterController {

// end socket requests snippet

// start cron job snippet
// start cron jobs snippet
static cronRequests = [];

/**
Expand All @@ -39,7 +39,7 @@ class MasterController {
return this.cronRequests;
}

// end cron job snippet
// end cron jobs snippet

/**
* @method MasterController.doc
Expand Down
4 changes: 2 additions & 2 deletions src-javascript/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ const port = process.env.PORT || 3000;
});
// End Initialize Socket.IO

// Initialize the cron jobs
// Initialize Cron Jobs
await CronConfig.InitCronJobs(path.join(__dirname, 'app/crons'));
CronConfig.startCronJobs();

// End Initialize the cron jobs
// End Initialize Cron Jobs

// Start listening for HTTP requests
httpServer.listen(port, () => {
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src-typescript/app/crons/demo.cron.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MasterController from '../utils/MasterController';
import CronBuilder from '../utils/CronBuilder';
import { CronWeekday } from '../enums/CronWeekday';
import { CronWeekday } from '../enums/CronJob';

class DemoCron extends MasterController<null, null, null> {
cronController() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ export enum CronMonth {
November = 'nov',
December = 'dec',
}

export enum CronWeekday {
Sunday = 'sun',
Monday = 'mon',
Tuesday = 'tue',
Wednesday = 'wed',
Thursday = 'thu',
Friday = 'fri',
Saturday = 'sat',
}
9 changes: 0 additions & 9 deletions src-typescript/app/enums/CronWeekday.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src-typescript/app/models/mongoose.user.model.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src-typescript/app/utils/CronBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CronMonth } from '../enums/CronMonth';
import { CronWeekday } from '../enums/CronWeekday';
import { CronMonth, CronWeekday } from '../enums/CronJob';

class CronBuilder {
private readonly fields: { [key: string]: string };
Expand Down
4 changes: 2 additions & 2 deletions src-typescript/app/utils/MasterController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MasterController<P, Q, B> {

// end socket requests snippet

// start cron job snippet
// start cron jobs snippet
private static cronRequests: ICronJob[] = [];

/**
Expand All @@ -57,7 +57,7 @@ class MasterController<P, Q, B> {
return this.cronRequests;
}

// end cron job snippet
// end cron jobs snippet

/**
* @method MasterController.doc
Expand Down
4 changes: 2 additions & 2 deletions src-typescript/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const port = process.env.PORT || 3000;
});
// End Initialize Socket.IO

// Initialize the cron jobs
// Initialize Cron Jobs
await CronConfig.InitCronJobs(path.join(__dirname, 'app/crons'), (pathToCron: string) => {
// configurable import statement to load all the cron jobs before starting server
// This lambda function is called for each cron job file found
Expand All @@ -81,7 +81,7 @@ const port = process.env.PORT || 3000;
});
CronConfig.startCronJobs();

// End Initialize the cron jobs
// End Initialize Cron Jobs

// Start listening for HTTP requests
httpServer.listen(port, () => {
Expand Down

0 comments on commit a396937

Please sign in to comment.