Overview
As a Trippins administrator, you have complete control over the housing catalog. This includes reviewing and approving new property submissions, editing existing listings, managing tags and categorization, and removing properties that violate platform policies.Admin privileges are required to access housing management features. Only users with the
ADMIN role can perform these operations.Housing Entity Structure
The Housing entity is the core data model for all property listings in Trippins. Understanding its structure is essential for effective management.Key Fields
Auto-generated unique identifier for the housing listing
Approval status. Only approved listings (
acepted = true) are visible to regular usersProperty image stored as LONGBLOB, converted to Base64 for API responses
Many-to-many relationship with tags (e.g., “Beach”, “City”, “River”) for categorization
Admin Workflows
Viewing All Housing Listings
Administrators can retrieve all housing listings, including both approved and pending properties.Returns an array of all housing listings with complete details including approval status
Filtering by Approval Status
The service layer provides methods to filter housing by approval status using pagination.- Approved Listings
- Pending Listings
HousingService.java
Approving a Housing Listing
When a new property is submitted, it starts withacepted = false. Administrators must review and approve it before it becomes visible to users.
After approval, the listing immediately becomes visible in search results and the main catalog
Creating a New Housing Listing
Administrators can create housing listings directly through the API.Prepare the Housing Data
Collect all required fields including location, name, price, description, star rating, and tags.
Updating Housing Details
Administrators can update any aspect of a housing listing using the update endpoint.Deleting a Housing Listing
Remove properties that violate policies or are no longer available.Returns
204 No Content on successful deletion. This operation is permanent and cannot be undone.Managing Tags and Categories
Viewing Tags for a Housing
Tags help users discover properties through filtered search. Each housing can have multiple tags.Available Tag Types
The platform supports the following tag categories:Beach
Properties located near beaches or coastal areas
City
Urban properties in city centers
River
Properties with river views or riverside locations
Security and Permissions
Role-Based Access Control
Housing management endpoints require theADMIN role. This is enforced at the security configuration level:
SecurityConfiguration.java
JWT Authentication
All admin operations require a valid JWT token with admin privileges:API Reference
Housing Management Endpoints
Retrieve all housing listings (both approved and pending)Security: Requires JWT authenticationResponse:
200 OK with array of HousingDTO objectsGet a specific housing listing by codeParameters:
id(path) - Housing code (e.g., 1)
200 OK with HousingDTO objectCreate a new housing listingSecurity: Requires
ADMIN roleBody: HousingDTO object (code is auto-generated)Response: 201 Created with created HousingDTOUpdate an existing housing listingSecurity: Requires
ADMIN roleParameters:id(path) - Housing code to update
200 OK with updated HousingDTODelete a housing listingSecurity: Requires
ADMIN roleParameters:id(path) - Housing code to delete
204 No ContentGet all tags associated with a housingParameters:
id(path) - Housing code
200 OK with Set of TagDTO objectsBest Practices
Verify Listing Quality Before Approval
Verify Listing Quality Before Approval
Always review property descriptions, images, and pricing for accuracy before setting
acepted = true. Ensure the listing meets platform quality standards.Use Consistent Tag Categorization
Use Consistent Tag Categorization
Apply tags consistently across similar properties. A beach resort should always have the “Beach” tag for accurate filtering.
Handle Image Data Properly
Handle Image Data Properly
Images are stored as BLOBs in the database and converted to Base64 for API responses. Ensure images are optimized before upload to prevent database bloat.
Validate Unique Constraints
Validate Unique Constraints
The
name field must be unique. Check for duplicates before creating or updating housing listings to avoid constraint violations.Archive Instead of Delete When Possible
Archive Instead of Delete When Possible
Consider setting
acepted = false instead of deleting listings to maintain reservation history and data integrity.Troubleshooting
403 Forbidden on Admin Endpoints
403 Forbidden on Admin Endpoints
Cause: Missing or invalid admin role in JWT tokenSolution: Verify that the authenticated user has
admin = true in the User entity and the JWT contains ROLE_ADMINDuplicate Name Error
Duplicate Name Error
Cause: Attempting to create/update housing with a name that already existsSolution: Choose a unique name or modify the existing listing instead
Image Not Displaying
Image Not Displaying
Cause: Improper Base64 encoding or BLOB conversionSolution: Ensure images are properly converted using the
getImageBase64() method from the Housing entity