Skip to content

Project launch baseline - #11

Merged
RD2W merged 68 commits into
mainfrom
dev
Dec 6, 2025
Merged

Project launch baseline#11
RD2W merged 68 commits into
mainfrom
dev

Conversation

@RD2W

@RD2W RD2W commented Dec 6, 2025

Copy link
Copy Markdown
Owner

No description provided.

Maksim Krutovertsev and others added 30 commits October 28, 2025 22:44
- Go project initialization
- GitHub Actions workflow for:
  * Branch validation
  * golangci-lint
  * Unit tests with coverage
  * Multi-platform builds
  * Artifact uploads
feat: add basic note entity structure and tests
- Move Entity interface from internal/model/common.go to internal/repository/repository.go
- Interface now better aligns with repository layer responsibility
- Remove empty common.go file from model package
feat: add slice storage and interface-based distribution
…change logging

- Refactored the service to have two independent goroutines: one for data generation and one for data saving
- Implemented a third logging goroutine that checks for changes every 200ms and logs only new entities
- Fixed the repository's Save method to be synchronous as per reviewer's feedback
- Moved all channel logic to the service level
- Updated all tests to match the new architecture
- Ensured thread-safe concurrent access to slices from different goroutines
Implement graceful shutdown using context and OS signals
- Implement JSON file-based repository with automatic data persistence
- Add repository factory pattern supporting both RAM and JSON storage types
- Create logging mechanism to monitor data changes in real-time
- Implement automatic data loading from JSON files on application startup
…es from file

- Add initialNotesCount field to JSONRepository to track notes loaded from file
- Modify GetNewNotes method to exclude loaded notes from 'new' count
- Update LoadFromStorage to set initial notes count after loading
- Keep only summary message about loaded notes count
Implement concurrent note generation with persistent JSON storage
This commit introduces new server implementations and removes obsolete components that were previously used for test data generation:

- Added gRPC server and client implementations with full CRUD operations
- Added web server with REST API endpoints and Gin framework
- Implemented JWT-based authentication and authorization middleware
- Added Swagger documentation for REST API endpoints
- Removed obsolete internal/service package (used for test data generation)
- Removed obsolete internal/logger package (used for monitoring test data)

The new servers provide complete API functionality, making the old test data generation components redundant.
- Change route to add the new Note from /api/notes/ to /api/notes
- Added clarification that curly braces are not part of JWT token
- Added debug logging to middleware and handlers
REST API and gRPC servers with JWT authentication and Swagger documentation
RD2W added 29 commits November 21, 2025 11:08
Add comprehensive tests, benchmarks, and improve documentation and infrastructure
…ion support

Key Changes:

1. Common Base Repository Structure:
- Created `internal/repository/postgres/base_repository.go` with shared functionality for all repositories
- Implemented `BaseRepository` struct with common methods: `WithContext()`, `SetTransaction()`, `ClearTransaction()`, `Exec()`, `QueryRow()`, and `Query()`
- Refactored both `PostgresNoteRepository` and `PostgresUserRepository` to embed the base repository
- Centralized context management with configurable timeouts

2. Enhanced Error Handling System:
- Extended `internal/repository/postgres/errors/errors.go` with structured error hierarchy
- Added `ErrorCode` type and `RepositoryError` struct with error codes, messages, and entity information
- Implemented specific error creation functions (e.g., `NewNoteNotFoundError`, `NewUserCreationError`)
- Maintained backward compatibility by preserving original error variables

3. Repository Options Pattern:
- Created `internal/repository/postgres/repository_options.go` with `RepositoryOption` type
- Added `WithTimeout` option for configurable timeouts
- Implemented `NewPostgresNoteRepositoryWithOpts` and `NewPostgresUserRepositoryWithOpts` for advanced configuration
- Preserved original constructors for backward compatibility

4. Transaction Support:
- Added `internal/repository/postgres/transaction_manager.go` with `TransactionManager` interface
- Implemented `PostgresTransactionManager` with `WithinTransaction` method
- Enhanced base repository to support transaction operations
- Added methods to set and clear transactions on repository instances

5. Repository Refactoring:
- Updated `note_repository.go` and `user_repository.go` to use base repository methods
- Replaced direct database calls with base repository methods (`Exec`, `QueryRow`, `Query`)
- Added proper error wrapping using enhanced error system
- Implemented proper PostgreSQL error handling (e.g., checking for `pgx.ErrNoRows`)

6. Backward Compatibility:
- All existing interfaces remain unchanged
- Original constructor signatures preserved (`NewPostgresNoteRepository`, `NewPostgresUserRepository`)
- All existing tests continue to pass without modification
- Applications (web-server, grpc-server) continue to work without changes
- Benchmark tests remain functional
Refactor postgres base repository with error constants extraction
Add Docker support, versioning info, and systemd service files for gRPC and Web servers
@RD2W
RD2W merged commit de03965 into main Dec 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant