Commit Graph

44 Commits

Author SHA1 Message Date
msksbr e5335ed70b docs(deploy): add Docker Compose deployment documentation
- Document compose.yaml configuration with image, restart policy,
  and port mapping details
- Restructure audit log directory layout documentation
- Add deployment config file notes for environment isolation
2026-05-24 13:45:50 +08:00
msksbr 1e6781b4f9 feat(deploy): add deployment script and update Docker docs
- Add deploy.sh for automated Docker build and push to private registry
- Lowercase Docker image name to comply with registry requirements
- Update README with concrete Docker run examples and configuration
2026-05-24 03:15:02 +08:00
msksbr bd472fa36c chore(build): prepend \"v\" prefix to version string 2026-05-24 01:53:01 +08:00
msksbr aa745f8d81 build(config): add docker support and project documentation
- Integrate Docker Spring Boot application plugin for containerization
- Bump project version to 0.1
- Include MIT license and project README
- Ignore IDE configuration files in version control
2026-05-24 01:51:41 +08:00
msksbr 57683ad64c feat(logging): add structured audit logging with file export
- Add logback-spring.xml with daily rolling file appenders
- Add structured audit events to RequireRoleAspect
- Add logging export configuration to application.yaml
- Add janino dependency for logback evaluation
- Ignore /log/ export directory
2026-05-24 00:38:11 +08:00
msksbr 21dc992971 refactor(admin): remove unused imports and clean up code
- Remove unused IpExtractor and HttpServletRequest from
  admin controllers
- Remove unused log import from service implementations
- Reorganize and alphabetize imports
- Update class-level doc comments for consistency
2026-05-24 00:08:23 +08:00
msksbr 65a5718f9c refactor(api): replace generic error responses with specific HTTP status codes
- Add ApiResult.badRequest() and ApiResult.notFound() helper methods
- Replace generic ApiResult.error() with appropriate status-specific calls
- Add ApiResultStatusAdvice for consistent response status handling
- Add KDoc comments to admin controller and service methods
2026-05-23 22:36:33 +08:00
msksbr bc4f7ac8cc refactor(admin-book): rename Result to ApiResult and tighten return types
- Replace `Result` with `ApiResult` across admin book/borrow modules
- Change return type from `Result<Any?>` to `ApiResult<String>`
- Reformat multi-arg log statements for readability
2026-05-23 21:43:40 +08:00
msksbr b79fd24ed5 feat(borrow): implement borrow module for regular users
- Add list, search, detail, borrow, and return endpoints to BorrowController
- Implement service methods with MyBatis Plus queries and validation
- Introduce MyBorrowVo response wrapper for borrow records
- Add JwtPopulateAspect for populating userId from JWT claims
2026-05-23 20:05:55 +08:00
msksbr 105aa9579a refactor(auth): remove id from login response
Remove the user id field from the login response, keeping only username
and role. Clean up related formatting for consistency.
2026-05-23 15:42:37 +08:00
msksbr fe962d501a feat(auth): embed userId in JWT token and expose via request attribute
- add userId parameter to generateToken and include it in JWT claims
- extract userId from token in JwtPopulateFilter and set as request attribute
- inject IpExtractor and JwtUtils into AuthController for token generation
2026-05-23 15:41:31 +08:00
msksbr 1037b93a68 refactor(admin-borrows): simplify returnBook to use recordId instead of bookId and userId
- Change returnBook signature to accept recordId only, reducing coupling
- Improve Javadoc comments across controller, service, and implementation
- Clean up imports and reformat class structure in impl

Closes: #125
2026-05-23 15:08:41 +08:00
msksbr 5b3e92209d feat(admin-borrows): add manual borrow and return stubs with service refactor
- Add borrowBook and returnBook method stubs to AdminBorrowService
- Pass userId parameter to BorrowService methods for context enrichment
- Add KDoc comments to service interfaces and implementations
2026-05-23 13:18:35 +08:00
msksbr f73e0e3cba feat(admin-borrows): add search endpoint replacing getAll
Replace the simple \"get all borrows\" endpoint with a search-based
approach supporting queries by book name, author, username, and role.

- Change endpoint from GET /getall to GET /search?query=xxx
- Add search service implementation using QueryWrapper with LIKE
  predicates across Book, User, and BorrowRecord tables
- Use kotlinx-coroutines for parallel async data fetching per result
- Add kotlinx-coroutines-core and kotlinx-coroutines-reactor deps
2026-05-23 13:06:47 +08:00
msksbr 32aed36ebf feat(admin-borrows): implement admin borrow management endpoints
- Add getAllBorrows, getOneBorrow, searchBorrows, and returnBook endpoints
- Implement AdminBorrowServiceImpl with join-based record queries
- Add getAllBooks endpoint to BookController
- Include role validation, IP extraction, and audit logging
2026-05-23 11:41:17 +08:00
msksbr 072d61abb3 refactor(dto): use nested DTOs for borrow info
- Extract book borrow info into BookBorrowDto
- Extract user borrow info into UserBorrowDto
- Update BorrowInfoDto to reference the new DTOs
2026-05-23 01:19:40 +08:00
msksbr 547caaa23b feat(service): add service implementations for borrow and book queries
- Add AdminBorrowServiceImpl with search and getAllBorrows stubs
- Add BorrowServiceImpl with borrow record query stubs
- Add getAllBooks and getAllBorrows to service interfaces
- Mark dashboard components for future service decomposition
2026-05-23 00:51:59 +08:00
msksbr a489d4e91e refactor(runner): add TODO plan for InitUserRunner refactoring
Outline a 3-step migration plan: hardcoded init → config-driven → frontend-driven initialization
2026-05-23 00:43:13 +08:00
msksbr 5b99523059 feat(borrow): add borrow service interfaces and search capability
- Add BorrowService and AdminBorrowService interfaces
- Add BorrowInfoDto for borrow record data transfer
- Rename UserLoginDTO to UserLoginDto for naming consistency
- Update dashboard to use structured borrow record mapping
2026-05-23 00:40:05 +08:00
msksbr 8f6d8eddc9 feat(admin-books): implement book CRUD management endpoints
- Add book with name, author, and stock validation
- Update existing book information
- Delete book by ID
- Adjust book inventory stock
- Rename AdminDashBoardService to DashBoardService
- Remove hardcoded user seed data from SQL schema
2026-05-23 00:16:03 +08:00
msksbr 383c17512a @add(/api/books/getone)
- add new api get a book's info by id
2026-05-22 20:46:47 +08:00
msksbr e1121e9cd7 style(auth): reorganize imports and reformat controller comments 2026-05-22 18:32:20 +08:00
msksbr bfaa5a0dd9 feat(books): add book search service and improve error responses
- Add BookService interface and MyBatis-based implementation with fuzzy search
  by title or author
- Add forbidden (403) response helper to Result template
- Upgrade auth failure log from info to warn level
- Reorganize BookController imports and restructure class
2026-05-22 17:44:31 +08:00
msksbr 3e7145c091 refactor(auth): replace JwtAuthInterceptor with non-blocking filter
Remove the interceptor-based JWT auth and its WebConfig registration.
Introduce JwtPopulateFilter that silently extracts JWT claims into
request attributes without blocking unauthenticated requests. Update
DashBoardController to accept nullable username and RequireRoleAspect
to handle missing credentials with proper error messages.
2026-05-22 13:31:48 +08:00
msksbr 0ccc21288b feat(auth): implement role hierarchy and allow guest book browsing
- Add role inheritance where admin automatically has user permissions
- Update RequireRoleAspect to validate role hierarchy instead of exact match
- Expose /api/dashboard/get-all-books to unauthenticated guests
- Rename AdminDashBoardController to DashBoardController
- Enhance KDoc with role hierarchy rules and access control behavior

Closes: #126
2026-05-22 12:50:53 +08:00
msksbr 79510b3267 feat(admin): add admin dashboard service and role-based access control
- rename DashBoardController to AdminDashBoardController
- add AdminDashBoardService interface with getAllBooks and getAllBorrowRecords
- add GlobalExceptionHandler for unified Result error responses
- add RequireRole annotation and RequireRoleAspect for role-based auth
- fix BorrowRecord entity table name from book_record to borrow_record
- add Result.forbidden() factory method returning 403 responses
2026-05-22 11:48:56 +08:00
msksbr d809cf00ab refactor(auth): remove unused ObjectMapper from JwtAuthInterceptor
- Drop ObjectMapper dependency that was no longer needed
- Simplify KDoc to remove redundant format details
- Reorder imports alphabetically
2026-05-21 19:08:52 +08:00
msksbr ca7788899a docs(core): enhance KDoc documentation across controllers, services, and entities
Add comprehensive API documentation to controller classes with planned
endpoint lists and path prefixes. Document security measures in auth
service implementation. Add field-level comments to Book entity.
2026-05-21 19:03:54 +08:00
msksbr 20660b91dc docs(core): add KDoc documentation to controllers, services, and entities
Add descriptive KDoc comments to all REST controllers, service interfaces,
entity classes, and mappers to improve code readability and maintainability.
Include annotations for controller-level API documentation.
2026-05-21 18:47:23 +08:00
msksbr 5bb836eafc feat(auth): implement JWT authentication interceptor
- Add JwtAuthInterceptor to validate JWT tokens on protected endpoints
- Register interceptor paths via WebConfig for /api/** routes
- Fix Result return type to support nullable values across auth flows
2026-05-21 18:33:11 +08:00
msksbr aaca30d3c5 fix(auth): harden login against timing-based user enumeration
- Use constant-time comparison when user is not found to prevent
  user enumeration via response timing
- Remove debug logging that could expose sensitive data
- Add AspectJ weaver dependency for AOP support
2026-05-21 17:53:48 +08:00
msksbr 00e2ea0700 fix(auth): harden login against timing-based user enumeration
- Use constant-time comparison when user is not found to prevent
  user enumeration via response timing
- Remove debug logging that could expose sensitive data
- Add AspectJ weaver dependency for AOP support
2026-05-21 17:53:26 +08:00
msksbr 93fc46c6fe fix(mapper): correct BorrowRecordMapper entity type and add unauthorized helper
- Fix import and generic type from Book to BorrowRecord in mapper
- Add unauthorized helper returning 401 status to Result template
2026-05-21 17:37:05 +08:00
msksbr 193fed29b2 fix(build): use bootJar task for production packaging
- Use bootJar instead of processResources for excluding dev configuration
- Set default time-zone to GMT for JSON serialization
2026-05-21 14:30:52 +08:00
msksbr 44b8326e96 feat(auth): implement JWT authentication
- Add JwtUtils for token generation and validation using jjwt
- Refactor AuthService.login to return User instead of Boolean
- Add jjwt dependencies and integrate JWT into login flow
- Externalize JWT secret, expiration, and log level as configurable env vars with defaults
2026-05-21 14:04:00 +08:00
msksbr 3937224341 fix(auth): harden password verification against timing attacks
- Run dummy hash when user is not found to prevent timing-based enumeration
- Extract and log real client IP on login requests
- Remove unused test files
- Reorder application config for clarity
2026-05-21 02:39:06 +08:00
msksbr 2cf3806298 feat(auth): implement login logic with database and password verification
- Replace stub with MyBatis-Plus user query and password matching
- Integrate kotlin-logging for structured logging across services
- Add custom Log utility replacing direct SLF4J usage
- Add kotlin-logging dependency to build configuration
2026-05-20 22:30:58 +08:00
msksbr 402e9e04cd refactor(api): restructure auth endpoints with DTO validation and unified response
- Add Result<T> generic response template for standardized API output
- Introduce UserLoginDTO with validation annotations for login requests
- Migrate AuthController to use DTO binding and return Result responses
- Update AuthService interface to accept UserLoginDTO and return Boolean
- Add Jackson configuration (snake_case, non-null, date format)
- Include jackson-module-kotlin and spring-boot-starter-validation deps
2026-05-20 17:29:04 +08:00
msksbr 1be634aeb1 feat(runner): add user02 initialization and rename init methods
- Add initialization flow for the user02 common account
- Rename insertAdminUser to insertAdmin for consistency
- Rename insertCommonUser to insertUser01 to align with naming
2026-05-20 16:37:21 +08:00
msksbr 47ce7596ea feat(runner): add user02 initialization and rename init methods
- Add initialization flow for the user02 common account
- Rename insertAdminUser to insertAdmin for consistency
- Rename insertCommonUser to insertUser01 to align with naming
2026-05-20 16:36:47 +08:00
msksbr 9511b8daad refactor(auth): make admin user initialization idempotent
- Check if admin user already exists before inserting
- Improve log messages with descriptive output
- Move @Transactional annotation to run method
- Fix minor formatting inconsistency
2026-05-20 13:25:04 +08:00
msksbr 52298e7fff feat(auth): add password encoding and default user initialization
- Register Argon2PasswordEncoder as a Spring bean
- Implement InitUserRunner to seed default users on startup
- Add spring-security-crypto and bouncycastle dependencies
- Include database schema initialization script
2026-05-20 12:43:05 +08:00
msksbr a041103a92 feat(api): add controller layer and auth service stubs
- Add AdminBookController, AdminBorrowController, BookController,
  BorrowController, and DashBoardController stubs
- Implement AuthController with login endpoint
- Add AuthService interface and AuthServiceImpl stub
2026-05-13 17:22:51 +08:00
msksbr 3a86d29e5c 实现了数据层的功能 2026-05-13 03:11:56 +08:00