chore: add custom_services and booking_custom_services to test DB cleanup lists
Add custom_services and booking_custom_services to testdb dropOrder and TruncateTables lists, and add CreateTestCustomService/DeleteCustomService fixture helpers. Ultraworked with Sisyphus (https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -193,6 +193,28 @@ func DeleteBooking(pool *pgxpool.Pool, bookingID string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateTestCustomService(pool *pgxpool.Pool) (string, error) {
|
||||
ctx := context.Background()
|
||||
var serviceID string
|
||||
err := pool.QueryRow(ctx, `
|
||||
INSERT INTO custom_services (name, description, price, duration_minutes, minimum_age_required)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id
|
||||
`, "Test Custom Service", "A test custom service", 75.00, 45, 16).Scan(&serviceID)
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create custom service: %w", err)
|
||||
}
|
||||
|
||||
return serviceID, nil
|
||||
}
|
||||
|
||||
func DeleteCustomService(pool *pgxpool.Pool, serviceID string) error {
|
||||
ctx := context.Background()
|
||||
_, err := pool.Exec(ctx, "DELETE FROM custom_services WHERE id = $1", serviceID)
|
||||
return err
|
||||
}
|
||||
|
||||
// SafeDeleteUser wraps DeleteUser and returns error (for tests that care about cleanup failure)
|
||||
func SafeDeleteUser(db *pgxpool.Pool, userID string) error {
|
||||
return DeleteUser(db, userID)
|
||||
|
||||
Reference in New Issue
Block a user