How loosap/voucher works
Project type and purpose
• This is a monolithic, full-stack backend service built with Spring Boot. It exposes REST endpoints for voucher management (create/list) and voucher redemption. Authentication is handled in-process via Spring Security (Basic Auth).
File structure
• Top-level: pom.xml, Maven wrapper, README.
• src/main/java/com/loosap/voucher:
• config/SecurityConfig.java – sets up Basic Auth and HTTP security.
• controller/…Controller.java – two controllers (VoucherManagementController, VoucherRedemptionController) that expose the API endpoints.
• service/VoucherService + VoucherServiceImpl – business logic layer.
• repository/VoucherRepository – Spring Data JPA repository for DB access.
• entity/Voucher – JPA entity.
• validation/… – custom Bean Validation annotation and validator.
• src/main/resources: application.properties, data.sql (DB seed), static/ (images for README).
• src/test: mirrors main code structure, unit & integration tests.
README for additional insights
• Describes three endpoints (/api/vouchers GET, /api/vouchers POST, /api/redeem/{code} GET).
• Demonstrates use of Basic Auth in Postman.
• Payload JSON example shows expiryDate and redemptionLimit fields.