Skip to content

Feature / 1차 API 요청 사항 정리 / Admin API #16

@ryxxn

Description

@ryxxn

Description

Admin에서 사용할 API 요청 사항이에요.
테넌트(customer)와 내부 멤버들의 용어가 헷갈릴 수 있어 테넌트를 고객사라고 칭하면,


Admin에서 고객사(tenant)을 관리할 수 있어야 해요.

따라서

1. 고객사 관리

1.1 고객사 생성

고객사와 상담을 진행하며 계약이 성사된 경우, 고객사 정보(Tenant 스키마)를 생성해야 해요.
고객사가 CMS를 사용하기 위해 고객사 생성 기능과 묶어 고객사 대표 계정(초기 default 계정)도 자동으로 생성돼야 해요.

POST /admin/customer

Request Body

상담을 진행하지 않고도 고객사를 바로 생성하는 경우가 있을 수 있어 상담 ID(consultantId)는 Nullable이어야 해요.

{
  "name": "도륜회사",
  "email": "example@gmail.com",
  "theme": null, // enum("MORDERN", "CLASSIC")
  "consultantId": 1 // or null
}

Response Body

고객사 생성 후 고객사 상세 페이지로 넘어갈 수 있도록 고객 ID를 반환해야 해요.

{
  "id": "1",
}

1.3 고객사 목록 조회

GET /admin/customer

Request Query params

페이지네이션(page, size), 검색 필터(email, status)

{
  "page": "1", // optional(default = 1)
  "size": "10", // optional(default = 10)
  "email": "example@gmail.com", // optional
  "status": "ENABLED", // optional
}

Response Body

  • ENABLED = 활성화(정상 상태)
  • DISABLED = 비활성화

마스터가 비활성화시킨 경우, 결제를 하지 않아 비활성화된 경우 등.
disabled_description 필드를 추가하여 비활성화 사유를 적는 것도 좋다고 생각해요.

  • DELETED = 삭제
  • RESIGNED = 회원 탈퇴
  • PAYMENT_DELAYED = 결제 지연

결제를 하지 않으면 바로 비활성화시키지 않고,
3달(예시)동안 결제를 하지 않으면 비활성화하도록 생각하고 있어요. 따라서 그동안의 상태에요.

{
  "data": [
    {
      "id": 1,
      "name": "도륜회사",
      "email": "example@gmail.com",
      "status": "ENABLED", // enum("ENABLED", "DISABLED", "DELETED", "RESIGNED", "PAYMENT_DELAYED")
      "paymentAt": "2025-09-02T00:00",
      "createdAt": "2025-09-02T00:00",
    },
  ]
}

1.4 고객사 상세 조회

GET /admin/customer/{{customer_id}

Request Body

Customer 테이블의 대표자 id를 통해 대표자(presentative) 필드를 DTO에 추가해야 해요.
대표자의 구분은 is_presentative 필드를 사용하는 방법도 고려해보면 좋을 것 같아요.

{
  "id": 1,
  "name": "도륜회사",
  "email": "example@gmail.com",
  "theme": "MODERN"
  "presentative": {
    "id": 1,
    "name": "박도륜",
    "email": "example@gmail.com",
  },
  "status": "ENABLED", // enum("ENABLED", "DISABLED", "DELETED", "RESIGNED", "PAYMENT_DELAYED")
  "paymentAt": "2025-09-02T00:00",
  "createdAt": "2025-09-02T00:00",
}

Response Body

{
  "id": "1",
}

1.5 고객사 정보 수정

PATCH /admin/customer/{{customer_id}

Request Body

상태를 변경하는 경우 등 비고(remark)도 입력할 수 있어야 해요.
단, 비고는 Master측에서만 확인 가능해야 해요.

{
  "id": 1,
  "name": "도륜회사",
  "email": "example@gmail.com",
  "theme": "MODERN"
  "presentativeId": 1,
  "status": "ENABLED", // enum("ENABLED", "DISABLED", "DELETED", "RESIGNED", "PAYMENT_DELAYED"),
  "remark": "비고 예시"
}

Response Body

{
  "id": 1,
  "name": "도륜회사",
  "email": "example@gmail.com",
  "theme": "MODERN"
  "presentative": {
    "id": 1,
    "name": "박도륜",
    "email": "example@gmail.com",
  },
  "status": "ENABLED", // enum("ENABLED", "DISABLED", "DELETED", "RESIGNED", "PAYMENT_DELAYED")
  "paymentAt": "2025-09-02T00:00",
  "createdAt": "2025-09-02T00:00",
}

1.6 고객사 삭제

DELETE /admin/customer/{{customer_id}

Request Query Params

{
}

Response Body

{
}

1.7 고객사 멤버 목록 조회

고객사의 대표자를 수정하는 경우를 생각하여 고객사 맴버 목록에서 선택하는 기능이 필요해요.
따라서 고객사의 멤버 계정 목록을 조회하는 API가 필요해요.

GET /admin/customer/{{customer_id}/member

Request Query Params

filter(role)

{
  "role": "MANAGER" // optional, enum("MANAGER", "USER")
}

Response Body

{
  "data": [
    {
      "id": 1,
      "name": "ryoon",
      "email": "example@gmail.com",
      "isPresentative": true,
      "role": "MANAGER"
    },
    {
      "id": 2,
      "name": "hoon",
      "email": "hoon@gmail.com",
      "isPresentative": false,
      "role": "USER"
    },
  ]
}

2. 상담 관리 (email 연동)

상담은 기본적으로 이메일 기반으로 진행돼요.
클라이언트는 이메일, Redot은 웹페이지(이메일이 연동된)를 통해 상담을 진행할 수 있어요.
하나의 상담을 생성하고, 이후 문의/답변 내역은 최상위 상담에 종속되어야 해요.

2.1 상담 생성

Email을 기준으로 추후 고객사와 엮을 수 있도록 tenant 필드도 있어야 하되, 초기에 Null로 설정해야 해요.

POST /admin/consultant

Request Body

{
  "email": "customer1@gmail.com",
  "phone": "010-1234-5678", // optional
  "prevUrl": "https://customer1.com", //optional
  "preview": {}, // optional
}

Response Body

{
  "consultantId": 1
}

2.2 상담 목록 조회

GET /admin/consultant

Request Query Params

페이지네이션(page, size), 검색 필터(email, status)

{
  "page": 1,
  "size": 10,
  "status": "PROGRESS", // enum("PROGRESS", "END")
  "email": "customer1@gmail.com"
}

Response Body

{
  "data": [
    {
      "id": 1,
      "email": "customer1@gmail.com",
      "phone": "010-1234-5678",
      "status": "PROGRESS", // enum("PROGRESS", "END")
      "createdAt": "2025-09-03T18:01"
    } 
  ]
}

2.3 상담 상세 조회

GET /admin/consultant/{{consultant_id}}

Request Query Params

{
}

Response Body

{
  "id": 1,
  "email": "customer1@gmail.com",
  "prevUrl": "https://customer1.com",
  "phone": "010-1234-5678",
  "preview": {},
  "status": "PROGRESS", // enum("PROGRESS", "END")
  "createdAt": "2025-09-03T18:01"
}

2.4 상담 내역 목록 조회

GET /admin/consultant/{{consultant_id}}/history

Request Query Params

페이지네이션(page, size)

{
  "page": 1,
  "size": 10
}

Response Body

{
  "data": [
    {
      "id": 1,
      "consultantId": 1,
      "parentId": 1,
      "type": "CONSULTANT", // enum("CONSULTANT", "REPLY")
      "sender": "sender1@gmail.com",
      "title": "consultant 1 title",
      "content": "string",
      "attachments": [
        {
          "id": 1,
          "url": "uploded url"
        }
      ],
      "sendedAt": "2025-09-03T18:01"
    }
  ]
}

2.5 답변 생성

답변 생성시 사용자한테 이메일이 발송되어야 해요.

https://developers.google.com/workspace/gmail/api/guides/sending?hl=ko

해당 자료 참고해주시면 될 것 같아요!

POST /admin/consultant/{{consultant_id}}/content/{{content_id}}

content_id = parant_id

Request Body

{
  "consultantId": 1,
  "parentId": 1,
  "type": "CONSULTANT", // enum("CONSULTANT", "REPLY")
  "title": "consultant 1 title",
  "content": "string",
  "attachments": [
    {
      "url": "uploded url"
    }
  ],
}

Response Body

{
  "id": 1, // <--
  "consultantId": 1,
  "parentId": 1,
  "sender": "sender1@gmail.com" // <--
  "type": "CONSULTANT", // enum("CONSULTANT", "REPLY")
  "title": "consultant 1 title",
  "content": "string",
  "attachments": [
    {
      "url": "uploded url"
    }
  ],
  "sendedAt": "2025-09-03T18:01" // <--
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions