List Code
Method
REST method is adopted.
HTTP Method
GET: Get code list
Naming Convention
To unify the naming of query parameters and nodes and improve readability, snake_case is used for URIs and JSON nodes in requests.
Request and Response
Headers
Meta information is set in HTTP headers, not in the response body.
Request Headers
AuthorizationContent-TypeAcceptAccept-language
Response Headers
Content-Type
Get List
URI
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| organization_id | number | Required | Backend PostgreSQL organization ID |
| project_id | number | Required | Backend PostgreSQL project ID |
Query Parameters
For list retrieval, page, limit, and sort are generally defined.
| Name | Type | Default | Description |
|---|---|---|---|
| page | integer | 1 | Page number (minimum: 1) |
| limit | integer | 20 | Items per page (minimum: 1, maximum: 100) |
| sort | string | asc | Sort order (asc or desc) |
Response
The response is JSON.
{
"currentPage": 1,
"totalCount": 15,
"list": [
{
"id": "0192a3b4-c5d6-4e8f-9a0b-1c2d3e4f5a6b",
"projectId": 42,
"name": "Button",
"s3Key": "code/0192a3b4-c5d6-4e8f-9a0b-1c2d3e4f5a6b.png",
"sourceCode": "const Button = () => { ... }",
"cssCode": ".button { ... }",
"status": 1,
"createdAt": 1234567890000,
"updatedAt": 1234567890000,
"deletedAt": null,
"createdBy": "user-id",
"updatedBy": "user-id",
"deletedBy": null
}
]
}
Response Fields
| Name | Type | Description |
|---|---|---|
| currentPage | number | Current page number |
| totalCount | number | Total item count |
| list | array | Array of code objects |
| list[].id | string | Code UUID |
| list[].projectId | number | Backend PostgreSQL project ID |
| list[].name | string | Code name |
| list[].s3Key | string | S3 key for preview image |
| list[].sourceCode | string | Source code |
| list[].cssCode | string | null | CSS code |
| list[].status | number | Processing status (0 processing, 1 completed, 2 failed) |
Authentication
Authentication is performed using JSON Web Tokens (JWT) issued by Amazon Cognito.
Error Handling
The status codes for error handling are as follows.
| Description | Status Code | Status Name |
|---|---|---|
| Missing credentials | 401 | Unauthorized |
| Insufficient permissions | 403 | Forbidden |
| Project or organization not found | 404 | Not Found |
| Internal server error | 500 | Internal Server Error |
Processing Flow
- Extract organization ID and project ID from path parameters
- Extract pagination settings from query parameters
- Verify the user has access to the project
- Query code from the database with pagination
- Return paginated response
Detailed Flowchart
flowchart TD
Start([GET Request]) --> Route[Route Handler]
Route --> Auth[Auth & Parameter Extraction<br/>page, limit, sort]
Auth --> Service[Service Layer]
Service --> AccessCheck[Access Check]
AccessCheck --> HasAccess{Read permission?}
HasAccess -->|No| Err404[404 Not Found]
HasAccess -->|Yes| CalcOffset[Calculate Pagination<br/>offset = (page-1) * limit]
CalcOffset --> ValidateSort{sort validation}
ValidateSort -->|NG| Err400[400 Bad Request]
ValidateSort -->|OK| QueryDB
QueryDB[Repository Layer] --> CountQuery[Get COUNT<br/>WHERE deletedAt IS NULL]
CountQuery --> ListQuery[Fetch Records<br/>LIMIT, OFFSET, ORDER BY]
ListQuery --> Format[Format Response<br/>Dateโtimestamp conversion]
Format --> Response[200 OK<br/>currentPage, totalCount, list]