Implement core service layer and platform abstraction#4
Merged
Conversation
Introduce a platform-agnostic abstraction layer that allows class-forge
to target multiple git hosting backends (Forgejo and GitLab) through a
unified Provider interface. The existing Forgejo infrastructure is
preserved while adding GitLab as a new backend option.
Key changes:
- internal/platform: Core interfaces (Provider, RepositoryProvider,
UserProvider, OrganizationProvider, TeamProvider, BranchProvider,
CollaboratorProvider), shared types, sentinel errors, and a
thread-safe provider registry/factory
- internal/platform/forgejo: Forgejo provider implementation skeleton
- internal/platform/gitlab: GitLab provider implementation skeleton
with API mapping documentation (Groups=Orgs, Projects=Repos, etc.)
- internal/config: Add PlatformConfig.Type selector ("forgejo"|"gitlab"),
GitLabConfig struct, and platform-aware validation
- internal/model: Rename Forgejo-specific fields to platform-agnostic
names (ForgejoUsername -> PlatformUsername, ForgejoUserID ->
PlatformUserID)
- internal/api: Rename integration error codes from FORGEJO-specific
to PLATFORM-generic, update service name to "class-forge"
All 30 tests pass across platform, config, and model packages.
https://claude.ai/code/session_017LmTi5pT5kjF4u3scesiDv
Add complete repository layer (PostgreSQL), service layer (business logic), database migrations, API handler wiring, and user-facing documentation for classrooms, assignments, rosters, teams, and submissions. - Database migrations (000002-000006) for all domain tables - Repository interfaces and SQL implementations for all entities - Service layer with validation, platform integration, and error handling - API handlers wired to services with standardized error mapping - User documentation: getting-started, configuration, API reference - Unit tests for services, repositories, and platform abstraction - Updated README to reflect multi-platform support (Forgejo + GitLab) https://claude.ai/code/session_017LmTi5pT5kjF4u3scesiDv
612c313 to
c5f42ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the core business logic layer and platform abstraction for Class Forge, enabling the API to interact with both Forgejo and GitLab instances. It includes complete service implementations for classrooms, assignments, teams, rosters, and submissions, along with their corresponding repository interfaces and PostgreSQL implementations.
Key Changes
Platform Abstraction Layer (
internal/platform/)Providerinterface with sub-interfaces for repositories, users, organizations, teams, and branchesRepository,User,Organization, etc.)Service Layer (
internal/service/)ClassroomServicewith create, list, get, update, delete, and archive operationsAssignmentServicewith full CRUD and statisticsTeamServicefor team management and member operationsRosterServicefor student roster management and linkingSubmissionServicefor tracking student submissionsRepository Layer (
internal/repository/)Database Migrations
API Handler Updates
Configuration & Testing
Documentation
Notable Implementation Details
https://claude.ai/code/session_017LmTi5pT5kjF4u3scesiDv