Migrate from Gin to Echo framework and add comprehensive integration tests
Major changes: - Migrate all handlers from Gin to Echo framework - Add new apperrors, echohelpers, and validator packages - Update middleware for Echo compatibility - Add ArchivedHandler to task categorization chain (archived tasks go to cancelled_tasks column) - Add 6 new integration tests: - RecurringTaskLifecycle: NextDueDate advancement for weekly/monthly tasks - MultiUserSharing: Complex sharing with user removal - TaskStateTransitions: All state transitions and kanban column changes - DateBoundaryEdgeCases: Threshold boundary testing - CascadeOperations: Residence deletion cascade effects - MultiUserOperations: Shared residence collaboration - Add single-purpose repository functions for kanban columns (GetOverdueTasks, GetDueSoonTasks, etc.) - Fix RemoveUser route param mismatch (userId -> user_id) - Fix determineExpectedColumn helper to correctly prioritize in_progress over overdue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,47 +2,47 @@ package requests
|
||||
|
||||
// LoginRequest represents the login request body
|
||||
type LoginRequest struct {
|
||||
Username string `json:"username" binding:"required_without=Email"`
|
||||
Email string `json:"email" binding:"required_without=Username,omitempty,email"`
|
||||
Password string `json:"password" binding:"required,min=1"`
|
||||
Username string `json:"username" validate:"required_without=Email"`
|
||||
Email string `json:"email" validate:"required_without=Username,omitempty,email"`
|
||||
Password string `json:"password" validate:"required,min=1"`
|
||||
}
|
||||
|
||||
// RegisterRequest represents the registration request body
|
||||
type RegisterRequest struct {
|
||||
Username string `json:"username" binding:"required,min=3,max=150"`
|
||||
Email string `json:"email" binding:"required,email,max=254"`
|
||||
Password string `json:"password" binding:"required,min=8"`
|
||||
FirstName string `json:"first_name" binding:"max=150"`
|
||||
LastName string `json:"last_name" binding:"max=150"`
|
||||
Username string `json:"username" validate:"required,min=3,max=150"`
|
||||
Email string `json:"email" validate:"required,email,max=254"`
|
||||
Password string `json:"password" validate:"required,min=8"`
|
||||
FirstName string `json:"first_name" validate:"max=150"`
|
||||
LastName string `json:"last_name" validate:"max=150"`
|
||||
}
|
||||
|
||||
// VerifyEmailRequest represents the email verification request body
|
||||
type VerifyEmailRequest struct {
|
||||
Code string `json:"code" binding:"required,len=6"`
|
||||
Code string `json:"code" validate:"required,len=6"`
|
||||
}
|
||||
|
||||
// ForgotPasswordRequest represents the forgot password request body
|
||||
type ForgotPasswordRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
}
|
||||
|
||||
// VerifyResetCodeRequest represents the verify reset code request body
|
||||
type VerifyResetCodeRequest struct {
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Code string `json:"code" binding:"required,len=6"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
Code string `json:"code" validate:"required,len=6"`
|
||||
}
|
||||
|
||||
// ResetPasswordRequest represents the reset password request body
|
||||
type ResetPasswordRequest struct {
|
||||
ResetToken string `json:"reset_token" binding:"required"`
|
||||
NewPassword string `json:"new_password" binding:"required,min=8"`
|
||||
ResetToken string `json:"reset_token" validate:"required"`
|
||||
NewPassword string `json:"new_password" validate:"required,min=8"`
|
||||
}
|
||||
|
||||
// UpdateProfileRequest represents the profile update request body
|
||||
type UpdateProfileRequest struct {
|
||||
Email *string `json:"email" binding:"omitempty,email,max=254"`
|
||||
FirstName *string `json:"first_name" binding:"omitempty,max=150"`
|
||||
LastName *string `json:"last_name" binding:"omitempty,max=150"`
|
||||
Email *string `json:"email" validate:"omitempty,email,max=254"`
|
||||
FirstName *string `json:"first_name" validate:"omitempty,max=150"`
|
||||
LastName *string `json:"last_name" validate:"omitempty,max=150"`
|
||||
}
|
||||
|
||||
// ResendVerificationRequest represents the resend verification email request
|
||||
@@ -52,14 +52,14 @@ type ResendVerificationRequest struct {
|
||||
|
||||
// AppleSignInRequest represents the Apple Sign In request body
|
||||
type AppleSignInRequest struct {
|
||||
IDToken string `json:"id_token" binding:"required"`
|
||||
UserID string `json:"user_id" binding:"required"` // Apple's sub claim
|
||||
Email *string `json:"email"` // May be nil or private relay
|
||||
IDToken string `json:"id_token" validate:"required"`
|
||||
UserID string `json:"user_id" validate:"required"` // Apple's sub claim
|
||||
Email *string `json:"email"` // May be nil or private relay
|
||||
FirstName *string `json:"first_name"`
|
||||
LastName *string `json:"last_name"`
|
||||
}
|
||||
|
||||
// GoogleSignInRequest represents the Google Sign In request body
|
||||
type GoogleSignInRequest struct {
|
||||
IDToken string `json:"id_token" binding:"required"` // Google ID token from Credential Manager
|
||||
IDToken string `json:"id_token" validate:"required"` // Google ID token from Credential Manager
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ package requests
|
||||
// CreateContractorRequest represents the request to create a contractor
|
||||
type CreateContractorRequest struct {
|
||||
ResidenceID *uint `json:"residence_id"`
|
||||
Name string `json:"name" binding:"required,min=1,max=200"`
|
||||
Company string `json:"company" binding:"max=200"`
|
||||
Phone string `json:"phone" binding:"max=20"`
|
||||
Email string `json:"email" binding:"omitempty,email,max=254"`
|
||||
Website string `json:"website" binding:"max=200"`
|
||||
Name string `json:"name" validate:"required,min=1,max=200"`
|
||||
Company string `json:"company" validate:"max=200"`
|
||||
Phone string `json:"phone" validate:"max=20"`
|
||||
Email string `json:"email" validate:"omitempty,email,max=254"`
|
||||
Website string `json:"website" validate:"max=200"`
|
||||
Notes string `json:"notes"`
|
||||
StreetAddress string `json:"street_address" binding:"max=255"`
|
||||
City string `json:"city" binding:"max=100"`
|
||||
StateProvince string `json:"state_province" binding:"max=100"`
|
||||
PostalCode string `json:"postal_code" binding:"max=20"`
|
||||
StreetAddress string `json:"street_address" validate:"max=255"`
|
||||
City string `json:"city" validate:"max=100"`
|
||||
StateProvince string `json:"state_province" validate:"max=100"`
|
||||
PostalCode string `json:"postal_code" validate:"max=20"`
|
||||
SpecialtyIDs []uint `json:"specialty_ids"`
|
||||
Rating *float64 `json:"rating"`
|
||||
IsFavorite *bool `json:"is_favorite"`
|
||||
@@ -20,16 +20,16 @@ type CreateContractorRequest struct {
|
||||
|
||||
// UpdateContractorRequest represents the request to update a contractor
|
||||
type UpdateContractorRequest struct {
|
||||
Name *string `json:"name" binding:"omitempty,min=1,max=200"`
|
||||
Company *string `json:"company" binding:"omitempty,max=200"`
|
||||
Phone *string `json:"phone" binding:"omitempty,max=20"`
|
||||
Email *string `json:"email" binding:"omitempty,email,max=254"`
|
||||
Website *string `json:"website" binding:"omitempty,max=200"`
|
||||
Name *string `json:"name" validate:"omitempty,min=1,max=200"`
|
||||
Company *string `json:"company" validate:"omitempty,max=200"`
|
||||
Phone *string `json:"phone" validate:"omitempty,max=20"`
|
||||
Email *string `json:"email" validate:"omitempty,email,max=254"`
|
||||
Website *string `json:"website" validate:"omitempty,max=200"`
|
||||
Notes *string `json:"notes"`
|
||||
StreetAddress *string `json:"street_address" binding:"omitempty,max=255"`
|
||||
City *string `json:"city" binding:"omitempty,max=100"`
|
||||
StateProvince *string `json:"state_province" binding:"omitempty,max=100"`
|
||||
PostalCode *string `json:"postal_code" binding:"omitempty,max=20"`
|
||||
StreetAddress *string `json:"street_address" validate:"omitempty,max=255"`
|
||||
City *string `json:"city" validate:"omitempty,max=100"`
|
||||
StateProvince *string `json:"state_province" validate:"omitempty,max=100"`
|
||||
PostalCode *string `json:"postal_code" validate:"omitempty,max=20"`
|
||||
SpecialtyIDs []uint `json:"specialty_ids"`
|
||||
Rating *float64 `json:"rating"`
|
||||
IsFavorite *bool `json:"is_favorite"`
|
||||
|
||||
@@ -10,38 +10,38 @@ import (
|
||||
|
||||
// CreateDocumentRequest represents the request to create a document
|
||||
type CreateDocumentRequest struct {
|
||||
ResidenceID uint `json:"residence_id" binding:"required"`
|
||||
Title string `json:"title" binding:"required,min=1,max=200"`
|
||||
ResidenceID uint `json:"residence_id" validate:"required"`
|
||||
Title string `json:"title" validate:"required,min=1,max=200"`
|
||||
Description string `json:"description"`
|
||||
DocumentType models.DocumentType `json:"document_type"`
|
||||
FileURL string `json:"file_url" binding:"max=500"`
|
||||
FileName string `json:"file_name" binding:"max=255"`
|
||||
FileURL string `json:"file_url" validate:"max=500"`
|
||||
FileName string `json:"file_name" validate:"max=255"`
|
||||
FileSize *int64 `json:"file_size"`
|
||||
MimeType string `json:"mime_type" binding:"max=100"`
|
||||
MimeType string `json:"mime_type" validate:"max=100"`
|
||||
PurchaseDate *time.Time `json:"purchase_date"`
|
||||
ExpiryDate *time.Time `json:"expiry_date"`
|
||||
PurchasePrice *decimal.Decimal `json:"purchase_price"`
|
||||
Vendor string `json:"vendor" binding:"max=200"`
|
||||
SerialNumber string `json:"serial_number" binding:"max=100"`
|
||||
ModelNumber string `json:"model_number" binding:"max=100"`
|
||||
Vendor string `json:"vendor" validate:"max=200"`
|
||||
SerialNumber string `json:"serial_number" validate:"max=100"`
|
||||
ModelNumber string `json:"model_number" validate:"max=100"`
|
||||
TaskID *uint `json:"task_id"`
|
||||
ImageURLs []string `json:"image_urls"` // Multiple image URLs
|
||||
}
|
||||
|
||||
// UpdateDocumentRequest represents the request to update a document
|
||||
type UpdateDocumentRequest struct {
|
||||
Title *string `json:"title" binding:"omitempty,min=1,max=200"`
|
||||
Title *string `json:"title" validate:"omitempty,min=1,max=200"`
|
||||
Description *string `json:"description"`
|
||||
DocumentType *models.DocumentType `json:"document_type"`
|
||||
FileURL *string `json:"file_url" binding:"omitempty,max=500"`
|
||||
FileName *string `json:"file_name" binding:"omitempty,max=255"`
|
||||
FileURL *string `json:"file_url" validate:"omitempty,max=500"`
|
||||
FileName *string `json:"file_name" validate:"omitempty,max=255"`
|
||||
FileSize *int64 `json:"file_size"`
|
||||
MimeType *string `json:"mime_type" binding:"omitempty,max=100"`
|
||||
MimeType *string `json:"mime_type" validate:"omitempty,max=100"`
|
||||
PurchaseDate *time.Time `json:"purchase_date"`
|
||||
ExpiryDate *time.Time `json:"expiry_date"`
|
||||
PurchasePrice *decimal.Decimal `json:"purchase_price"`
|
||||
Vendor *string `json:"vendor" binding:"omitempty,max=200"`
|
||||
SerialNumber *string `json:"serial_number" binding:"omitempty,max=100"`
|
||||
ModelNumber *string `json:"model_number" binding:"omitempty,max=100"`
|
||||
Vendor *string `json:"vendor" validate:"omitempty,max=200"`
|
||||
SerialNumber *string `json:"serial_number" validate:"omitempty,max=100"`
|
||||
ModelNumber *string `json:"model_number" validate:"omitempty,max=100"`
|
||||
TaskID *uint `json:"task_id"`
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
|
||||
// CreateResidenceRequest represents the request to create a residence
|
||||
type CreateResidenceRequest struct {
|
||||
Name string `json:"name" binding:"required,min=1,max=200"`
|
||||
Name string `json:"name" validate:"required,min=1,max=200"`
|
||||
PropertyTypeID *uint `json:"property_type_id"`
|
||||
StreetAddress string `json:"street_address" binding:"max=255"`
|
||||
ApartmentUnit string `json:"apartment_unit" binding:"max=50"`
|
||||
City string `json:"city" binding:"max=100"`
|
||||
StateProvince string `json:"state_province" binding:"max=100"`
|
||||
PostalCode string `json:"postal_code" binding:"max=20"`
|
||||
Country string `json:"country" binding:"max=100"`
|
||||
StreetAddress string `json:"street_address" validate:"max=255"`
|
||||
ApartmentUnit string `json:"apartment_unit" validate:"max=50"`
|
||||
City string `json:"city" validate:"max=100"`
|
||||
StateProvince string `json:"state_province" validate:"max=100"`
|
||||
PostalCode string `json:"postal_code" validate:"max=20"`
|
||||
Country string `json:"country" validate:"max=100"`
|
||||
Bedrooms *int `json:"bedrooms"`
|
||||
Bathrooms *decimal.Decimal `json:"bathrooms"`
|
||||
SquareFootage *int `json:"square_footage"`
|
||||
@@ -29,14 +29,14 @@ type CreateResidenceRequest struct {
|
||||
|
||||
// UpdateResidenceRequest represents the request to update a residence
|
||||
type UpdateResidenceRequest struct {
|
||||
Name *string `json:"name" binding:"omitempty,min=1,max=200"`
|
||||
Name *string `json:"name" validate:"omitempty,min=1,max=200"`
|
||||
PropertyTypeID *uint `json:"property_type_id"`
|
||||
StreetAddress *string `json:"street_address" binding:"omitempty,max=255"`
|
||||
ApartmentUnit *string `json:"apartment_unit" binding:"omitempty,max=50"`
|
||||
City *string `json:"city" binding:"omitempty,max=100"`
|
||||
StateProvince *string `json:"state_province" binding:"omitempty,max=100"`
|
||||
PostalCode *string `json:"postal_code" binding:"omitempty,max=20"`
|
||||
Country *string `json:"country" binding:"omitempty,max=100"`
|
||||
StreetAddress *string `json:"street_address" validate:"omitempty,max=255"`
|
||||
ApartmentUnit *string `json:"apartment_unit" validate:"omitempty,max=50"`
|
||||
City *string `json:"city" validate:"omitempty,max=100"`
|
||||
StateProvince *string `json:"state_province" validate:"omitempty,max=100"`
|
||||
PostalCode *string `json:"postal_code" validate:"omitempty,max=20"`
|
||||
Country *string `json:"country" validate:"omitempty,max=100"`
|
||||
Bedrooms *int `json:"bedrooms"`
|
||||
Bathrooms *decimal.Decimal `json:"bathrooms"`
|
||||
SquareFootage *int `json:"square_footage"`
|
||||
@@ -50,7 +50,7 @@ type UpdateResidenceRequest struct {
|
||||
|
||||
// JoinWithCodeRequest represents the request to join a residence via share code
|
||||
type JoinWithCodeRequest struct {
|
||||
Code string `json:"code" binding:"required,len=6"`
|
||||
Code string `json:"code" validate:"required,len=6"`
|
||||
}
|
||||
|
||||
// GenerateShareCodeRequest represents the request to generate a share code
|
||||
|
||||
@@ -54,8 +54,8 @@ func (fd *FlexibleDate) ToTimePtr() *time.Time {
|
||||
|
||||
// CreateTaskRequest represents the request to create a task
|
||||
type CreateTaskRequest struct {
|
||||
ResidenceID uint `json:"residence_id" binding:"required"`
|
||||
Title string `json:"title" binding:"required,min=1,max=200"`
|
||||
ResidenceID uint `json:"residence_id" validate:"required"`
|
||||
Title string `json:"title" validate:"required,min=1,max=200"`
|
||||
Description string `json:"description"`
|
||||
CategoryID *uint `json:"category_id"`
|
||||
PriorityID *uint `json:"priority_id"`
|
||||
@@ -70,7 +70,7 @@ type CreateTaskRequest struct {
|
||||
|
||||
// UpdateTaskRequest represents the request to update a task
|
||||
type UpdateTaskRequest struct {
|
||||
Title *string `json:"title" binding:"omitempty,min=1,max=200"`
|
||||
Title *string `json:"title" validate:"omitempty,min=1,max=200"`
|
||||
Description *string `json:"description"`
|
||||
CategoryID *uint `json:"category_id"`
|
||||
PriorityID *uint `json:"priority_id"`
|
||||
@@ -86,7 +86,7 @@ type UpdateTaskRequest struct {
|
||||
|
||||
// CreateTaskCompletionRequest represents the request to create a task completion
|
||||
type CreateTaskCompletionRequest struct {
|
||||
TaskID uint `json:"task_id" binding:"required"`
|
||||
TaskID uint `json:"task_id" validate:"required"`
|
||||
CompletedAt *time.Time `json:"completed_at"` // Defaults to now
|
||||
Notes string `json:"notes"`
|
||||
ActualCost *decimal.Decimal `json:"actual_cost"`
|
||||
@@ -96,6 +96,6 @@ type CreateTaskCompletionRequest struct {
|
||||
|
||||
// CompletionImageInput represents an image to add to a completion
|
||||
type CompletionImageInput struct {
|
||||
ImageURL string `json:"image_url" binding:"required"`
|
||||
ImageURL string `json:"image_url" validate:"required"`
|
||||
Caption string `json:"caption"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user