/admin/compliance/gdpr/consent
为指定用户创建一条数据处理同意记录
请求体
Schema: service-compliance/internal/handler/dto.CreateConsentRequest
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
granted |
boolean |
是 | True |
是否同意 | |
purpose |
string |
是 | marketing_communication |
目的 | |
service |
string |
是 | newsletter |
服务 | |
user_id |
string |
是 | usr_abc123 |
用户ID | |
consent_method |
string |
否 | explicit |
同意方式 |
响应
| 状态 | 描述 | Schema |
|---|---|---|
| 201 | created | service-compliance/internal/handler/dto.ConsentItemResponse |
| 400 | bad request | service-compliance/internal/handler/dto.ErrorResponse |
引用的 Schema
service-compliance/internal/handler/dto.ConsentItem
用户同意记录
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
consent_method |
string |
否 | explicit |
同意方式 | |
expired_at |
string |
否 | 2026-04-16T14:00:00Z |
过期时间 | |
granted |
boolean |
否 | True |
是否同意 | |
granted_at |
string |
否 | 2026-04-15T10:00:00Z |
同意时间 | |
id |
string |
否 | consent_001 |
同意记录ID | |
purpose |
string |
否 | marketing_communication |
处理目的 | |
service |
string |
否 | newsletter |
服务名称 | |
user_id |
string |
否 | usr_abc123 |
用户ID |
service-compliance/internal/handler/dto.ConsentItemResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | |||
data |
service-compliance/internal/handler/dto.ConsentItem |
否 | |||
message |
string |
否 | |||
timestamp |
string |
否 |
service-compliance/internal/handler/dto.ErrorResponse
| 字段 | 类型 | 必填 | 示例 | 约束 | 描述 |
|---|---|---|---|---|---|
code |
integer |
否 | 400 |
||
message |
string |
否 | invalid request |