Skip to content

Commit

Permalink
Merge pull request #57 from isd-sgcu/dev
Browse files Browse the repository at this point in the history
update main
  • Loading branch information
bookpanda authored Jul 25, 2024
2 parents 39a9896 + d0bc148 commit f2e3e9a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -143,6 +150,7 @@ func LoadConfig() (*Config, error) {

regConfig := RegConfig{
RpkmConfirmStart: parsedRpkmConfirmStart,
BaanResultStart: parsedBaanResultStart,
RpkmDayOneStart: parsedRpkmDayOneStart,
RpkmDayTwoStart: parsedRpkmDayTwoStart,
FreshyNightConfirmStart: parsedFreshyNightConfirmStart,
Expand Down
3 changes: 2 additions & 1 deletion constant/checkin.constant.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package constant

const RPKM_CONFIRM = "rpkm-confirm"
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"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.qa.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions internal/checkin/checkin.handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f2e3e9a

Please sign in to comment.