Skip to content
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,12 @@ JWT_REFRESH_TOKEN_TTL=168h
### Cloud Deployment

#### Railway
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/your-template-id)
> **Note:** Railway telah menghentikan dukungan untuk template deployment gratis. Silakan gunakan opsi lain di bawah ini atau deploy secara manual.
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README is otherwise written in English in this section, but the newly added Railway deprecation note is in Indonesian. For consistency and readability for the broader audience, consider translating this note to English or providing bilingual text.

Suggested change
> **Note:** Railway telah menghentikan dukungan untuk template deployment gratis. Silakan gunakan opsi lain di bawah ini atau deploy secara manual.
> **Note:** Railway has discontinued support for free deployment templates. Please use one of the options below or deploy manually. (Catatan: Railway telah menghentikan dukungan untuk template deployment gratis. Silakan gunakan opsi lain di bawah ini atau deploy secara manual.)

Copilot uses AI. Check for mistakes.

[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new)

#### Render
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy)
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/ilramdhan/holidayapi)

#### Fly.io
```bash
Expand Down
7 changes: 4 additions & 3 deletions internal/repository/holiday_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package repository
import (
"database/sql"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -89,17 +90,17 @@ func (r *holidayRepository) GetAll(filter models.HolidayFilter) ([]models.Holida

if filter.Year != nil {
whereConditions = append(whereConditions, "strftime('%Y', date) = ?")
args = append(args, fmt.Sprintf("%d", *filter.Year))
args = append(args, strconv.Itoa(*filter.Year))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Lost leading zero padding - SQLite strftime('%m') returns "01"-"12" but strconv.Itoa(1) returns "1", causing month filter to fail silently.

Suggested change
args = append(args, strconv.Itoa(*filter.Year))
args = append(args, fmt.Sprintf("%02d", *filter.Month))

}

if filter.Month != nil {
whereConditions = append(whereConditions, "strftime('%m', date) = ?")
args = append(args, fmt.Sprintf("%02d", *filter.Month))
args = append(args, strconv.Itoa(*filter.Month))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Lost leading zero padding - SQLite strftime('%m') returns "01"-"12" but strconv.Itoa(1) returns "1", causing month filter to fail silently.

Suggested change
args = append(args, strconv.Itoa(*filter.Month))
args = append(args, fmt.Sprintf("%02d", *filter.Month))

}
Comment on lines 96 to 99
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strftime('%m', date) in SQLite returns a zero-padded month string (e.g., "01"). Switching from fmt.Sprintf("%02d", *filter.Month) to strconv.Itoa(*filter.Month) changes the bound parameter to "1", which will no longer match and breaks month filtering (including “this month” and month query param behavior). Consider restoring zero-padding or changing the SQL to compare integers (e.g., CAST(strftime('%m', date) AS INTEGER) = ?) and bind an int.

Copilot uses AI. Check for mistakes.

if filter.Day != nil {
whereConditions = append(whereConditions, "strftime('%d', date) = ?")
args = append(args, fmt.Sprintf("%02d", *filter.Day))
args = append(args, strconv.Itoa(*filter.Day))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Lost leading zero padding - SQLite strftime('%d') returns "01"-"31" but strconv.Itoa(1) returns "1", causing day filter to fail silently.

Suggested change
args = append(args, strconv.Itoa(*filter.Day))
args = append(args, fmt.Sprintf("%02d", *filter.Day))

}
Comment on lines 101 to 104
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as month: strftime('%d', date) returns a zero-padded day-of-month string (e.g., "05"). Using strconv.Itoa(*filter.Day) will bind "5" and the day filter won’t match. Use zero-padding again or compare numerically via CAST(strftime('%d', date) AS INTEGER) = ?.

Copilot uses AI. Check for mistakes.

if filter.Type != nil {
Expand Down
5 changes: 3 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"time"
)

Expand Down Expand Up @@ -101,10 +102,10 @@ func (c *Client) GetHolidays(ctx context.Context, year, month *int, holidayType

q := req.URL.Query()
if year != nil {
q.Add("year", fmt.Sprintf("%d", *year))
q.Add("year", strconv.Itoa(*year))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Inconsistent with server expectation - the server's SQLite query expects zero-padded month ("01"-"12") but this sends unpadded ("1"-"12"). This may cause filtering to fail.

Suggested change
q.Add("year", strconv.Itoa(*year))
q.Add("year", fmt.Sprintf("%d", *year))

}
if month != nil {
q.Add("month", fmt.Sprintf("%d", *month))
q.Add("month", strconv.Itoa(*month))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Inconsistent with server expectation - the server's SQLite query expects zero-padded month ("01"-"12") but this sends unpadded ("1"-"12"). This may cause filtering to fail.

Suggested change
q.Add("month", strconv.Itoa(*month))
q.Add("month", fmt.Sprintf("%02d", *month))

}
if holidayType != "" {
q.Add("type", holidayType)
Expand Down
Loading