mirror of
https://github.com/betagouv/mon-entreprise
synced 2025-02-09 02:55:01 +00:00
* feat: Ajoute l'iframe crisp ainsi que le bloc custom html * wip * feat: Renomme le dossier standup.. + ajoute la fonction crisp * fix: Install not broken version + add update meta * feat: Ajoute le formulaire * fix: Corrige htmlFor et id * feat: Ajoute la logique pour récupérer nombre de réponses et les issues * fix: uncomment stuff * fix: Retire log * chore: Renomme fonction * chore: Renomme fonction * chore: Renomme fonction * feat: Retire commentaires * fix: Refacto urlParams * chore : Nettoyage de reliquats * fix : Ajoute TextAreaField et utilise TextField * fix: Style issues * fix: Améliore types * feat: Cleaning * feat: Ajoute variable d'env website id * feat: Met à jour README * wip placeholder url * feat: Ajoute une fonction de validation du body * feat: Ajoute validation * chore: update yarn.lock * fix: Add missing secret ref + cleaning
45 lines
1,012 B
TypeScript
45 lines
1,012 B
TypeScript
import later from '@breejs/later'
|
|
import Bree, { BreeOptions } from 'bree'
|
|
import { dirname, join } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { NODE_ENV } from './config.js'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
|
|
// Doc for interval : https://breejs.github.io/later/parsers.html#text
|
|
const jobs: BreeOptions['jobs'] = [
|
|
{
|
|
name: 'refresh-token',
|
|
interval: 'at 2:00',
|
|
},
|
|
{
|
|
name: 'daily-stand-up',
|
|
interval: 'on Monday through Thursday at 16:42',
|
|
},
|
|
{
|
|
name: 'weekly-randomizer',
|
|
interval: 'on Thursday at 16:40',
|
|
},
|
|
]
|
|
|
|
const badJob = jobs.findIndex(
|
|
(job) =>
|
|
typeof job === 'object' &&
|
|
'interval' in job &&
|
|
// eslint-disable-next-line
|
|
later.parse.text(job.interval).error >= 0
|
|
)
|
|
if (badJob >= 0) {
|
|
throw new Error(`Bad interval in job n°${badJob}`)
|
|
}
|
|
|
|
const bree = new Bree({
|
|
root: join(__dirname, 'jobs'),
|
|
defaultExtension: NODE_ENV === 'production' ? 'js' : 'ts',
|
|
timezone: 'Europe/Paris',
|
|
jobs,
|
|
})
|
|
|
|
await bree.start()
|
|
|
|
export { bree }
|