디지털 자산 관리 서버 (FastAPI + RDS + S3 + DynamoDB)

디지털 자산의 업로드, 관리, 폴더 구성을 지원하는 RESTful API 서버입니다.

Python 3.10FastAPIRDSS3DynamoDB

서버 실행 방법

다운로드한 zip 파일을 압축 해제한 후, 다음 명령어로 서버를 실행할 수 있습니다:

python 으로 서버 실행:

python run.py

uvicorn 으로 서버 실행:

uvicorn app.main:app --host 0.0.0.0 --port 8000

서버가 성공적으로 실행되면 localhost:8000에서 API를 사용할 수 있습니다.

Swagger UI는 localhost:8000/docs에서 확인할 수 있습니다.

API 명세서

회원가입

POST/api/v1/auth/register

새로운 사용자를 등록합니다.

요청 본문

{
  "email": "string",
  "password": "string",
  "name": "string"
}

응답 예시

{
  "id": 1,
  "email": "user@example.com",
  "name": "홍길동",
  "created_at": "2024-12-27T10:00:00"
}

오류 응답

400 Bad Request

로그인

POST/api/v1/auth/login

사용자 인증을 수행하고 액세스 토큰을 발급합니다.

요청 본문

{
  "email": "string",
  "password": "string"
}

응답 예시

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer"
}

오류 응답

401 Unauthorized

자산 업로드

POST/api/v1/assets

새로운 디지털 자산을 업로드합니다.

헤더

Authorization: Bearer {token}

요청 본문

multipart/form-data:
{
  "file": "binary",
  "name": "string",
  "description": "string",
  "tags": ["string"],
  "folder_id": "number (optional)"
}

응답 예시

{
  "id": 1,
  "name": "sample_image.jpg",
  "description": "샘플 이미지 파일",
  "folder_id": 1,
  "mime_type": "image/jpeg",
  "size": 102400,
  "file_url": "https://s3.amazonaws.com/bucket/sample_image.jpg",
  "created_at": "2024-12-27T10:00:00",
  "updated_at": "2024-12-27T10:00:00",
  "tags": [
    {
      "id": 1,
      "name": "이미지",
      "created_at": "2024-12-27T10:00:00"
    }
  ]
}

오류 응답

400 Bad Request

자산 목록 조회

GET/api/v1/assets

디지털 자산 목록을 조회합니다.

헤더

Authorization: Bearer {token}

쿼리 파라미터

folder_id: number (optional)
tag: string (optional)

응답 예시

[
  {
    "id": 1,
    "name": "sample_image.jpg",
    "description": "샘플 이미지 파일",
    "folder_id": 1,
    "mime_type": "image/jpeg",
    "size": 102400,
    "file_url": "https://s3.amazonaws.com/bucket/sample_image.jpg",
    "created_at": "2024-12-27T10:00:00",
    "updated_at": "2024-12-27T10:00:00",
    "tags": [
      {
        "id": 1,
        "name": "이미지",
        "created_at": "2024-12-27T10:00:00"
      }
    ]
  }
]

오류 응답

401 Unauthorized

폴더 생성

POST/api/v1/folders

새로운 폴더를 생성합니다.

헤더

Authorization: Bearer {token}

요청 본문

{
  "name": "string",
  "parent_id": "number (optional)"
}

응답 예시

{
  "id": 1,
  "name": "내 폴더",
  "parent_id": null,
  "user_id": 1,
  "created_at": "2024-12-27T10:00:00",
  "updated_at": "2024-12-27T10:00:00"
}

오류 응답

400 Bad Request