Skip to content

Commit

Permalink
feat(server): add ticket id in export data api
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed May 10, 2024
1 parent f733d75 commit 4c9fbeb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/ticket/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,11 @@ async fn export_tickets_for_schema_in_admin<'a>(

let schema_flows = schema.get_detail_flows(&mut conn).await.map_err(|err| AppError::internal(err.to_string()))?;

response.fields.push(serde_json::json!({
"module_type": "Base",
"key": "ticket_id"
}));

for schema_flow in &schema_flows {
match &schema_flow.module {
TicketSchemaFlowValue::Form(form) => {
Expand Down Expand Up @@ -820,6 +825,7 @@ async fn export_tickets_for_schema_in_admin<'a>(

for ticket in tickets {
let mut ticket_data = Map::new();
ticket_data.insert("ticket_id".to_owned(), serde_json::Value::Number(serde_json::Number::from(ticket.id)));
for flow in ticket.get_flows(&mut conn).await.map_err(|err| AppError::internal(err.to_string()))? {
let schema_flow = schema_flows.iter().find(|f| f.schema.id == flow.flow.ticket_schema_flow_id).expect("Schema flow not found");

Expand Down

0 comments on commit 4c9fbeb

Please sign in to comment.