Files
pos-system/services/storage-service-net
Ho Ngoc Hai 928a22fe3e feat(authentication): Implement email verification, two-factor authentication, and social login features
- Added endpoints for sending and confirming email verification, enhancing user account security.
- Integrated two-factor authentication (2FA) with TOTP support, including enabling, verifying, and disabling 2FA.
- Implemented social login functionality for Google and Facebook, allowing users to authenticate using their existing accounts.
- Updated dependency injection to include services for email, 2FA, and social login.
- Enhanced documentation to reflect new features and usage examples for email verification and 2FA.
2026-01-12 23:07:53 +07:00
..

Storage Service .NET / Dịch vụ Lưu trữ .NET

EN: Microservice for file storage management supporting MinIO and Aliyun OSS.
VI: Microservice quản lý lưu trữ file hỗ trợ MinIO và Aliyun OSS.

Features / Tính năng

  • Multi-provider storage: MinIO (S3-compatible) and Aliyun OSS
  • Provider switching: Switch providers via environment variable
  • File CRUD operations: Upload, download, delete, list files
  • Pre-signed URLs: Secure time-limited download/upload URLs
  • User quotas: Storage capacity and file count limits
  • Inter-service auth: JWT validation via IAM Service

Architecture / Kiến trúc

├── src/
│   ├── StorageService.API/           # Controllers, Commands, Queries
│   ├── StorageService.Domain/        # Entities, Repository interfaces
│   └── StorageService.Infrastructure/# Providers, DbContext, Repositories
└── tests/
    ├── StorageService.UnitTests/
    └── StorageService.FunctionalTests/

Quick Start / Bắt đầu nhanh

Prerequisites / Yêu cầu

  • .NET 10 SDK
  • Docker & Docker Compose
  • PostgreSQL (or Neon)
  • MinIO (or Aliyun OSS)

Run with Docker / Chạy với Docker

cd services/storage-service-net
docker-compose up -d

Access at: http://localhost:5002/swagger

Run locally / Chạy local

cd services/storage-service-net
dotnet run --project src/StorageService.API

Configuration / Cấu hình

Variable Description Default
Storage__Provider Provider: minio or aliyun minio
Storage__DefaultBucket Default bucket name storage
Storage__MinIO__Endpoint MinIO endpoint localhost:9000
Storage__MinIO__AccessKey MinIO access key -
Storage__MinIO__SecretKey MinIO secret key -
Storage__AliyunOSS__Endpoint OSS endpoint -
Storage__AliyunOSS__AccessKeyId OSS access key -
Storage__AliyunOSS__AccessKeySecret OSS secret key -
IamService__BaseUrl IAM Service URL http://localhost:5001

API Endpoints

Method Endpoint Description
POST /api/v1/files/upload Upload file
GET /api/v1/files List user files
GET /api/v1/files/{id} Get file by ID
GET /api/v1/files/{id}/download-url Get pre-signed download URL
DELETE /api/v1/files/{id} Delete file
GET /api/v1/quota Get user quota

Database Migrations / Migration Database

cd services/storage-service-net
dotnet ef migrations add InitialCreate --project src/StorageService.Infrastructure --startup-project src/StorageService.API
dotnet ef database update --project src/StorageService.Infrastructure --startup-project src/StorageService.API

Testing / Kiểm thử

# Unit tests
dotnet test tests/StorageService.UnitTests

# All tests
dotnet test

License

MIT