mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
caldav: Add calendar-timezone-id
This commit is contained in:
@@ -7,6 +7,7 @@ CREATE TABLE calendars (
|
||||
"order" INT DEFAULT 0 NOT NULL,
|
||||
color TEXT,
|
||||
timezone TEXT,
|
||||
timezone_id TEXT,
|
||||
deleted_at DATETIME,
|
||||
subscription_url TEXT,
|
||||
PRIMARY KEY (principal, id)
|
||||
|
||||
@@ -62,7 +62,7 @@ impl CalendarStore for SqliteStore {
|
||||
async fn get_calendar(&self, principal: &str, id: &str) -> Result<Calendar, Error> {
|
||||
let cal = sqlx::query_as!(
|
||||
Calendar,
|
||||
r#"SELECT principal, id, synctoken, "order", displayname, description, color, timezone, deleted_at, subscription_url
|
||||
r#"SELECT principal, id, synctoken, "order", displayname, description, color, timezone, timezone_id, deleted_at, subscription_url
|
||||
FROM calendars
|
||||
WHERE (principal, id) = (?, ?)"#,
|
||||
principal,
|
||||
@@ -77,7 +77,7 @@ impl CalendarStore for SqliteStore {
|
||||
async fn get_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
let cals = sqlx::query_as!(
|
||||
Calendar,
|
||||
r#"SELECT principal, id, synctoken, displayname, "order", description, color, timezone, deleted_at, subscription_url
|
||||
r#"SELECT principal, id, synctoken, displayname, "order", description, color, timezone, timezone_id, deleted_at, subscription_url
|
||||
FROM calendars
|
||||
WHERE principal = ? AND deleted_at IS NULL"#,
|
||||
principal
|
||||
@@ -91,7 +91,7 @@ impl CalendarStore for SqliteStore {
|
||||
async fn get_deleted_calendars(&self, principal: &str) -> Result<Vec<Calendar>, Error> {
|
||||
let cals = sqlx::query_as!(
|
||||
Calendar,
|
||||
r#"SELECT principal, id, synctoken, displayname, "order", description, color, timezone, deleted_at, subscription_url
|
||||
r#"SELECT principal, id, synctoken, displayname, "order", description, color, timezone, timezone_id, deleted_at, subscription_url
|
||||
FROM calendars
|
||||
WHERE principal = ? AND deleted_at IS NOT NULL"#,
|
||||
principal
|
||||
@@ -104,15 +104,16 @@ impl CalendarStore for SqliteStore {
|
||||
#[instrument]
|
||||
async fn insert_calendar(&self, calendar: Calendar) -> Result<(), Error> {
|
||||
sqlx::query!(
|
||||
r#"INSERT INTO calendars (principal, id, displayname, description, "order", color, timezone)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)"#,
|
||||
r#"INSERT INTO calendars (principal, id, displayname, description, "order", color, timezone, timezone_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)"#,
|
||||
calendar.principal,
|
||||
calendar.id,
|
||||
calendar.displayname,
|
||||
calendar.description,
|
||||
calendar.order,
|
||||
calendar.color,
|
||||
calendar.timezone
|
||||
calendar.timezone,
|
||||
calendar.timezone_id
|
||||
)
|
||||
.execute(&self.db)
|
||||
.await.map_err(crate::Error::from)?;
|
||||
@@ -127,7 +128,7 @@ impl CalendarStore for SqliteStore {
|
||||
calendar: Calendar,
|
||||
) -> Result<(), Error> {
|
||||
let result = sqlx::query!(
|
||||
r#"UPDATE calendars SET principal = ?, id = ?, displayname = ?, description = ?, "order" = ?, color = ?, timezone = ?
|
||||
r#"UPDATE calendars SET principal = ?, id = ?, displayname = ?, description = ?, "order" = ?, color = ?, timezone = ?, timezone_id = ?
|
||||
WHERE (principal, id) = (?, ?)"#,
|
||||
calendar.principal,
|
||||
calendar.id,
|
||||
@@ -136,6 +137,7 @@ impl CalendarStore for SqliteStore {
|
||||
calendar.order,
|
||||
calendar.color,
|
||||
calendar.timezone,
|
||||
calendar.timezone_id,
|
||||
principal,
|
||||
id
|
||||
).execute(&self.db).await.map_err(crate::Error::from)?;
|
||||
|
||||
Reference in New Issue
Block a user