From e504fc585be6d19e216f971dc884ede2c7d9d152 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Thu, 25 Jul 2024 21:19:53 +0700 Subject: [PATCH 1/2] add env --- .env.template | 1 + config/config.go | 8 ++++++++ constant/checkin.constant.go | 3 ++- docker-compose.qa.template.yml | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.env.template b/.env.template index eaa4c07..a4dbc08 100644 --- a/.env.template +++ b/.env.template @@ -7,6 +7,7 @@ IMG_CROP_WIDTH=500 IMG_CROP_HEIGHT=500 REG_RPKM_CONFIRM_START=2024-07-25T00:00:00Z +REG_BAAN_RESULT_START=2024-07-28T20:00:00Z REG_RPKM_DAY_ONE_START=2024-08-03T06:00:00Z REG_RPKM_DAY_TWO_START=2024-08-04T06:00:00Z REG_FRESHY_NIGHT_CONFIRM_START=2024-08-03T08:00:00Z diff --git a/config/config.go b/config/config.go index 525a38b..88bbee8 100644 --- a/config/config.go +++ b/config/config.go @@ -23,6 +23,7 @@ type ImageConfig struct { type RegConfig struct { RpkmConfirmStart time.Time + BaanResultStart time.Time RpkmDayOneStart time.Time RpkmDayTwoStart time.Time FreshyNightConfirmStart time.Time @@ -99,6 +100,12 @@ func LoadConfig() (*Config, error) { } fmt.Printf("Parsed RPKM confirm start time: %v\n", parsedRpkmConfirmStart) + parsedBaanResultStart, err := parseLocalTime("REG_BAAN_RESULT_START") + if err != nil { + return nil, err + } + fmt.Printf("Parsed Baan result start time: %v\n", parsedBaanResultStart) + parsedRpkmDayOneStart, err := parseLocalTime("REG_RPKM_DAY_ONE_START") if err != nil { return nil, err @@ -143,6 +150,7 @@ func LoadConfig() (*Config, error) { regConfig := RegConfig{ RpkmConfirmStart: parsedRpkmConfirmStart, + BaanResultStart: parsedBaanResultStart, RpkmDayOneStart: parsedRpkmDayOneStart, RpkmDayTwoStart: parsedRpkmDayTwoStart, FreshyNightConfirmStart: parsedFreshyNightConfirmStart, diff --git a/constant/checkin.constant.go b/constant/checkin.constant.go index c93e8ab..36af390 100644 --- a/constant/checkin.constant.go +++ b/constant/checkin.constant.go @@ -1,6 +1,7 @@ package constant -const RPKM_CONFIRM = "rpkm-confirm" +const BAAN_RESULT = "baan-result" +const RPKM_CONFIRM = "confirm-rpkm" const RPKM_DAY_ONE = "rpkm-day-1" const RPKM_DAY_TWO = "rpkm-day-2" const FRESHY_NIGHT_CONFIRM = "freshy-night-confirm" diff --git a/docker-compose.qa.template.yml b/docker-compose.qa.template.yml index c58368e..4f1c5d3 100644 --- a/docker-compose.qa.template.yml +++ b/docker-compose.qa.template.yml @@ -24,6 +24,7 @@ services: IMG_CROP_WIDTH: 500 IMG_CROP_HEIGHT: 500 REG_RPKM_CONFIRM_START: "2024-07-25T00:00:00Z" + REG_BAAN_RESULT_START: "2024-07-28T20:00:00Z" REG_RPKM_DAY_ONE_START: "2024-08-03T06:00:00Z" REG_RPKM_DAY_TWO_START: "2024-08-04T06:00:00Z" REG_FRESHY_NIGHT_CONFIRM_START: "2024-08-03T08:00:00Z" From 3fec81b580c50997d73e41d881c4f1e4c66b5849 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Thu, 25 Jul 2024 21:20:58 +0700 Subject: [PATCH 2/2] checkin baan res --- constant/checkin.constant.go | 2 +- internal/checkin/checkin.handler.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/constant/checkin.constant.go b/constant/checkin.constant.go index 36af390..4a7b7ac 100644 --- a/constant/checkin.constant.go +++ b/constant/checkin.constant.go @@ -1,7 +1,7 @@ package constant -const BAAN_RESULT = "baan-result" const RPKM_CONFIRM = "confirm-rpkm" +const BAAN_RESULT = "baan-result" const RPKM_DAY_ONE = "rpkm-day-1" const RPKM_DAY_TWO = "rpkm-day-2" const FRESHY_NIGHT_CONFIRM = "freshy-night-confirm" diff --git a/internal/checkin/checkin.handler.go b/internal/checkin/checkin.handler.go index 6b2ac34..5e6b75f 100644 --- a/internal/checkin/checkin.handler.go +++ b/internal/checkin/checkin.handler.go @@ -205,6 +205,11 @@ func (h *handlerImpl) checkRegTime(event string) (bool, string) { h.log.Named("checkRegTime").Warn(fmt.Sprintf("Forbidden: RPKM67 Confirmation Registration starts at %s", h.regConf.RpkmConfirmStart)) return false, fmt.Sprintf("RPKM67 Confirmation Registration starts at %s", h.regConf.RpkmConfirmStart) } + case constant.BAAN_RESULT: + if nowGMTPlus7.Before(h.regConf.BaanResultStart) { + h.log.Named("checkRegTime").Warn(fmt.Sprintf("Forbidden: Baan Selection Result starts at %s", h.regConf.BaanResultStart)) + return false, fmt.Sprintf("Baan Selection Result starts at %s", h.regConf.BaanResultStart) + } case constant.RPKM_DAY_ONE: if nowGMTPlus7.Before(h.regConf.RpkmDayOneStart) { h.log.Named("checkRegTime").Warn(fmt.Sprintf("Forbidden: RPKM67 Day One Registration starts at %s", h.regConf.RpkmDayOneStart))