- Updated permissions_repository.rs to import PermissionsItemDto from imphnen_entities. - Modified permissions_schema.rs to import PermissionsItemDto and PermissionsQueryDto from imphnen_entities. - Changed roles_dto.rs to import PermissionsItemDto and PermissionsQueryDto from imphnen_entities. - Updated users_dto.rs to import ExperienceDto, EducationDto, UsersDetailQueryDto, RolesDetailQueryDto, and RolesDetailItemDto from imphnen_entities, and removed redundant struct definitions. - Refactored users_repository.rs to import UsersDetailQueryDto from imphnen_entities. - Updated users_schema.rs to import UsersDetailQueryDto, ExperienceDto, and EducationDto from imphnen_entities. - Modified users_service.rs to use UsersDetailQueryDto from imphnen_entities and added UserLookupService implementation. - Updated Cargo.toml in imphnen-libs to include async-trait as a workspace dependency. - Refactored axum module to remove redundant imports and streamline code. - Updated lib.rs to include AppState struct with user_lookup_service and auth_repository fields. - Refactored surrealdb module to define SurrealWsClient and SurrealMemClient types. - Removed imphnen-iam dependency from middleware's Cargo.toml. - Updated auth_middleware to use UsersDetailQueryDto from imphnen_entities and refactored user retrieval logic. - Refactored permissions_middleware to use PermissionsEnum from imphnen_entities and updated user retrieval logic. - Updated mock_test.rs to create AppState with user_lookup_service and auth_repository. - Added permissions.rs and users.rs to imphnen_entities with necessary DTOs and enums. - Created services.rs in imphnen-libs to define UserLookupService and AuthRepositoryTrait traits.
IMPHNEN Backend Service
This repository serves as the monorepo for all backend services of IMPHNEN. It encompasses several main services:
- IMPHNEN-Backend - Provides fundamental functionalities and shared resources for other services.
- IMPHNEN-IAM - Handles identity and access management across IMPHNEN applications.
- IMPHNEN-CMS - Supports the cms services by IMPHNEN Landing Page website.
- IMPHNEN-Gacha - Supports the gacha services by IMPHNEN Gacha website.
- IMPHNEN-Dimentorin - Supports the mentoring services by IMPHNEN Dimentorin website.
- IMPHNEN-Gateway - Acts as the API gateway, routing requests to appropriate services.
- IMPHNEN-Middleware - Acts as the middleware for the API Gateway, providing authentication and authorization.
How to Install
-
Clone the repository:
git clone https://github.com/IMPHNEN/imphnen-backend-service.git cd imphnen-backend-service -
Set up the environment:
-
Copy the example environment files:
cp .env.example .envif you use windows based system
./apply-env.ps1if you use unix based system
source ./apply-env.sh -
Modify the
.envfiles with your specific configuration settings.
-
-
Install dependencies:
Ensure you have Rust installed. Then, run:
cargo fetch -
Run the seeders:
to run the seeders, run:
cargo run --bin seeder
How to Run
Development
To run the services in development mode:
-
Start the database and other dependencies using Docker Compose:
docker-compose up -d -
Run using cargo run. For example, to run the Core Service:
cargo run --bin api -
Run using cargo watch. For example, to run the Core Service:
cargo watch -x "run --bin api"
Production
For production deployment:
-
Build the Docker image:
docker build -t imphnen-backend . -
Run the Docker container:
docker run --name imphnen-backend -d --env-file .env -p 3000:3000 imphnen-backendAdjust the port and environment variables as needed.
How to Run the Tests
-
Run the tests:
cargo test -p tests
How to Contribute
-
Fork the repository and clone it locally.
-
Create a new branch for your feature or fix:
git checkout -b feat/your-feature-name -
Make your changes, commit them, and push to your forked repository.
-
Create a pull request to the
developbranch of this repository.
If you encounter any issues or have questions, feel free to create a new issue in the repository.
Note: For detailed API documentation, please refer to our API Docs.