修正错误报告用户归属
创建输入接收并校验 API 注入的登录用户 ID 同步 SpacetimeDB module、client facade 与生成绑定字段
This commit is contained in:
@@ -167,6 +167,7 @@ pub async fn create_error_report(
|
||||
batch_id: batch_id.clone(),
|
||||
submission_id: payload.submission_id.clone(),
|
||||
idempotency_key: format!("{}:{}", auth.claims().user_id(), payload.submission_id),
|
||||
user_id: auth.claims().user_id().to_string(),
|
||||
object_key: object_key.clone(),
|
||||
archive_sha256: digest,
|
||||
archive_size_bytes: archive.len() as u64,
|
||||
|
||||
@@ -24,6 +24,7 @@ pub struct ErrorReportCreateRecordInput {
|
||||
pub batch_id: String,
|
||||
pub submission_id: String,
|
||||
pub idempotency_key: String,
|
||||
pub user_id: String,
|
||||
pub object_key: String,
|
||||
pub archive_sha256: String,
|
||||
pub archive_size_bytes: u64,
|
||||
@@ -90,6 +91,7 @@ impl From<ErrorReportCreateRecordInput> for ErrorReportCreateInput {
|
||||
batch_id: i.batch_id,
|
||||
submission_id: i.submission_id,
|
||||
idempotency_key: i.idempotency_key,
|
||||
user_id: i.user_id,
|
||||
object_key: i.object_key,
|
||||
archive_sha_256: i.archive_sha256,
|
||||
archive_size_bytes: i.archive_size_bytes,
|
||||
|
||||
+1
@@ -10,6 +10,7 @@ pub struct ErrorReportCreateInput {
|
||||
pub batch_id: String,
|
||||
pub submission_id: String,
|
||||
pub idempotency_key: String,
|
||||
pub user_id: String,
|
||||
pub object_key: String,
|
||||
pub archive_sha_256: String,
|
||||
pub archive_size_bytes: u64,
|
||||
|
||||
@@ -37,6 +37,7 @@ pub struct ErrorReportCreateInput {
|
||||
pub batch_id: String,
|
||||
pub submission_id: String,
|
||||
pub idempotency_key: String,
|
||||
pub user_id: String,
|
||||
pub object_key: String,
|
||||
pub archive_sha256: String,
|
||||
pub archive_size_bytes: u64,
|
||||
@@ -143,7 +144,6 @@ pub fn create_error_report_and_return(
|
||||
ctx: &mut ProcedureContext,
|
||||
input: ErrorReportCreateInput,
|
||||
) -> ErrorReportProcedureResult {
|
||||
let caller_user_id = ctx.sender().to_hex().to_string();
|
||||
let caller = ctx.sender();
|
||||
let now = ctx.timestamp;
|
||||
match ctx.try_with_tx(|tx| {
|
||||
@@ -151,7 +151,7 @@ pub fn create_error_report_and_return(
|
||||
tx, caller,
|
||||
)?;
|
||||
let batch_id = validate_text(&input.batch_id, "batch_id")?;
|
||||
let user_id = validate_text(&caller_user_id, "user_id")?;
|
||||
let user_id = validate_text(&input.user_id, "user_id")?;
|
||||
let submission_id = validate_text(&input.submission_id, "submission_id")?;
|
||||
let idempotency_key = validate_text(&input.idempotency_key, "idempotency_key")?;
|
||||
let object_key = validate_text(&input.object_key, "object_key")?;
|
||||
|
||||
Reference in New Issue
Block a user