Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update main #57

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading