---
# System prepended metadata

title: '[CLS] Admin-API'
tags: [Collidescope]

---

# [CLS] Admin-API 

###### tags: `Collidescope`

## Table of Content

- [Auth](#auth)
  - [POST /auth/login](#POST-authlogin)
  - [POST /auth/logout](#POST-authlogout)
  - [POST /auth/forgot-password](#POST-authforgot-password)
  - [POST /auth/reset-password](#POST-authreset-password)
  - [POST /auth/reset-password/validate](#POST-authreset-passwordvalidate)
- [User](#user)
  - [GET /users/me](#GET-usersme)
- [Campaigns](#campaign)
  - [GET /campaigns](#GET-campaigns)
  - [POST /campaigns](#POST-campaigns)
  - [GET /campaigns/:campaignId](#GET-campaigns/:campaignId)
  - [PUT /campaigns/:campaignId](#PUT-campaignscampaignId)
  - [POST /campaigns/:campaignId/publish](#POST-campaignscampaignIdpublish)
  - [POST /campaigns/:campaignId/complete](#POST-campaignscampaignIdcomplete)
  - [GET /campaigns/:campaignId/export-pdf](#GET-campaignscampaignIdexport-pdf)
- [Campaign-Partners](#Campaign-Partners) 
  - [GET /campaign-partners](#GET-campaign-partners)
  - [PUT /campaign-partners](#PUT-campaign-partners)
  - [DELETE /campaign-partners/:campaignPartnerId](#DELETE-campaign-partners/:campaignPartnerId)
- [Campaign-Donations](#Campaign-Donations) 
  - [POST /campaign-donations](#POST-campaign-donations)
  - [GET /campaign-donations](#GET-campaign-donations)
  - [PUT /campaign-donations/:campaignDonationId](#PUT-campaign-donationscampaignDonationId)
  - [DELETE /campaign-donations/:campaignDonationId](#DELETE-campaign-donationscampaignDonationId)
- [Campaign-Post](#Campaign-Post) 
  - [GET /campaign-posts](#GET-campaign-posts)
  - [PUT /campaign-posts](#PUT-campaign-posts)
  - [DELETE /campaign-posts/:campaignPostId](#DELETE-campaign-posts/:campaignPostId)
- [Account-Profiles](#Account-Profiles) 
  - [GET /account-profiles](#GET-account-profiles)
  - [POST /account-profiles](#POST-account-profiles)
  - [PUT /account-profiles](#PUT-account-profiles)
  - [GET /account-profiles/:accountProfileId](#GET-account-profiles/:accountProfileId)
- [Account-Profile-Users](#Account-Profile-Users) 
  - [GET /account-profile-users](#GET-account-profile-users)
  - [POST /account-profile-users](#POST-account-profile-users)
  - [POST /account-profile-users/:accountProfileUserId/deactivate](#POST-account-profile-users/:accountProfileUserId/deactivate)
  - [POST /account-profile-users/:accountProfileUserId/activate](#POST-account-profile-users/:accountProfileUserId/activate)


## Auth

### `POST /auth/login`

> Status: TODO

**Query**

> none

**Body**

```typescript=
{
  username: string
  password: string
}
```

**Response**

```typescript=
{
  accessToken: string
  expiredAt: Date
}
```

### `POST /auth/logout`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO

### `POST /auth/forgot-password`

**Body**
```typescript=
{
  email: string
}
```

**Response**

```typescript=
{
  code: 200
  message: "success"
}
```



### `POST /auth/reset-password`


**Body**

```typescript=
{
  resetPasswordRequestId: UUID
  token: string
  password: string
}
```

**Response**

```typescript=
{
  code: 200
  message: "success"
}
```

### `POST /auth/reset-password/validate`

**Note**

- สำหรับ check ว่า link reset password ยังสามารถใช้งานได้

**Body**

```typescript=
{
  resetPasswordRequestId: UUID
  token: string
}
```

**Response**

```typescript=
{
  code: 200
  message: "success"
}
```

**Response Error**

```typescript=
{
  code: 403
  message: "token expired or invalid"
}
```


## Users

### `GET /users/me`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO

## Campaigns

### `POST /campaigns`

> Status: TODO

**Query**

> none

**Body**

```typescript=
{
  campaignName: string
  description: string
  startDate: Date    
  endDate: Date
  donationGoal: number | null
  engagementGoal: number | null
  reachGoal: number | null
  impressionGoal: number | null
}
```

**Response**

> none

### `GET /campaigns`

> Status: TODO

```typescript=
enum Status {
  published,
  draft,
  completed,
  live
}
```

**Query**

```typescript=
{
  keyword?: string
  status?: Status 
  pageNumber?: number
  pageSize?: number
}
```

**Body**

> none


**Response**

```typescript=
{
  data: {
    campaignId: string
    campaignName: string
    status: Status
    startDate: Date    
    endDate: Date
  }
  meta: {
    query: {
      keyword?: string
      status?: Status
      pageNumber?: number
      pageSize?: number
    } // reuse query ด้านบน ได้นะครับ
    total: number
  }
}
```

### `GET /campaigns/:campaignId`

> Status: TODO

**Query**

> none

**Body**

> none

**Response**

```typescript=
{
  campaignName: string
  description: string
  status: Status
  startDate: Date    
  endDate: Date
  donationGoal: number | null
  engagementGoal: number | null
  reachGoal: number | null
  impressionGoal: number | null
}
```

### `PUT /campaigns/:campaignId`

> Status: TODO

**Query**

> none

**Body**

```typescript=
{
  campaignName: string
  description: string
  startDate: Date    
  endDate: Date
  donationGoal: number | null
  engagementGoal: number | null
  reachGoal: number | null
  impressionGoal: number | null
}
```

**Response**

> none

### `POST /campaigns/:campaignId/publish`
- จะ publish ได้เฉพาะ status draft
- ถ้า start date เก่ากว่า today จะ auto set เป็น today

**Response**

```typescript=
{
  code: 200
  message: "success"
}
```

**Response Error**

```typescript=
{
  code: 400
  message: "cannot set campaign status to published"
}
```

### `POST /campaigns/:campaignId/complete`
- จะ complete ได้เฉพาะ status live
- ถ้า end date > today จะ auto set เป็น today 23:59:59 PST


**Response**

```typescript=
{
  code: 200
  message: "success"
}
```

**Response Error**

```typescript=
{
  code: 400
  message: "cannot set campaign status to complete"
}
```

### `GET /campaigns/:campaignId/export-pdf`
- response เป็น PDF binary (Content-Disposition)


## Campaign Partners

### `GET /campaign-partners`


**Query**
```typescript=
{
  campaignId?: string
  type: AccountProfileType
  pageNumber?: number
  pageSize?: number
}
```


**Body**
none



**Response**
```typescript=
{
data: {
campaignPartnerId:string
    accountProfileId: string
    profileName: string
    }
  meta: {
    query: {
      campaignId: string
      type: AccountProfileType
      pageNumber?: number
      pageSize?: number
    } 
    total: number
  }

}
```

> TODO

### `PUT /campaign-partners`

**Body**

```typescript=
{
  campaignId: UUID,
  accountProfiles: Array<{ 
    accountProfileId: UUID 
  }>
}
```

**Response**

```typescript=
{
  code: 200,
  message: "success",
  data: Array<{ 
    campaignPartnerId: UUID 
  }>
}
```

### `DELETE /campaign-partners/:campaignPartnerId`


**Response**
```typescript=
{
  code: 200
  message: "success"
}
```


## Campaign Donations

### `POST /campaign-donations`

> Status: TODO

**Query**

> none

**Body**

```typescript=
{
 campaignId: string
 value: number
 date: Date
}
```

**Response**

```typescript=
{
 campaignDonationId: string
}
```

### `GET /campaign-donations`

**Query**
```typescript=
{
  campaignId: string
}
```

**Body**

none

**Response**
```typescript=
{
 campaignDonationId: string
 campaignId: string
 value: number
 date: Date
}
```

### `PUT /campaign-donations/:campaignDonationId`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO

### `DELETE /campaign-donations/:campaignDonationId`

**Body**

> none

**Response**

```typescript=
{
  code: 200
  message: "success"
}
```

## Campaign Posts

### `GET /campaign-posts`

> Status: TODO

**Query**

```typescript=
{
  campaignId: string
}
```

**Body**

> none

**Response**

```typescript=
{
  data: {
    postId: string
    message: string
    thumbnailUrl: string | null
}
  }
  meta: {
    query: {
      campaignId: string
    }
    total: number
  }
}
```

### `PUT /campaign-posts`

> Status: TODO

**Query**

> none

**Body**
 
```typescript=
{
  campaignId: string
  postUrl: string 
}
```

**Response**

```typescript=
{
  campaignPostId: string  
}
```

### `DELETE /campaign-posts/:campaignPostId`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

```typescript=
{
  campaignPostId: string
}
```


## Account Profiles

### `GET /account-profiles`

**Query**

```typescript=
{
  keyword?: string
  type?: 'all' | 'brand' | 'npo' | 'influencer'
  level?: 'all' | 'parent' | 'child'
}
```

**Body**

> none

**Response**
```typescript=
{
 accountProfileId: string
 profileName: string
 type: 'brand' | 'npo' | 'influencer'
 level: 'parent' | 'child'
}
```

### `POST /account-profiles`

> Status: TODO

**Query**

> TODO

**Body**

```typescript=
{
  profileName: string
  type: 'brand' | 'npo' | 'influencer'
  level: 'parent' | 'child'
  parentId: UUID | null
  firstName: string | null
  lastName: string | null
  email: string | null
  phoneNumber: string | null
  instagramAccount: string | null
  preferredContactMethod: 'email' | 'sms' | 'instagram'
}
```

**Response**

> TODO

### `PUT /account-profiles/:accountProfileId`

> Status: TODO

**Query**

> TODO

**Body**

```typescript=
{
 profileName: string
 parentId: string | null
 firstName: string | null
 lastName: string | null
 email: string | null
 phoneNumber: string | null
 instagramAccount: string | null
 preferredContactMethod: 'email' | 'sms' | 'instagram'
}
```

**Response**

> TODO


### `GET /account-profiles/:accountProfileId`

> Status: TODO

**Query**

> none

**Body**

> none

**Response**

```typescript=
{
 accountProfileId: string
 profileName: string
 type: 'brand' | 'npo' | 'influencer'
 level: 'parent' | 'child'
 parentName: string | null
 firstName: string | null
 lastName: string | null
 email: string | null
 phoneNumber: string | null
 instagramAccount: string | null
 preferedContactMethod: 'email' | 'sms' | 'instagram'
}
```

## Account Profile Users

### `GET /account-profile-users`

> Status: TODO

**Query**

```typescript=
{
  accountProfileId: UUID
  keyword?: string
}
```

**Body**

> TODO

**Response**

> TODO


### `POST /account-profile-users`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO


### `POST /account-profile-users/:accountProfileUserId/deactivate`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO


### `POST /account-profile-users/:accountProfileUserId/activate`

> Status: TODO

**Query**

> TODO

**Body**

> TODO

**Response**

> TODO