all in one commit: feat: add countdown integration
fix: home nav icon spacing fix: various typos correction fix: right email texts
This commit is contained in:
parent
bac5347c65
commit
9002086180
19 changed files with 147 additions and 50 deletions
|
|
@ -17,6 +17,8 @@ import EmailService from './EmailService'
|
|||
import ErrorController from './controllers/ErrorController'
|
||||
import { createProxyMiddleware, Filter, Options, RequestHandler } from 'http-proxy-middleware';
|
||||
|
||||
process.env.TZ = "Europe/Paris"
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
console.error(err)
|
||||
console.log('unhandledRejection!')
|
||||
|
|
@ -58,7 +60,7 @@ let main = async () => {
|
|||
app.use(bodyParser.json())
|
||||
|
||||
app.get('/', PublicController.home)
|
||||
app.get('/countdown', PublicController.countdown)
|
||||
app.get('/c', PublicController.countdown)
|
||||
app.get('/association/:slug', PublicController.organization)
|
||||
app.get('/a-propos', PublicController.about)
|
||||
app.get('/mentions-legales', PublicController.legals)
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ export default class AdminOrganizationController {
|
|||
static sendEmailTokenUniversal(data: Document) {
|
||||
EmailService.send(
|
||||
data.get('email'),
|
||||
"Votre lien secret pour modifier votre association",
|
||||
"Votre lien pour l’inscription de votre association",
|
||||
"token",
|
||||
{
|
||||
adminName: data.get('adminName'),
|
||||
|
|
|
|||
|
|
@ -16,17 +16,27 @@ import MediaService from '../MediaService'
|
|||
export default class PublicController {
|
||||
|
||||
static async countdown(req: express.Request, res: express.Response) {
|
||||
res.render('countdown.twig', {})
|
||||
res.render('countdown.twig', {
|
||||
openDate: process.env.OPEN_DATE
|
||||
})
|
||||
}
|
||||
|
||||
static async home(req: express.Request, res: express.Response) {
|
||||
let isProposed = Utils.isStrUsable(req.query, 'only')
|
||||
let byPass = req.query.bypass != null
|
||||
let target: any = new Date(process.env.OPEN_DATE == null ? '01/01/1970 00:00' : process.env.OPEN_DATE)
|
||||
let now: any = new Date()
|
||||
if (!byPass && !isProposed && target > now) {
|
||||
return res.render('countdown.twig', {
|
||||
openDate: process.env.OPEN_DATE
|
||||
})
|
||||
}
|
||||
// let client: IORedis.Redis = RedisService.getClient()
|
||||
// await client.set('hello', 'world')
|
||||
// res.json({
|
||||
// data: await client.get('hello')
|
||||
// })
|
||||
Tag.find().then(tags => {
|
||||
let isProposed = Utils.isStrUsable(req.query, 'only')
|
||||
// @ts-ignore
|
||||
if (isProposed && !mongoose.Types.ObjectId.isValid(req.query.only)) {
|
||||
return ErrorController.handleServerError({ stack: 'Invalid object id in only query param'}, req, res, [])
|
||||
|
|
@ -129,6 +139,31 @@ export default class PublicController {
|
|||
})
|
||||
}
|
||||
version.cutDescription = Utils.isStrUsable(version, 'descriptionLong') && version.descriptionLong.length > 200
|
||||
|
||||
// TODO: Rassembler les horaires qui sont dans le même jour, uniquement pour le front
|
||||
|
||||
// version.schedule = version.schedule.map((s: any) => {
|
||||
// let newWhens: any = []
|
||||
// console.log(s)
|
||||
// // s.when.foreach((w: any) => {
|
||||
// // // if there is already a when with the same day add it
|
||||
// // let scheduleObject: any = { from: w.from, to: w.to }
|
||||
// // if (newWhens.filter((_n: any) => _n.day === w.day).length > 0) {
|
||||
// // newWhens.map((newWhen: any) => {
|
||||
// // if (newWhen.day === w.day) {
|
||||
// // newWhen.hours.push(scheduleObject)
|
||||
// // }
|
||||
// // return newWhen
|
||||
// // })
|
||||
// // } else {
|
||||
// // w.hours = [scheduleObject]
|
||||
// // newWhens.push(w)
|
||||
// // }
|
||||
// // })
|
||||
// // s.when = newWhens
|
||||
// return s
|
||||
// })
|
||||
|
||||
// if (version.cutDescription) {
|
||||
// version.descriptionFirstHalf = version.descriptionLong.substr(0, 200) // not gonna lie
|
||||
// version.descriptionSecondHalf = version.descriptionLong.substr(200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue