Complete rewrite of Django REST API to Go with: - Gin web framework for HTTP routing - GORM for database operations - GoAdmin for admin panel - Gorush integration for push notifications - Redis for caching and job queues Features implemented: - User authentication (login, register, logout, password reset) - Residence management (CRUD, sharing, share codes) - Task management (CRUD, kanban board, completions) - Contractor management (CRUD, specialties) - Document management (CRUD, warranties) - Notifications (preferences, push notifications) - Subscription management (tiers, limits) Infrastructure: - Docker Compose for local development - Database migrations and seed data - Admin panel for data management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
2.7 KiB
Go
60 lines
2.7 KiB
Go
package requests
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
// CreateResidenceRequest represents the request to create a residence
|
|
type CreateResidenceRequest struct {
|
|
Name string `json:"name" binding:"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"`
|
|
Bedrooms *int `json:"bedrooms"`
|
|
Bathrooms *decimal.Decimal `json:"bathrooms"`
|
|
SquareFootage *int `json:"square_footage"`
|
|
LotSize *decimal.Decimal `json:"lot_size"`
|
|
YearBuilt *int `json:"year_built"`
|
|
Description string `json:"description"`
|
|
PurchaseDate *time.Time `json:"purchase_date"`
|
|
PurchasePrice *decimal.Decimal `json:"purchase_price"`
|
|
IsPrimary *bool `json:"is_primary"`
|
|
}
|
|
|
|
// UpdateResidenceRequest represents the request to update a residence
|
|
type UpdateResidenceRequest struct {
|
|
Name *string `json:"name" binding:"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"`
|
|
Bedrooms *int `json:"bedrooms"`
|
|
Bathrooms *decimal.Decimal `json:"bathrooms"`
|
|
SquareFootage *int `json:"square_footage"`
|
|
LotSize *decimal.Decimal `json:"lot_size"`
|
|
YearBuilt *int `json:"year_built"`
|
|
Description *string `json:"description"`
|
|
PurchaseDate *time.Time `json:"purchase_date"`
|
|
PurchasePrice *decimal.Decimal `json:"purchase_price"`
|
|
IsPrimary *bool `json:"is_primary"`
|
|
}
|
|
|
|
// JoinWithCodeRequest represents the request to join a residence via share code
|
|
type JoinWithCodeRequest struct {
|
|
Code string `json:"code" binding:"required,len=6"`
|
|
}
|
|
|
|
// GenerateShareCodeRequest represents the request to generate a share code
|
|
type GenerateShareCodeRequest struct {
|
|
ExpiresInHours int `json:"expires_in_hours"` // Default: 24 hours
|
|
}
|