Complete set
This commit is contained in:
parent
5b4f850b8f
commit
a72acbc42f
39
src/main.rs
39
src/main.rs
@ -91,6 +91,45 @@ impl Worker {
|
||||
self.update_tags().await?;
|
||||
}
|
||||
|
||||
for entry in time_entries {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO time_entries (id, workspace_id, user_id, project_id, task_id, start, stop, duration, updated_at, description, tag_ids, billable, server_deleted_at, permissions)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
workspace_id = excluded.workspace_id,
|
||||
user_id = excluded.user_id,
|
||||
project_id = excluded.project_id,
|
||||
task_id = excluded.task_id,
|
||||
start = excluded.start,
|
||||
stop = excluded.stop,
|
||||
duration = excluded.duration,
|
||||
updated_at = excluded.updated_at,
|
||||
description = excluded.description,
|
||||
tag_ids = excluded.tag_ids,
|
||||
billable = excluded.billable,
|
||||
server_deleted_at = excluded.server_deleted_at,
|
||||
permissions = excluded.permissions
|
||||
"#,
|
||||
entry.id as i64,
|
||||
entry.workspace_id as i64,
|
||||
entry.user_id as i64,
|
||||
entry.project_id.map(|id| id as i64),
|
||||
entry.task_id.map(|id| id as i64),
|
||||
entry.start,
|
||||
entry.stop,
|
||||
entry.duration.map(|d| d as i32),
|
||||
entry.updated_at,
|
||||
entry.description,
|
||||
&entry.tag_ids.iter().map(|id| *id as i64).collect::<Vec<_>>(),
|
||||
entry.billable,
|
||||
entry.server_deleted_at,
|
||||
entry.permissions,
|
||||
)
|
||||
.execute(&mut self.db)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user