---
# System prepended metadata

title: certificate resources

---

# certificate resources

### :question:what is the problem?
#### Admin
- [ ] verification
- [ ] accept / reject request
- [ ] get request status when not verified
- [ ] get list of certs
- [ ] create new cert
- [ ] get one cert detail
- [ ] update cert (only expiration date)

#### Consumer
- [ ] get list certs
- [ ] share cert


### :heavy_check_mark: What is the solution?
#### Admin
- [ ] verification
    - [ ] _route_: `/cert/verify/{app_id}`, `POST`
    - [ ] _request_: `app_id`, `jwt`, [VerifyInfoExpectModel](#VerifyInfoExpectModel)
    - [ ] _response_: `verify info submitted successfully`

- [ ] accept / reject request
    - [ ] _route_: `/cert/verify/{app_id}/status`, `POST`
    - [ ] _request_: `app_id`, `secret_key for BE`
    - [ ] _response_: `app successfully verified for certificate`

- [ ] get request status when not verified
    - [ ] _route_: `/cert/verify/{app_id}/status`, `GET`
    - [ ] _request_: `app_id`
    - [ ] _response_: [GetVerifyRequestStatus](#GetVerifyRequestStatus)

- [ ] get list of certs
    - [ ] _route_: `/cert?app_id=app_id`, `GET`
    - [ ] _request_: `app_id`, `jwt`
    - [ ] _response_: [AdminGetCertsListResponseModel](#AdminGetCertsListResponseModel)

- [ ] create new cert
    - [ ] _route_: `/cert`, `POST`
    - [ ] _request_: `app_id`, `jwt`, [CreateCertExpectModel](#CreateCertExpectModel)
    - [ ] _response_: `certificate created successfully`

- [ ] get one cert detail
    - [ ] _route_: `/cert/{cert_id}`, `GET`
    - [ ] _request_: `app_id`, `cert_id`, `jwt`
    - [ ] _response_: [AdminGetCertResponseModel](#AdminGetCertResponseModel)

- [ ] update cert (only expiration date)
    - [ ] _route_: `/cert/{cert_id}`, `PUT`
    - [ ] _request_: `app_id`, `cert_id`, `jwt`, [UpdateCertExpectModel](#UpdateCertExpectModel)
    - [ ] _response_: `certificate updated successfully`

- [ ] add users to cert
    - [ ] _route_: `/cert/{cert_id}/users`, `POST`
    - [ ] _request_: `app_id`, `cert_id`, `jwt`, [PostAddUsersToCertExpectModel](#PostAddUsersToCertExpectModel)
    - [ ] _response_: `users added to cert successfully`

#### Consumer
- [ ] get list certs
    - [ ] _route_: `/cert/consumer/{user_id}`, `GET`
    - [ ] _request_: `user_id`, `app_adr`, `jwt`
    - [ ] _response_: [ConsumerGetCertsListResponseModel](#ConsumerGetCertsListResponseModel)

- [ ] get detail of shared cert
    - [ ] _route_: `/cert/share/{cert_uid}/{user_id}`, `GET`
    - [ ] _request_: `user_id`, `cert_uid`, `jwt`
    - [ ] _response_: [ConsumerGetCertResponseModel](#ConsumerGetCertResponseModel)


#### CreateCertExpectModel
```json=
{
    "app_id": "id of app",
    "uid": "unique id",
    "users": "list of users' id",
    "accent_color": "hex color code",
    "title": "title of cert",
    "issue_date": "start date time of cert, datetime as iso",
    "expiration_date": "expire date of cert, datetime as iso",
    "desc": "markdown filename"
}
```

#### UpdateCertExpectModel
```json=
{
    "expiration_date": "expire date of cert"
}
```

#### ConsumerGetCertResponseModel
```json=
{
    "_id": "id of cert",
    "uid": "unique id of cert",
    "app_id": "id of app",
    "accent_color": "hex color code",
    "title": "title of cert",
    "issue_date": "datetime as iso",
    "expiration_date": "datetime as iso",
    "desc": "filename"
}
```

#### AdminGetCertResponseModel
```json=
{
    "_id": "id of cert",
    "uid": "unique id of cert",
    "app_id": "id of app",
    "accent_color": "hex color code",
    "title": "title of cert",
    "users": "list of users' id",
    "issue_date": "datetime as iso",
    "expiration_date": "datetime as iso",
    "desc": "filename"
}
```

#### ConsumerGetCertsListResponseModel
```json=
[
    {
        "_id": "id of cert",
        "uid": "unique id of cert",
        "app_id": "id of app",
        "accent_color": "hex color code",
        "title": "title of cert",
        "users": "list of users' id",
        "issue_date": "datetime as iso",
        "expiration_date": "datetime as iso",
        "desc": "filename"
    }
]
```

#### AdminGetCertsListResponseModel
```json=
[
    {
        "_id": "id of cert",
        "uid": "unique id of cert",
        "app_id": "id of app",
        "accent_color": "hex color code",
        "title": "title of cert",
        "users": "list of users' id",
        "issue_date": "datetime as iso",
        "expiration_date": "datetime as iso",
        "desc": "filename"
    }
]
```

###### formDAta
#### VerifyInfoExpectModel
```json=
{
    "name": "required, string",
    "family": "required, string",
    "international_id": "required, string",
    "birth_date": "required, string",
    "email": "required, string",
    "mobile": "required, string",
    "city": "required, string",
    "province": "required, string",
    "id_card": "image file",
    "intro_letter": "required for legal, image file",
    "selfi": "required, image file"
    "company_name": "required, string",
    "company_phone": "required, string",
    "company_address": "required, string",
    "logo": "required, image file",
    "ceo_sign": "required, string",
    "documents": "required, compressed files zip or rar",
    "desc": "optional, string"
}
```

#### GetVerifyRequestStatus
```json
{
    "status": `submitted`, `checking`, `declined`, `accepted`
    "messages": ["message1", "message2", "messagen"]
}
```

#### PostAddUsersToCertExpectModel
```json
{
    "users": ["user_id1", "user_id2", "user_idn"]
}
```

