Migrate database updates to use TimeEntrys over ReportRows
This commit is contained in:
@@ -40,6 +40,10 @@ impl TogglApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn workspace_id(&self) -> i64 {
|
||||
self.workspace_id.parse().unwrap()
|
||||
}
|
||||
|
||||
pub async fn check_health(&self) -> bool {
|
||||
true
|
||||
}
|
||||
@@ -100,6 +104,15 @@ impl TogglApiClient {
|
||||
Ok(clients)
|
||||
}
|
||||
|
||||
pub async fn fetch_recent_time_entries(&self) -> crate::Result<Vec<TimeEntry>> {
|
||||
let url = format!("{base_url}/me/time_entries", base_url = self.base_url);
|
||||
|
||||
Ok(self.make_request(self.client.get(url))
|
||||
.await?
|
||||
.json::<Vec<TimeEntry>>()
|
||||
.await?)
|
||||
}
|
||||
|
||||
pub async fn fetch_time_entries_modified_since(
|
||||
&self,
|
||||
date_time: DateTime<Utc>,
|
||||
@@ -119,7 +132,7 @@ impl TogglApiClient {
|
||||
|
||||
pub async fn fetch_time_entries_in_range(
|
||||
&self,
|
||||
(start, end): (DateTime<Utc>, DateTime<Utc>),
|
||||
start: DateTime<Utc>, end: DateTime<Utc>,
|
||||
) -> crate::Result<Vec<TimeEntry>> {
|
||||
let url = format!("{base_url}/me/time_entries", base_url = self.base_url);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct TimeEntry {
|
||||
pub id: i64,
|
||||
pub workspace_id: i64,
|
||||
pub project_id: Option<i64>,
|
||||
pub task_id: Option<Value>,
|
||||
pub task_id: Option<i64>,
|
||||
pub billable: bool,
|
||||
pub start: DateTime<Utc>,
|
||||
pub stop: Option<DateTime<Utc>>,
|
||||
|
||||
Reference in New Issue
Block a user