メインコンテンツまでスキップ

📌 API Detail Design Document

1. API Information

  • API Name: Collect branch data
  • Module/Service: amdp-ags-dashboard-backend
  • Author: Reus
  • Created Date: 2025/08/18
  • Last Updated: 2025/08/18

2. Overview

  • Purpose: API collect data commits on git server
  • Description: Collect branch data

3. Endpoint Specification

  • Method: POST
  • URL: /dashboard/collect/commit
  • Headers:
    • Authorization: Bearer <token user>
    • Content-Type: application/json

Query Params

NameTypeRequiredDescriptionExample

Path Params

NameTypeRequiredDescriptionExample

Request Body

{
"branch": "main",
"collectFrom": "2024-12-01",
"collectTo": "2024-12-15",
"host": "https://github.com",
"organizationId": "org456",
"projectId": 14245,
"projectName": "My Project",
"repositoryId": "repo123",
"repositoryName": "example-repo",
"token": "ghp_exampletoken123",
"tool": "GIT"
}

4. Response Specification

Success Response (200/201)

{"code": 200,"message": "Success"}

Error Response (400/401/404/500)

{"code": 400,"message": "Bad Request"}

5. Sequence / Flow (Source)

@startuml
actor Client
participant "Dashboard Service" as DS
participant "Git Provider (GitHub)" as Git
database "MongoDB\ngitCommitCollection" as DB


Client -> DS: POST /collectCommitData\n{branch, collectFrom, collectTo, ...}
activate DS


DS -> DS: Parse & validate request


DS -> Git: Fetch commit data\n(using token, repo info)
activate Git
Git --> DS: Commit data (JSON)
deactivate Git


DS -> DS: Transform & prepare data


DS -> DB: Insert commit data
activate DB
DB --> DS: Ack (insert success)
deactivate DB


DS --> Client: 200 OK\n{ "message": "Collect success" }
deactivate DS
@enduml

6. Sequence / Flow (Image)


7. Dependencies

  • DB tables:
{
"_id": {"$oid": "6697410cba38fa3fb6e90504"},
"_class": "com.amdp.dashboard.entity.mongodb.gitprovider.common.GitCommitCollection",
"authorEmail": "modern-skcc@sk.com",
"authorName": "mfw",
"authoredDate": {"$date": "2023-05-23T22:50:03.000Z"},
"branches": ["feature/PR1", "feature/PR2", "main"],
"commitId": "cdee70c264b0dbca45b9c9a1b1d518f40f3de361",
"commitUrl": "https://github.com/amdp-owner/amdp-awesome-shopping-demo-account/commit/cdee70c264b0dbca45b9c9a1b1d518f40f3de361",
"committerDate": {"$date": "2023-05-23T22:50:03.000Z"},
"committerEmail": "modern-skcc@sk.com",
"committerName": "mfw",
"createdDate": {"$date": "2024-07-17T03:57:00.172Z"},
"fileChanges": [],
"gitProvider": "GITHUB",
"lastModifiedDate": {"$date": "2024-07-17T03:57:00.172Z"},
"message": "This is modern framework base code template.",
"organizationId": "amdp-owner",
"repositoryId": "844",
"repositoryName": "amdp-awesome-shopping-demo-account",
"stats": {
"total": 0,
"additions": 0,
"deletions": 0
},
"title": "This is modern framework base code template."
}
  • External service call:
  • Message broker/topic:

8. Security & Performance Considerations

  • Authentication & Authorization
  • Rate limit / Throttling
  • Caching
  • Timeout & Retry logic

9. Test Cases (basic)

CaseInputExpected OutputNotes
Valid request{...}200 + data
Missing param{}400 error
Unauthorized401 error

10. Change History

VersionDateAuthorChange