diff --git a/bruno-collections/casera-api/Authentication/Apple Sign In.bru b/bruno-collections/casera-api/Authentication/Apple Sign In.bru new file mode 100644 index 0000000..e8b4141 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Apple Sign In.bru @@ -0,0 +1,20 @@ +meta { + name: Apple Sign In + type: http + seq: 11 +} + +post { + url: {{api_url}}/auth/apple-sign-in/ + body: json + auth: none +} + +body:json { + { + "identity_token": "eyJhbG...", + "authorization_code": "code...", + "first_name": "John", + "last_name": "Doe" + } +} diff --git a/bruno-collections/casera-api/Authentication/Current User.bru b/bruno-collections/casera-api/Authentication/Current User.bru new file mode 100644 index 0000000..b446036 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Current User.bru @@ -0,0 +1,15 @@ +meta { + name: Current User + type: http + seq: 4 +} + +get { + url: {{api_url}}/auth/me/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Authentication/Forgot Password.bru b/bruno-collections/casera-api/Authentication/Forgot Password.bru new file mode 100644 index 0000000..8951af1 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Forgot Password.bru @@ -0,0 +1,17 @@ +meta { + name: Forgot Password + type: http + seq: 6 +} + +post { + url: {{api_url}}/auth/forgot-password/ + body: json + auth: none +} + +body:json { + { + "email": "user@example.com" + } +} diff --git a/bruno-collections/casera-api/Authentication/Login.bru b/bruno-collections/casera-api/Authentication/Login.bru new file mode 100644 index 0000000..0859cfe --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Login.bru @@ -0,0 +1,18 @@ +meta { + name: Login + type: http + seq: 1 +} + +post { + url: {{api_url}}/auth/login/ + body: json + auth: none +} + +body:json { + { + "username": "apple", + "password": "password123" + } +} diff --git a/bruno-collections/casera-api/Authentication/Logout.bru b/bruno-collections/casera-api/Authentication/Logout.bru new file mode 100644 index 0000000..88ecfa1 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Logout.bru @@ -0,0 +1,15 @@ +meta { + name: Logout + type: http + seq: 3 +} + +post { + url: {{api_url}}/auth/logout/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Authentication/Register.bru b/bruno-collections/casera-api/Authentication/Register.bru new file mode 100644 index 0000000..c9ea498 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Register.bru @@ -0,0 +1,19 @@ +meta { + name: Register + type: http + seq: 2 +} + +post { + url: {{api_url}}/auth/register/ + body: json + auth: none +} + +body:json { + { + "username": "newuser", + "email": "newuser@example.com", + "password": "securepassword123" + } +} diff --git a/bruno-collections/casera-api/Authentication/Resend Verification.bru b/bruno-collections/casera-api/Authentication/Resend Verification.bru new file mode 100644 index 0000000..9570347 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Resend Verification.bru @@ -0,0 +1,15 @@ +meta { + name: Resend Verification + type: http + seq: 10 +} + +post { + url: {{api_url}}/auth/resend-verification/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Authentication/Reset Password.bru b/bruno-collections/casera-api/Authentication/Reset Password.bru new file mode 100644 index 0000000..7a2ea7b --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Reset Password.bru @@ -0,0 +1,19 @@ +meta { + name: Reset Password + type: http + seq: 8 +} + +post { + url: {{api_url}}/auth/reset-password/ + body: json + auth: none +} + +body:json { + { + "email": "user@example.com", + "code": "123456", + "new_password": "newSecurePassword123" + } +} diff --git a/bruno-collections/casera-api/Authentication/Update Profile.bru b/bruno-collections/casera-api/Authentication/Update Profile.bru new file mode 100644 index 0000000..e661b12 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Update Profile.bru @@ -0,0 +1,23 @@ +meta { + name: Update Profile + type: http + seq: 5 +} + +put { + url: {{api_url}}/auth/profile/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "first_name": "John", + "last_name": "Doe", + "phone_number": "+1234567890" + } +} diff --git a/bruno-collections/casera-api/Authentication/Verify Email.bru b/bruno-collections/casera-api/Authentication/Verify Email.bru new file mode 100644 index 0000000..5e32565 --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Verify Email.bru @@ -0,0 +1,21 @@ +meta { + name: Verify Email + type: http + seq: 9 +} + +post { + url: {{api_url}}/auth/verify-email/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "code": "123456" + } +} diff --git a/bruno-collections/casera-api/Authentication/Verify Reset Code.bru b/bruno-collections/casera-api/Authentication/Verify Reset Code.bru new file mode 100644 index 0000000..804c63c --- /dev/null +++ b/bruno-collections/casera-api/Authentication/Verify Reset Code.bru @@ -0,0 +1,18 @@ +meta { + name: Verify Reset Code + type: http + seq: 7 +} + +post { + url: {{api_url}}/auth/verify-reset-code/ + body: json + auth: none +} + +body:json { + { + "email": "user@example.com", + "code": "123456" + } +} diff --git a/bruno-collections/casera-api/Contractors/By Residence.bru b/bruno-collections/casera-api/Contractors/By Residence.bru new file mode 100644 index 0000000..f22fccb --- /dev/null +++ b/bruno-collections/casera-api/Contractors/By Residence.bru @@ -0,0 +1,19 @@ +meta { + name: By Residence + type: http + seq: 6 +} + +get { + url: {{api_url}}/contractors/by-residence/:residence_id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + residence_id: 1 +} diff --git a/bruno-collections/casera-api/Contractors/Create Contractor.bru b/bruno-collections/casera-api/Contractors/Create Contractor.bru new file mode 100644 index 0000000..e610f0c --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Create Contractor.bru @@ -0,0 +1,28 @@ +meta { + name: Create Contractor + type: http + seq: 2 +} + +post { + url: {{api_url}}/contractors/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "name": "John's Plumbing", + "company": "John's Plumbing Co", + "phone": "555-123-4567", + "email": "john@plumbing.com", + "address": "123 Main St", + "notes": "Available weekends", + "specialty_ids": [1, 2], + "residence_ids": [1] + } +} diff --git a/bruno-collections/casera-api/Contractors/Delete Contractor.bru b/bruno-collections/casera-api/Contractors/Delete Contractor.bru new file mode 100644 index 0000000..dadaa7f --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Delete Contractor.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Contractor + type: http + seq: 5 +} + +delete { + url: {{api_url}}/contractors/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Contractors/Get Contractor Tasks.bru b/bruno-collections/casera-api/Contractors/Get Contractor Tasks.bru new file mode 100644 index 0000000..6f6e67f --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Get Contractor Tasks.bru @@ -0,0 +1,19 @@ +meta { + name: Get Contractor Tasks + type: http + seq: 8 +} + +get { + url: {{api_url}}/contractors/:id/tasks/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Contractors/Get Contractor.bru b/bruno-collections/casera-api/Contractors/Get Contractor.bru new file mode 100644 index 0000000..f71f7cb --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Get Contractor.bru @@ -0,0 +1,19 @@ +meta { + name: Get Contractor + type: http + seq: 3 +} + +get { + url: {{api_url}}/contractors/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Contractors/List Contractors.bru b/bruno-collections/casera-api/Contractors/List Contractors.bru new file mode 100644 index 0000000..30fdf4c --- /dev/null +++ b/bruno-collections/casera-api/Contractors/List Contractors.bru @@ -0,0 +1,15 @@ +meta { + name: List Contractors + type: http + seq: 1 +} + +get { + url: {{api_url}}/contractors/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Contractors/Toggle Favorite.bru b/bruno-collections/casera-api/Contractors/Toggle Favorite.bru new file mode 100644 index 0000000..f951480 --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Toggle Favorite.bru @@ -0,0 +1,19 @@ +meta { + name: Toggle Favorite + type: http + seq: 7 +} + +post { + url: {{api_url}}/contractors/:id/toggle-favorite/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Contractors/Update Contractor.bru b/bruno-collections/casera-api/Contractors/Update Contractor.bru new file mode 100644 index 0000000..3070f43 --- /dev/null +++ b/bruno-collections/casera-api/Contractors/Update Contractor.bru @@ -0,0 +1,32 @@ +meta { + name: Update Contractor + type: http + seq: 4 +} + +put { + url: {{api_url}}/contractors/:id/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} + +body:json { + { + "name": "John's Plumbing Updated", + "company": "John's Plumbing Co LLC", + "phone": "555-123-4567", + "email": "john@plumbing.com", + "address": "456 Oak Ave", + "notes": "Available weekends and evenings", + "specialty_ids": [1, 2, 3], + "residence_ids": [1, 2] + } +} diff --git a/bruno-collections/casera-api/Documents/Activate Document.bru b/bruno-collections/casera-api/Documents/Activate Document.bru new file mode 100644 index 0000000..e9850d8 --- /dev/null +++ b/bruno-collections/casera-api/Documents/Activate Document.bru @@ -0,0 +1,19 @@ +meta { + name: Activate Document + type: http + seq: 7 +} + +post { + url: {{api_url}}/documents/:id/activate/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Documents/Create Document.bru b/bruno-collections/casera-api/Documents/Create Document.bru new file mode 100644 index 0000000..5f07ecb --- /dev/null +++ b/bruno-collections/casera-api/Documents/Create Document.bru @@ -0,0 +1,25 @@ +meta { + name: Create Document + type: http + seq: 2 +} + +post { + url: {{api_url}}/documents/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "name": "Home Insurance Policy", + "description": "Annual home insurance policy document", + "file_url": "https://example.com/documents/policy.pdf", + "residence_id": 1, + "is_warranty": false + } +} diff --git a/bruno-collections/casera-api/Documents/Deactivate Document.bru b/bruno-collections/casera-api/Documents/Deactivate Document.bru new file mode 100644 index 0000000..31d94d0 --- /dev/null +++ b/bruno-collections/casera-api/Documents/Deactivate Document.bru @@ -0,0 +1,19 @@ +meta { + name: Deactivate Document + type: http + seq: 8 +} + +post { + url: {{api_url}}/documents/:id/deactivate/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Documents/Delete Document.bru b/bruno-collections/casera-api/Documents/Delete Document.bru new file mode 100644 index 0000000..cb3adf8 --- /dev/null +++ b/bruno-collections/casera-api/Documents/Delete Document.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Document + type: http + seq: 5 +} + +delete { + url: {{api_url}}/documents/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Documents/Get Document.bru b/bruno-collections/casera-api/Documents/Get Document.bru new file mode 100644 index 0000000..f56924c --- /dev/null +++ b/bruno-collections/casera-api/Documents/Get Document.bru @@ -0,0 +1,19 @@ +meta { + name: Get Document + type: http + seq: 3 +} + +get { + url: {{api_url}}/documents/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Documents/List Documents.bru b/bruno-collections/casera-api/Documents/List Documents.bru new file mode 100644 index 0000000..179e49f --- /dev/null +++ b/bruno-collections/casera-api/Documents/List Documents.bru @@ -0,0 +1,15 @@ +meta { + name: List Documents + type: http + seq: 1 +} + +get { + url: {{api_url}}/documents/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Documents/List Warranties.bru b/bruno-collections/casera-api/Documents/List Warranties.bru new file mode 100644 index 0000000..8866935 --- /dev/null +++ b/bruno-collections/casera-api/Documents/List Warranties.bru @@ -0,0 +1,15 @@ +meta { + name: List Warranties + type: http + seq: 6 +} + +get { + url: {{api_url}}/documents/warranties/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Documents/Update Document.bru b/bruno-collections/casera-api/Documents/Update Document.bru new file mode 100644 index 0000000..69064af --- /dev/null +++ b/bruno-collections/casera-api/Documents/Update Document.bru @@ -0,0 +1,29 @@ +meta { + name: Update Document + type: http + seq: 4 +} + +put { + url: {{api_url}}/documents/:id/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} + +body:json { + { + "name": "Home Insurance Policy 2024", + "description": "Updated annual home insurance policy", + "file_url": "https://example.com/documents/policy-2024.pdf", + "residence_id": 1, + "is_warranty": false + } +} diff --git a/bruno-collections/casera-api/Health Check.bru b/bruno-collections/casera-api/Health Check.bru new file mode 100644 index 0000000..907860c --- /dev/null +++ b/bruno-collections/casera-api/Health Check.bru @@ -0,0 +1,11 @@ +meta { + name: Health Check + type: http + seq: 1 +} + +get { + url: {{api_url}}/health/ + body: none + auth: none +} diff --git a/bruno-collections/casera-api/Lookups/Contractor Specialties.bru b/bruno-collections/casera-api/Lookups/Contractor Specialties.bru new file mode 100644 index 0000000..ce109a5 --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Contractor Specialties.bru @@ -0,0 +1,15 @@ +meta { + name: Contractor Specialties + type: http + seq: 6 +} + +get { + url: {{api_url}}/lookups/contractor-specialties/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Residence Types.bru b/bruno-collections/casera-api/Lookups/Residence Types.bru new file mode 100644 index 0000000..0d68e49 --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Residence Types.bru @@ -0,0 +1,15 @@ +meta { + name: Residence Types + type: http + seq: 1 +} + +get { + url: {{api_url}}/lookups/residence-types/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Static Data.bru b/bruno-collections/casera-api/Lookups/Static Data.bru new file mode 100644 index 0000000..8ee1a37 --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Static Data.bru @@ -0,0 +1,15 @@ +meta { + name: Static Data + type: http + seq: 7 +} + +get { + url: {{api_url}}/lookups/static-data/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Task Categories.bru b/bruno-collections/casera-api/Lookups/Task Categories.bru new file mode 100644 index 0000000..62e734e --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Task Categories.bru @@ -0,0 +1,15 @@ +meta { + name: Task Categories + type: http + seq: 2 +} + +get { + url: {{api_url}}/lookups/task-categories/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Task Frequencies.bru b/bruno-collections/casera-api/Lookups/Task Frequencies.bru new file mode 100644 index 0000000..e54cb56 --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Task Frequencies.bru @@ -0,0 +1,15 @@ +meta { + name: Task Frequencies + type: http + seq: 4 +} + +get { + url: {{api_url}}/lookups/task-frequencies/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Task Priorities.bru b/bruno-collections/casera-api/Lookups/Task Priorities.bru new file mode 100644 index 0000000..dd3e11c --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Task Priorities.bru @@ -0,0 +1,15 @@ +meta { + name: Task Priorities + type: http + seq: 3 +} + +get { + url: {{api_url}}/lookups/task-priorities/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Lookups/Task Statuses.bru b/bruno-collections/casera-api/Lookups/Task Statuses.bru new file mode 100644 index 0000000..6b20eeb --- /dev/null +++ b/bruno-collections/casera-api/Lookups/Task Statuses.bru @@ -0,0 +1,15 @@ +meta { + name: Task Statuses + type: http + seq: 5 +} + +get { + url: {{api_url}}/lookups/task-statuses/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/Delete Device.bru b/bruno-collections/casera-api/Notifications/Delete Device.bru new file mode 100644 index 0000000..57fec92 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Delete Device.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Device + type: http + seq: 7 +} + +delete { + url: {{api_url}}/notifications/devices/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Notifications/Get Preferences.bru b/bruno-collections/casera-api/Notifications/Get Preferences.bru new file mode 100644 index 0000000..5139821 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Get Preferences.bru @@ -0,0 +1,15 @@ +meta { + name: Get Preferences + type: http + seq: 8 +} + +get { + url: {{api_url}}/notifications/preferences/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/List Devices.bru b/bruno-collections/casera-api/Notifications/List Devices.bru new file mode 100644 index 0000000..91763c7 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/List Devices.bru @@ -0,0 +1,15 @@ +meta { + name: List Devices + type: http + seq: 6 +} + +get { + url: {{api_url}}/notifications/devices/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/List Notifications.bru b/bruno-collections/casera-api/Notifications/List Notifications.bru new file mode 100644 index 0000000..42eb543 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/List Notifications.bru @@ -0,0 +1,15 @@ +meta { + name: List Notifications + type: http + seq: 1 +} + +get { + url: {{api_url}}/notifications/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/Mark All Read.bru b/bruno-collections/casera-api/Notifications/Mark All Read.bru new file mode 100644 index 0000000..ecf3a95 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Mark All Read.bru @@ -0,0 +1,15 @@ +meta { + name: Mark All Read + type: http + seq: 3 +} + +post { + url: {{api_url}}/notifications/mark-all-read/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/Mark Read.bru b/bruno-collections/casera-api/Notifications/Mark Read.bru new file mode 100644 index 0000000..9da1a50 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Mark Read.bru @@ -0,0 +1,19 @@ +meta { + name: Mark Read + type: http + seq: 4 +} + +post { + url: {{api_url}}/notifications/:id/mark-read/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Notifications/Register Device.bru b/bruno-collections/casera-api/Notifications/Register Device.bru new file mode 100644 index 0000000..62dcb25 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Register Device.bru @@ -0,0 +1,23 @@ +meta { + name: Register Device + type: http + seq: 5 +} + +post { + url: {{api_url}}/notifications/devices/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "device_token": "abc123devicetoken", + "platform": "ios", + "device_name": "iPhone 15 Pro" + } +} diff --git a/bruno-collections/casera-api/Notifications/Unread Count.bru b/bruno-collections/casera-api/Notifications/Unread Count.bru new file mode 100644 index 0000000..39be239 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Unread Count.bru @@ -0,0 +1,15 @@ +meta { + name: Unread Count + type: http + seq: 2 +} + +get { + url: {{api_url}}/notifications/unread-count/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Notifications/Update Preferences.bru b/bruno-collections/casera-api/Notifications/Update Preferences.bru new file mode 100644 index 0000000..e53b9a3 --- /dev/null +++ b/bruno-collections/casera-api/Notifications/Update Preferences.bru @@ -0,0 +1,26 @@ +meta { + name: Update Preferences + type: http + seq: 9 +} + +put { + url: {{api_url}}/notifications/preferences/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "task_reminders": true, + "task_due_soon": true, + "task_overdue": true, + "task_completed": true, + "residence_shared": true, + "marketing": false + } +} diff --git a/bruno-collections/casera-api/Residences/Create Residence.bru b/bruno-collections/casera-api/Residences/Create Residence.bru new file mode 100644 index 0000000..a50398d --- /dev/null +++ b/bruno-collections/casera-api/Residences/Create Residence.bru @@ -0,0 +1,31 @@ +meta { + name: Create Residence + type: http + seq: 2 +} + +post { + url: {{api_url}}/residences/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "name": "My Home", + "property_type_id": 1, + "street_address": "123 Main St", + "city": "San Francisco", + "state_province": "CA", + "postal_code": "94102", + "country": "USA", + "bedrooms": 3, + "bathrooms": 2.5, + "square_footage": 2000, + "year_built": 2015 + } +} diff --git a/bruno-collections/casera-api/Residences/Delete Residence.bru b/bruno-collections/casera-api/Residences/Delete Residence.bru new file mode 100644 index 0000000..a77670e --- /dev/null +++ b/bruno-collections/casera-api/Residences/Delete Residence.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Residence + type: http + seq: 5 +} + +delete { + url: {{api_url}}/residences/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Residences/Generate Share Code.bru b/bruno-collections/casera-api/Residences/Generate Share Code.bru new file mode 100644 index 0000000..14afa85 --- /dev/null +++ b/bruno-collections/casera-api/Residences/Generate Share Code.bru @@ -0,0 +1,19 @@ +meta { + name: Generate Share Code + type: http + seq: 8 +} + +post { + url: {{api_url}}/residences/:id/generate-share-code/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Residences/Generate Tasks Report.bru b/bruno-collections/casera-api/Residences/Generate Tasks Report.bru new file mode 100644 index 0000000..d29c086 --- /dev/null +++ b/bruno-collections/casera-api/Residences/Generate Tasks Report.bru @@ -0,0 +1,25 @@ +meta { + name: Generate Tasks Report + type: http + seq: 9 +} + +post { + url: {{api_url}}/residences/:id/generate-tasks-report/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} + +body:json { + { + "email": "recipient@example.com" + } +} diff --git a/bruno-collections/casera-api/Residences/Get Residence Users.bru b/bruno-collections/casera-api/Residences/Get Residence Users.bru new file mode 100644 index 0000000..1e23459 --- /dev/null +++ b/bruno-collections/casera-api/Residences/Get Residence Users.bru @@ -0,0 +1,19 @@ +meta { + name: Get Residence Users + type: http + seq: 10 +} + +get { + url: {{api_url}}/residences/:id/users/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Residences/Get Residence.bru b/bruno-collections/casera-api/Residences/Get Residence.bru new file mode 100644 index 0000000..7323f0d --- /dev/null +++ b/bruno-collections/casera-api/Residences/Get Residence.bru @@ -0,0 +1,19 @@ +meta { + name: Get Residence + type: http + seq: 3 +} + +get { + url: {{api_url}}/residences/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Residences/Join With Code.bru b/bruno-collections/casera-api/Residences/Join With Code.bru new file mode 100644 index 0000000..7ac28ec --- /dev/null +++ b/bruno-collections/casera-api/Residences/Join With Code.bru @@ -0,0 +1,21 @@ +meta { + name: Join With Code + type: http + seq: 7 +} + +post { + url: {{api_url}}/residences/join-with-code/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "code": "ABC123" + } +} diff --git a/bruno-collections/casera-api/Residences/List Residences.bru b/bruno-collections/casera-api/Residences/List Residences.bru new file mode 100644 index 0000000..fe8f7ab --- /dev/null +++ b/bruno-collections/casera-api/Residences/List Residences.bru @@ -0,0 +1,15 @@ +meta { + name: List Residences + type: http + seq: 1 +} + +get { + url: {{api_url}}/residences/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Residences/My Residences.bru b/bruno-collections/casera-api/Residences/My Residences.bru new file mode 100644 index 0000000..326ab77 --- /dev/null +++ b/bruno-collections/casera-api/Residences/My Residences.bru @@ -0,0 +1,15 @@ +meta { + name: My Residences + type: http + seq: 6 +} + +get { + url: {{api_url}}/residences/my-residences/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Residences/Remove Residence User.bru b/bruno-collections/casera-api/Residences/Remove Residence User.bru new file mode 100644 index 0000000..ff066d5 --- /dev/null +++ b/bruno-collections/casera-api/Residences/Remove Residence User.bru @@ -0,0 +1,20 @@ +meta { + name: Remove Residence User + type: http + seq: 11 +} + +delete { + url: {{api_url}}/residences/:id/users/:user_id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 + user_id: 2 +} diff --git a/bruno-collections/casera-api/Residences/Update Residence.bru b/bruno-collections/casera-api/Residences/Update Residence.bru new file mode 100644 index 0000000..4120658 --- /dev/null +++ b/bruno-collections/casera-api/Residences/Update Residence.bru @@ -0,0 +1,31 @@ +meta { + name: Update Residence + type: http + seq: 4 +} + +put { + url: {{api_url}}/residences/:id/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} + +body:json { + { + "name": "My Updated Home", + "property_type_id": 1, + "street_address": "123 Main St", + "city": "San Francisco", + "state_province": "CA", + "postal_code": "94102", + "country": "USA" + } +} diff --git a/bruno-collections/casera-api/Subscription/Cancel.bru b/bruno-collections/casera-api/Subscription/Cancel.bru new file mode 100644 index 0000000..9e14bec --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Cancel.bru @@ -0,0 +1,15 @@ +meta { + name: Cancel + type: http + seq: 8 +} + +post { + url: {{api_url}}/subscription/cancel/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Subscription/Features.bru b/bruno-collections/casera-api/Subscription/Features.bru new file mode 100644 index 0000000..923930f --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Features.bru @@ -0,0 +1,15 @@ +meta { + name: Features + type: http + seq: 5 +} + +get { + url: {{api_url}}/subscription/features/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Subscription/Get Subscription.bru b/bruno-collections/casera-api/Subscription/Get Subscription.bru new file mode 100644 index 0000000..1141df9 --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Get Subscription.bru @@ -0,0 +1,15 @@ +meta { + name: Get Subscription + type: http + seq: 1 +} + +get { + url: {{api_url}}/subscription/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Subscription/Promotions.bru b/bruno-collections/casera-api/Subscription/Promotions.bru new file mode 100644 index 0000000..a7d51d9 --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Promotions.bru @@ -0,0 +1,15 @@ +meta { + name: Promotions + type: http + seq: 6 +} + +get { + url: {{api_url}}/subscription/promotions/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Subscription/Purchase.bru b/bruno-collections/casera-api/Subscription/Purchase.bru new file mode 100644 index 0000000..10042e7 --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Purchase.bru @@ -0,0 +1,22 @@ +meta { + name: Purchase + type: http + seq: 7 +} + +post { + url: {{api_url}}/subscription/purchase/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "receipt": "base64_encoded_receipt_data", + "platform": "ios" + } +} diff --git a/bruno-collections/casera-api/Subscription/Restore.bru b/bruno-collections/casera-api/Subscription/Restore.bru new file mode 100644 index 0000000..dfbde68 --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Restore.bru @@ -0,0 +1,22 @@ +meta { + name: Restore + type: http + seq: 9 +} + +post { + url: {{api_url}}/subscription/restore/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "receipt": "base64_encoded_receipt_data", + "platform": "ios" + } +} diff --git a/bruno-collections/casera-api/Subscription/Status.bru b/bruno-collections/casera-api/Subscription/Status.bru new file mode 100644 index 0000000..554a34a --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Status.bru @@ -0,0 +1,15 @@ +meta { + name: Status + type: http + seq: 2 +} + +get { + url: {{api_url}}/subscription/status/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Subscription/Upgrade Trigger.bru b/bruno-collections/casera-api/Subscription/Upgrade Trigger.bru new file mode 100644 index 0000000..70e0bda --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Upgrade Trigger.bru @@ -0,0 +1,21 @@ +meta { + name: Upgrade Trigger + type: http + seq: 4 +} + +post { + url: {{api_url}}/subscription/upgrade-trigger/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "trigger": "residence_limit" + } +} diff --git a/bruno-collections/casera-api/Subscription/Upgrade Triggers.bru b/bruno-collections/casera-api/Subscription/Upgrade Triggers.bru new file mode 100644 index 0000000..0eb75a3 --- /dev/null +++ b/bruno-collections/casera-api/Subscription/Upgrade Triggers.bru @@ -0,0 +1,15 @@ +meta { + name: Upgrade Triggers + type: http + seq: 3 +} + +get { + url: {{api_url}}/subscription/upgrade-triggers/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Task Completions/Create Completion.bru b/bruno-collections/casera-api/Task Completions/Create Completion.bru new file mode 100644 index 0000000..02a9029 --- /dev/null +++ b/bruno-collections/casera-api/Task Completions/Create Completion.bru @@ -0,0 +1,24 @@ +meta { + name: Create Completion + type: http + seq: 2 +} + +post { + url: {{api_url}}/task-completions/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "task_id": 1, + "notes": "Completed the task", + "actual_cost": 150.00, + "images": [] + } +} diff --git a/bruno-collections/casera-api/Task Completions/Delete Completion.bru b/bruno-collections/casera-api/Task Completions/Delete Completion.bru new file mode 100644 index 0000000..c4db226 --- /dev/null +++ b/bruno-collections/casera-api/Task Completions/Delete Completion.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Completion + type: http + seq: 4 +} + +delete { + url: {{api_url}}/task-completions/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Task Completions/Get Completion.bru b/bruno-collections/casera-api/Task Completions/Get Completion.bru new file mode 100644 index 0000000..229c696 --- /dev/null +++ b/bruno-collections/casera-api/Task Completions/Get Completion.bru @@ -0,0 +1,19 @@ +meta { + name: Get Completion + type: http + seq: 3 +} + +get { + url: {{api_url}}/task-completions/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Task Completions/List Completions.bru b/bruno-collections/casera-api/Task Completions/List Completions.bru new file mode 100644 index 0000000..411af71 --- /dev/null +++ b/bruno-collections/casera-api/Task Completions/List Completions.bru @@ -0,0 +1,15 @@ +meta { + name: List Completions + type: http + seq: 1 +} + +get { + url: {{api_url}}/task-completions/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Tasks/Archive Task.bru b/bruno-collections/casera-api/Tasks/Archive Task.bru new file mode 100644 index 0000000..73de989 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Archive Task.bru @@ -0,0 +1,19 @@ +meta { + name: Archive Task + type: http + seq: 10 +} + +post { + url: {{api_url}}/tasks/:id/archive/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Cancel Task.bru b/bruno-collections/casera-api/Tasks/Cancel Task.bru new file mode 100644 index 0000000..99e0329 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Cancel Task.bru @@ -0,0 +1,19 @@ +meta { + name: Cancel Task + type: http + seq: 8 +} + +post { + url: {{api_url}}/tasks/:id/cancel/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Create Task.bru b/bruno-collections/casera-api/Tasks/Create Task.bru new file mode 100644 index 0000000..cfcd6a4 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Create Task.bru @@ -0,0 +1,27 @@ +meta { + name: Create Task + type: http + seq: 2 +} + +post { + url: {{api_url}}/tasks/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +body:json { + { + "residence_id": 1, + "title": "Clean gutters", + "description": "Clear debris from all gutters", + "category_id": 1, + "priority_id": 2, + "frequency_id": 3, + "due_date": "2024-12-31" + } +} diff --git a/bruno-collections/casera-api/Tasks/Delete Task.bru b/bruno-collections/casera-api/Tasks/Delete Task.bru new file mode 100644 index 0000000..54875af --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Delete Task.bru @@ -0,0 +1,19 @@ +meta { + name: Delete Task + type: http + seq: 5 +} + +delete { + url: {{api_url}}/tasks/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Get Task Completions.bru b/bruno-collections/casera-api/Tasks/Get Task Completions.bru new file mode 100644 index 0000000..fdf5493 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Get Task Completions.bru @@ -0,0 +1,19 @@ +meta { + name: Get Task Completions + type: http + seq: 12 +} + +get { + url: {{api_url}}/tasks/:id/completions/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Get Task.bru b/bruno-collections/casera-api/Tasks/Get Task.bru new file mode 100644 index 0000000..8d7450b --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Get Task.bru @@ -0,0 +1,19 @@ +meta { + name: Get Task + type: http + seq: 3 +} + +get { + url: {{api_url}}/tasks/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Get Tasks by Residence.bru b/bruno-collections/casera-api/Tasks/Get Tasks by Residence.bru new file mode 100644 index 0000000..4ac4790 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Get Tasks by Residence.bru @@ -0,0 +1,19 @@ +meta { + name: Get Tasks by Residence + type: http + seq: 6 +} + +get { + url: {{api_url}}/tasks/by-residence/:residence_id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + residence_id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/List Tasks.bru b/bruno-collections/casera-api/Tasks/List Tasks.bru new file mode 100644 index 0000000..12a2cf6 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/List Tasks.bru @@ -0,0 +1,15 @@ +meta { + name: List Tasks + type: http + seq: 1 +} + +get { + url: {{api_url}}/tasks/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Tasks/Mark In Progress.bru b/bruno-collections/casera-api/Tasks/Mark In Progress.bru new file mode 100644 index 0000000..29b532c --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Mark In Progress.bru @@ -0,0 +1,19 @@ +meta { + name: Mark In Progress + type: http + seq: 7 +} + +post { + url: {{api_url}}/tasks/:id/mark-in-progress/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Unarchive Task.bru b/bruno-collections/casera-api/Tasks/Unarchive Task.bru new file mode 100644 index 0000000..9cfcba5 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Unarchive Task.bru @@ -0,0 +1,19 @@ +meta { + name: Unarchive Task + type: http + seq: 11 +} + +post { + url: {{api_url}}/tasks/:id/unarchive/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Uncancel Task.bru b/bruno-collections/casera-api/Tasks/Uncancel Task.bru new file mode 100644 index 0000000..9505b78 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Uncancel Task.bru @@ -0,0 +1,19 @@ +meta { + name: Uncancel Task + type: http + seq: 9 +} + +post { + url: {{api_url}}/tasks/:id/uncancel/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Tasks/Update Task.bru b/bruno-collections/casera-api/Tasks/Update Task.bru new file mode 100644 index 0000000..36db2a5 --- /dev/null +++ b/bruno-collections/casera-api/Tasks/Update Task.bru @@ -0,0 +1,26 @@ +meta { + name: Update Task + type: http + seq: 4 +} + +put { + url: {{api_url}}/tasks/:id/ + body: json + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} + +body:json { + { + "title": "Updated task title", + "description": "Updated description" + } +} diff --git a/bruno-collections/casera-api/Users/Get User.bru b/bruno-collections/casera-api/Users/Get User.bru new file mode 100644 index 0000000..6677706 --- /dev/null +++ b/bruno-collections/casera-api/Users/Get User.bru @@ -0,0 +1,19 @@ +meta { + name: Get User + type: http + seq: 2 +} + +get { + url: {{api_url}}/users/:id/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} + +params:path { + id: 1 +} diff --git a/bruno-collections/casera-api/Users/List Profiles.bru b/bruno-collections/casera-api/Users/List Profiles.bru new file mode 100644 index 0000000..2f75580 --- /dev/null +++ b/bruno-collections/casera-api/Users/List Profiles.bru @@ -0,0 +1,15 @@ +meta { + name: List Profiles + type: http + seq: 3 +} + +get { + url: {{api_url}}/users/profiles/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/Users/List Users.bru b/bruno-collections/casera-api/Users/List Users.bru new file mode 100644 index 0000000..57d2705 --- /dev/null +++ b/bruno-collections/casera-api/Users/List Users.bru @@ -0,0 +1,15 @@ +meta { + name: List Users + type: http + seq: 1 +} + +get { + url: {{api_url}}/users/ + body: none + auth: none +} + +headers { + Authorization: Token {{auth_token}} +} diff --git a/bruno-collections/casera-api/bruno.json b/bruno-collections/casera-api/bruno.json new file mode 100644 index 0000000..c1eff48 --- /dev/null +++ b/bruno-collections/casera-api/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "Casera API (Go)", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} diff --git a/bruno-collections/casera-api/environments/Dev.bru b/bruno-collections/casera-api/environments/Dev.bru new file mode 100644 index 0000000..71c1c10 --- /dev/null +++ b/bruno-collections/casera-api/environments/Dev.bru @@ -0,0 +1,5 @@ +vars { + base_url: https://casera.treytartt.com + api_url: {{base_url}}/api + auth_token: your-auth-token-here +} diff --git a/bruno-collections/casera-api/environments/Local.bru b/bruno-collections/casera-api/environments/Local.bru new file mode 100644 index 0000000..ea1c19b --- /dev/null +++ b/bruno-collections/casera-api/environments/Local.bru @@ -0,0 +1,5 @@ +vars { + base_url: http://localhost:8000 + api_url: {{base_url}}/api + auth_token: your-auth-token-here +} diff --git a/internal/handlers/contractor_handler.go b/internal/handlers/contractor_handler.go index 6ef6878..28b3039 100644 --- a/internal/handlers/contractor_handler.go +++ b/internal/handlers/contractor_handler.go @@ -181,6 +181,27 @@ func (h *ContractorHandler) GetContractorTasks(c *gin.Context) { c.JSON(http.StatusOK, response) } +// ListContractorsByResidence handles GET /api/contractors/by-residence/:residence_id/ +func (h *ContractorHandler) ListContractorsByResidence(c *gin.Context) { + user := c.MustGet(middleware.AuthUserKey).(*models.User) + residenceID, err := strconv.ParseUint(c.Param("residence_id"), 10, 32) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid residence ID"}) + return + } + + response, err := h.contractorService.ListContractorsByResidence(uint(residenceID), user.ID) + if err != nil { + if errors.Is(err, services.ErrResidenceAccessDenied) { + c.JSON(http.StatusForbidden, gin.H{"error": err.Error()}) + return + } + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + c.JSON(http.StatusOK, response) +} + // GetSpecialties handles GET /api/contractors/specialties/ func (h *ContractorHandler) GetSpecialties(c *gin.Context) { specialties, err := h.contractorService.GetSpecialties() diff --git a/internal/router/router.go b/internal/router/router.go index 4f5d382..116df38 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -270,6 +270,7 @@ func setupContractorRoutes(api *gin.RouterGroup, contractorHandler *handlers.Con { contractors.GET("/", contractorHandler.ListContractors) contractors.POST("/", contractorHandler.CreateContractor) + contractors.GET("/by-residence/:residence_id/", contractorHandler.ListContractorsByResidence) contractors.GET("/:id/", contractorHandler.GetContractor) contractors.PUT("/:id/", contractorHandler.UpdateContractor) contractors.PATCH("/:id/", contractorHandler.UpdateContractor) diff --git a/internal/services/contractor_service.go b/internal/services/contractor_service.go index bae55b0..f31002b 100644 --- a/internal/services/contractor_service.go +++ b/internal/services/contractor_service.go @@ -294,6 +294,25 @@ func (s *ContractorService) GetContractorTasks(contractorID, userID uint) ([]res return responses.NewTaskListResponse(tasks), nil } +// ListContractorsByResidence lists all contractors for a specific residence +func (s *ContractorService) ListContractorsByResidence(residenceID, userID uint) ([]responses.ContractorResponse, error) { + // Check user has access to the residence + hasAccess, err := s.residenceRepo.HasAccess(residenceID, userID) + if err != nil { + return nil, err + } + if !hasAccess { + return nil, ErrResidenceAccessDenied + } + + contractors, err := s.contractorRepo.FindByResidence(residenceID) + if err != nil { + return nil, err + } + + return responses.NewContractorListResponse(contractors), nil +} + // GetSpecialties returns all contractor specialties func (s *ContractorService) GetSpecialties() ([]responses.ContractorSpecialtyResponse, error) { specialties, err := s.contractorRepo.GetAllSpecialties()