mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
Add calendar-order prop
This commit is contained in:
@@ -3,6 +3,7 @@ CREATE TABLE calendars (
|
||||
owner TEXT NOT NULL,
|
||||
name TEXT,
|
||||
description TEXT,
|
||||
'order' INT DEFAULT 0 NOT NULL,
|
||||
color TEXT,
|
||||
timezone TEXT NOT NULL
|
||||
);
|
||||
@@ -5,6 +5,7 @@ pub struct Calendar {
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
pub owner: String,
|
||||
pub order: i64,
|
||||
pub description: Option<String>,
|
||||
pub color: Option<String>,
|
||||
pub timezone: Option<String>,
|
||||
|
||||
@@ -35,7 +35,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
async fn get_calendar(&self, id: &str) -> Result<Calendar, Error> {
|
||||
let cal = sqlx::query_as!(
|
||||
Calendar,
|
||||
"SELECT id, name, owner, description, color, timezone FROM calendars WHERE id = ?",
|
||||
r#"SELECT id, name, owner, "order", description, color, timezone FROM calendars WHERE id = ?"#,
|
||||
id
|
||||
)
|
||||
.fetch_one(&self.db)
|
||||
@@ -46,7 +46,7 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
async fn get_calendars(&self, _owner: &str) -> Result<Vec<Calendar>, Error> {
|
||||
let cals = sqlx::query_as!(
|
||||
Calendar,
|
||||
"SELECT id, name, owner, description, color, timezone FROM calendars"
|
||||
r#"SELECT id, name, owner, "order", description, color, timezone FROM calendars"#,
|
||||
)
|
||||
.fetch_all(&self.db)
|
||||
.await?;
|
||||
@@ -55,11 +55,12 @@ impl CalendarStore for SqliteCalendarStore {
|
||||
|
||||
async fn insert_calendar(&mut self, cid: String, calendar: Calendar) -> Result<(), Error> {
|
||||
sqlx::query!(
|
||||
"INSERT INTO calendars (id, name, description, owner, color, timezone) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
r#"INSERT INTO calendars (id, name, description, owner, "order", color, timezone) VALUES (?, ?, ?, ?, ?, ?, ?)"#,
|
||||
cid,
|
||||
calendar.name,
|
||||
calendar.description,
|
||||
calendar.owner,
|
||||
calendar.order,
|
||||
calendar.color,
|
||||
calendar.timezone
|
||||
).execute(&self.db).await?;
|
||||
|
||||
Reference in New Issue
Block a user