11const Settings = require ( "../../models/settings.model" ) ;
22const logger = require ( "../../services/logger.service" ) ;
33
4- const settingRegistrationNotYetOpen = {
4+ const settingApplicationNotYetOpen = {
55 openTime : new Date ( Date . now ( ) + 100000000000 ) ,
66 closeTime : new Date ( Date . now ( ) + 10000000000000000 ) ,
77 confirmTime : new Date ( Date . now ( ) + 100000000000000000 )
88} ;
99
10- const settingRegistrationOpen = {
10+ const settingApplicationOpen = {
1111 openTime : new Date ( Date . now ( ) - 100 ) ,
1212 closeTime : new Date ( Date . now ( ) + 10000000000 ) ,
1313 confirmTime : new Date ( Date . now ( ) + 100000000000000 )
1414} ;
1515
16- const settingRegistrationClosed = {
16+ const settingApplicationClosed = {
1717 openTime : new Date ( Date . now ( ) - 100 ) ,
1818 closeTime : new Date ( Date . now ( ) - 1000 ) ,
1919 confirmTime : new Date ( Date . now ( ) + 100000000000000 )
@@ -26,9 +26,22 @@ const settingConfirmClosed = {
2626} ;
2727
2828async function storeAll ( ) {
29- const toStore = new Settings ( settingRegistrationClosed ) ;
29+ const toStore = new Settings ( settingApplicationOpen ) ;
3030 Settings . collection . insertOne ( toStore ) ;
3131}
32+
33+ async function setApplicationClosed ( ) {
34+ await dropAll ( ) ;
35+ const toStore = new Settings ( settingApplicationClosed ) ;
36+ Settings . collection . insertOne ( toStore ) ;
37+ }
38+
39+ async function setApplicationNotYetOpen ( ) {
40+ await dropAll ( ) ;
41+ const toStore = new Settings ( settingApplicationNotYetOpen ) ;
42+ Settings . collection . insertOne ( toStore ) ;
43+ }
44+
3245async function dropAll ( ) {
3346 try {
3447 await Settings . collection . drop ( ) ;
@@ -43,8 +56,10 @@ async function dropAll() {
4356module . exports = {
4457 storeAll : storeAll ,
4558 dropAll : dropAll ,
46- settingRegistrationNotYetOpen : settingRegistrationNotYetOpen ,
47- settingRegistrationOpen : settingRegistrationOpen ,
48- settingRegistrationClosed : settingRegistrationClosed ,
59+ setApplicationClosed : setApplicationClosed ,
60+ setApplicationNotYetOpen : setApplicationNotYetOpen ,
61+ settingApplicationNotYetOpen : settingApplicationNotYetOpen ,
62+ settingApplicationOpen : settingApplicationOpen ,
63+ settingApplicationClosed : settingApplicationClosed ,
4964 settingConfirmClosed : settingConfirmClosed
5065} ;
0 commit comments