Common Utilities API¶
1. Attachment Upload¶
POST /api/v1/upload
Content-Type: multipart/form-data
Returns:
{
"code": 0,
"message": "success",
"data": { "url": "/media/uploads/<uuid>.<ext>" }
}
Notes:
Two storage backends are supported: local disk and S3-compatible object storage. Switch them with the
FILE_STORAGE_BACKENDenvironment variable (local/s3).In local mode, files are saved by default to
/var/www/classroom-manager/uploads/on the server. Override the storage path and access prefix withLOCAL_UPLOAD_DIRandLOCAL_UPLOAD_URL_PREFIX.S3 mode requires
S3_BUCKET_NAME,S3_ACCESS_KEY_ID, andS3_SECRET_ACCESS_KEY. OptionalS3_ENDPOINT_URLorS3_BASE_URLcan be used to customize the access domain for any S3-compatible service.Login is required (
Authorization: Bearer <token>).The current implementation uploads to local disk and returns a relative path accessible within the site.
2. Get System Configuration¶
GET /api/v1/config
Permission: login required.
Returns:
{
"code": 0,
"message": "success",
"data": {
"season": "winter",
"season_display": "Winter Schedule",
"semester_start_date": "2026-02-17",
"updated_at": "2026-01-20T10:00:00+08:00"
}
}
3. Set Seasonal Schedule (superadmin Only)¶
POST /api/v1/config/season
Body:
{ "season": "winter" }
Returns: same as getting system configuration.