chore: run go fix for Go 1.26 modernization
CI / Go vulnerabilities (push) Successful in 1m10s
CI / Build & Vet (push) Successful in 1m39s
CI / Frontend build (gate) (push) Successful in 1m42s
CI / Frontend QC (audit) (push) Successful in 56s
CI / Frontend QC (typecheck) (push) Successful in 1m36s
CI / Frontend QC (lint) (push) Successful in 1m51s
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled

106 files: interface{}→any, strings.Split→SplitSeq, CutPrefix/Cut, strings.Builder, slices.Contains, remove redundant // +build directives, gofmt import ordering and indentation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-07-09 17:25:23 +01:00
co-authored by Sisyphus
parent ef26bd59e9
commit 510828c924
107 changed files with 882 additions and 745 deletions
+1 -19
View File
@@ -1,5 +1,4 @@
//go:build test
// +build test
package admin
@@ -32,9 +31,9 @@ import (
"crussell/clock"
"crussell/db"
"crussell/testutils"
"crussell/handlers/bookings"
"crussell/mw"
"crussell/testutils"
"crussell/testutils/fixtures"
"github.com/go-chi/chi/v5"
@@ -2247,7 +2246,6 @@ func TestAdminBookings_Create_WalkIn(t *testing.T) {
}
// Seed working hours so we have a valid booking window
// Try to create booking with walk-in time (30 minutes from now - less than 1h requirement)
// Regular users would be rejected, but admin should succeed
@@ -2291,7 +2289,6 @@ func TestAdminBookings_Create_WalkInWithDeposits(t *testing.T) {
}
// Seed working hours
// Set user to have outstanding deposits
_, err = tx.Exec(ctx, "UPDATE users SET deposits_required = 3 WHERE id = $1", userID)
@@ -2346,7 +2343,6 @@ func TestAdminBookings_Confirm_CompletesWithPayment_ReducesDeposits(t *testing.T
t.Fatalf("failed to create test service: %v", err)
}
// Set user to have deposits_required = 2
_, err = tx.Exec(ctx, "UPDATE users SET deposits_required = 2 WHERE id = $1", userID)
if err != nil {
@@ -2427,7 +2423,6 @@ func TestAdminBookings_Confirm_CompletesWithoutPayment_NoReduction(t *testing.T)
t.Fatalf("failed to create test service: %v", err)
}
// Set user to have deposits_required = 2
_, err = tx.Exec(ctx, "UPDATE users SET deposits_required = 2 WHERE id = $1", userID)
if err != nil {
@@ -2502,7 +2497,6 @@ func TestAdminBookings_Create_EnforceDepositsFalse_BypassesLimit(t *testing.T) {
t.Fatalf("failed to create test service: %v", err)
}
// Set user to have deposits_required = 3
_, err = tx.Exec(ctx, "UPDATE users SET deposits_required = 3 WHERE id = $1", userID)
if err != nil {
@@ -2564,9 +2558,7 @@ func TestAdminBookings_Create_EnforceDepositsFalse_Within24h(t *testing.T) {
t.Fatalf("failed to create test service: %v", err)
}
// Seed working hours
// Set user to have deposits_required = 3
_, err = tx.Exec(ctx, "UPDATE users SET deposits_required = 3 WHERE id = $1", userID)
@@ -2619,7 +2611,6 @@ func TestAdminBookings_Create_WalkInGuestUser(t *testing.T) {
}
// Seed working hours
// Create booking for tomorrow
tomorrow := clock.Now().Add(24 * time.Hour).Truncate(time.Second)
@@ -2661,7 +2652,6 @@ func TestAdminBookings_Create_WalkInGuestUser(t *testing.T) {
func TestGetBookingsByCreatedRange(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -2744,7 +2734,6 @@ func TestGetBookingsByCreatedRange(t *testing.T) {
func TestGetBookingsByCreatedRange_Empty(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -2824,7 +2813,6 @@ func TestGetBookingsByCreatedRange_InvalidFormat(t *testing.T) {
func TestGetBookingsByCreatedRange_OrderedByCreatedAt(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -2912,7 +2900,6 @@ func TestGetBookingsByCreatedRange_OrderedByCreatedAt(t *testing.T) {
func TestGetAdminBooking_WithDiscounts(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
userID, err := fixtures.CreateTestUser(tx)
if err != nil {
@@ -3007,7 +2994,6 @@ func createCompletedBookingWithTimeForAdmin(t *testing.T, ctx context.Context, t
func TestAdminBookings_CreateWithCustomServices(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -3084,7 +3070,6 @@ func TestAdminBookings_CreateWithCustomServices(t *testing.T) {
func TestAdminBookings_CreateWithCustomAndRegularServices(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -3208,7 +3193,6 @@ func TestAdminBookings_Create_CustomServiceValidation(t *testing.T) {
// Test 3: custom_service_ids is provided (should succeed — need working hours)
t.Run("provides custom_service_ids only", func(t *testing.T) {
customServiceID, err := fixtures.CreateTestCustomService(tx)
if err != nil {
@@ -3322,7 +3306,6 @@ func TestAdminBookings_Confirm_WithCustomOverrides(t *testing.T) {
func TestAdminBookings_CreateWithCustomServicesAndOverrides(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
_, err := fixtures.CreateTestAdminUser(tx)
if err != nil {
@@ -3401,7 +3384,6 @@ func TestAdminBookings_CreateWithCustomServicesAndOverrides(t *testing.T) {
func TestAdminBookings_AdminReserve_WithCustomServices(t *testing.T) {
t.Parallel()
ctx, tx := testutils.SetupTestTx(t)
adminID, err := fixtures.CreateTestAdminUser(tx)
if err != nil {