Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fs time tracking #31

Merged
merged 10 commits into from
Jul 2, 2023
Merged
111 changes: 111 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This file is just a copy of .gitignore

.env
**/lastAssignmentTimestamp.csv

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port


Empty file added .prettierrc.json
Empty file.
16 changes: 16 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ import AuthService from './src/services/authService';
import AuthController from './src/controllers/authController';
import authRoute from './src/routes/auth';

import timeTrackingEventModel from './src/models/timeTrackingEventModel';
import TimeTrackingEventRepository from './src/repositories/timeTrackingEventRepository';
import TimeTrackingService from './src/services/timeTrackingService';
import TimeTrackingController from './src/controllers/timeTrackingController';
import timeTrackingRoutes from './src/routes/timeTracking';

const shiftRotaRepository = new ShiftRotaRepository(shiftRotaModel);
const shiftRotaService = new ShiftRotaService(shiftRotaRepository);
const shiftRotaController = new ShiftRotaController(shiftRotaService);
Expand All @@ -53,6 +59,10 @@ const userController = new UserController(userService);
const authService = new AuthService(userRepository, process.env.JWTPRIVATEKEY);
const authController = new AuthController(authService, userService);

const timeTrackingEventRepository = new TimeTrackingEventRepository(timeTrackingEventModel);
const timeTrackingEventService = new TimeTrackingService(timeTrackingEventRepository);
const timeTrackingEventController = new TimeTrackingController(timeTrackingEventService);

if(!process.env.JWTPRIVATEKEY || !process.env.PORT)console.log("Either JWTPRIVATEKEY or PORT environment variable is not present!")
if(!process.env.MONGOLOGIN || !process.env.MONGOPW)throw new Error("Either MONGOLOGIN or MONGOPW environment variable is not present!")
console.log('starting for ' + process.env.URL);
Expand All @@ -69,6 +79,7 @@ app.use('/api/shiftChangeRequest', shiftChangeRoute(shiftChangeController));
app.use('/api/tickets', ticketRoutes(ticketController));
app.use('/api', authRoute(authController));
app.use('/api/users', usersRoute(userController));
app.use('/api/timeTracking', timeTrackingRoutes(timeTrackingEventController));

const logger = new LoggerService(new LoggerRepository(logModel));

Expand Down Expand Up @@ -98,6 +109,11 @@ if(process.argv.includes('--noTicketAssignment')){
console.log('Running without ticket Assignment')
} else {job.start()}

const timeTrackingSavingJob = new cron.CronJob('* * * * *', async function () {
timeTrackingEventController.saveNewTimeTrackingEvents();
});
timeTrackingSavingJob.start();

const emailJob = new cron.CronJob('0 12 * * 5', async function () {
sendEmailstoAgents(shiftRotaService);
});
Expand Down
Loading