chore: upgrade to Dioxus 0.7
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 5s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 5s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
hadolint check / hadolint check (pull_request) Successful in 16s
GitLeaks check / GitLeaks check (pull_request) Successful in 10s
htmlhint check / htmlhint check (pull_request) Successful in 35s
Prettier check / Prettier check (pull_request) Successful in 26s
markdownlint check / markdownlint check (pull_request) Successful in 31s
checkov check / checkov check (pull_request) Successful in 1m15s
ShellCheck check / ShellCheck check (pull_request) Successful in 30s
Stylelint check / Stylelint check (pull_request) Successful in 29s
yamllint check / yamllint check (pull_request) Successful in 27s
Rust check / Rust check (pull_request) Successful in 11m44s
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 5s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 5s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
hadolint check / hadolint check (pull_request) Successful in 16s
GitLeaks check / GitLeaks check (pull_request) Successful in 10s
htmlhint check / htmlhint check (pull_request) Successful in 35s
Prettier check / Prettier check (pull_request) Successful in 26s
markdownlint check / markdownlint check (pull_request) Successful in 31s
checkov check / checkov check (pull_request) Successful in 1m15s
ShellCheck check / ShellCheck check (pull_request) Successful in 30s
Stylelint check / Stylelint check (pull_request) Successful in 29s
yamllint check / yamllint check (pull_request) Successful in 27s
Rust check / Rust check (pull_request) Successful in 11m44s
This commit is contained in:
@@ -104,54 +104,15 @@ pub enum ReoccurrenceInterval {
|
||||
|
||||
#[derive(Serialize, Deserialize, Hash, Clone, Debug)]
|
||||
pub struct Reoccurrence {
|
||||
start_date: NaiveDate,
|
||||
interval: ReoccurrenceInterval,
|
||||
length: u32,
|
||||
}
|
||||
|
||||
impl Reoccurrence {
|
||||
pub fn new(start_date: NaiveDate, interval: ReoccurrenceInterval, length: u32) -> Self {
|
||||
Self {
|
||||
start_date,
|
||||
interval,
|
||||
length,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_date(&self) -> NaiveDate {
|
||||
self.start_date
|
||||
}
|
||||
|
||||
pub fn interval(&self) -> &ReoccurrenceInterval {
|
||||
&self.interval
|
||||
}
|
||||
|
||||
pub fn length(&self) -> u32 {
|
||||
self.length
|
||||
}
|
||||
pub start_date: NaiveDate,
|
||||
pub interval: ReoccurrenceInterval,
|
||||
pub length: u32,
|
||||
}
|
||||
|
||||
#[serde_with::serde_as]
|
||||
#[derive(Serialize, Deserialize, Hash, Clone, Debug)]
|
||||
pub struct CalendarTime {
|
||||
time: NaiveTime,
|
||||
pub time: NaiveTime,
|
||||
#[serde_as(as = "Option<DurationSeconds<i64>>")]
|
||||
reminder_offset: Option<Duration>,
|
||||
}
|
||||
|
||||
impl CalendarTime {
|
||||
pub fn new(time: NaiveTime, reminder_offset: Option<Duration>) -> Self {
|
||||
Self {
|
||||
time,
|
||||
reminder_offset,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time(&self) -> NaiveTime {
|
||||
self.time
|
||||
}
|
||||
|
||||
pub fn reminder_offset(&self) -> Option<Duration> {
|
||||
self.reminder_offset
|
||||
}
|
||||
pub reminder_offset: Option<Duration>,
|
||||
}
|
||||
|
||||
@@ -18,29 +18,10 @@ const TITLE_LENGTH_MAX: u64 = 255;
|
||||
diesel(table_name = crate::schema::projects, check_for_backend(diesel::pg::Pg))
|
||||
)]
|
||||
pub struct Project {
|
||||
id: i32,
|
||||
title: String,
|
||||
created_at: NaiveDateTime,
|
||||
updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl Project {
|
||||
pub fn id(&self) -> i32 {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
pub fn created_at(&self) -> NaiveDateTime {
|
||||
self.created_at
|
||||
}
|
||||
|
||||
pub fn updated_at(&self) -> NaiveDateTime {
|
||||
self.updated_at
|
||||
}
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub created_at: NaiveDateTime,
|
||||
pub updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Eq for Project {}
|
||||
@@ -56,7 +37,7 @@ impl Ord for Project {
|
||||
COLLATOR
|
||||
.lock()
|
||||
.unwrap()
|
||||
.collate(self.title(), other.title())
|
||||
.collate(self.title.as_str(), other.title.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +52,3 @@ pub struct NewProject {
|
||||
))]
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
impl NewProject {
|
||||
pub fn new(title: String) -> Self {
|
||||
Self { title }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const TITLE_LENGTH_MAX: u64 = 255;
|
||||
derive(Queryable, Selectable, Identifiable, Associations)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "server",
|
||||
feature = "server",
|
||||
diesel(
|
||||
table_name = subtasks,
|
||||
belongs_to(Task, foreign_key = task_id),
|
||||
@@ -26,38 +26,12 @@ const TITLE_LENGTH_MAX: u64 = 255;
|
||||
)
|
||||
)]
|
||||
pub struct Subtask {
|
||||
id: i32,
|
||||
task_id: i32,
|
||||
title: String,
|
||||
is_completed: bool,
|
||||
created_at: NaiveDateTime,
|
||||
updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Subtask {
|
||||
pub fn id(&self) -> i32 {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn task_id(&self) -> i32 {
|
||||
self.task_id
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
pub fn is_completed(&self) -> bool {
|
||||
self.is_completed
|
||||
}
|
||||
|
||||
pub fn created_at(&self) -> NaiveDateTime {
|
||||
self.created_at
|
||||
}
|
||||
|
||||
pub fn updated_at(&self) -> NaiveDateTime {
|
||||
self.updated_at
|
||||
}
|
||||
pub id: i32,
|
||||
pub task_id: i32,
|
||||
pub title: String,
|
||||
pub is_completed: bool,
|
||||
pub created_at: NaiveDateTime,
|
||||
pub updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Eq for Subtask {}
|
||||
@@ -70,9 +44,9 @@ impl PartialOrd<Self> for Subtask {
|
||||
|
||||
impl Ord for Subtask {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.is_completed()
|
||||
.cmp(&other.is_completed())
|
||||
.then(self.created_at().cmp(&other.created_at()))
|
||||
self.is_completed
|
||||
.cmp(&other.is_completed)
|
||||
.then(self.created_at.cmp(&other.created_at))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,18 +64,12 @@ pub struct NewSubtask {
|
||||
pub is_completed: bool,
|
||||
}
|
||||
|
||||
impl NewSubtask {
|
||||
pub fn new(task_id: i32, title: String, is_completed: bool) -> Self {
|
||||
impl From<Subtask> for NewSubtask {
|
||||
fn from(subtask: Subtask) -> Self {
|
||||
Self {
|
||||
task_id,
|
||||
title,
|
||||
is_completed,
|
||||
task_id: subtask.task_id,
|
||||
title: subtask.title,
|
||||
is_completed: subtask.is_completed,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Subtask> for NewSubtask {
|
||||
fn from(subtask: Subtask) -> Self {
|
||||
Self::new(subtask.task_id, subtask.title, subtask.is_completed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,43 +17,13 @@ const TITLE_LENGTH_MAX: u64 = 255;
|
||||
#[cfg_attr(feature = "server", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "server", diesel(table_name = tasks, check_for_backend(diesel::pg::Pg)))]
|
||||
pub struct Task {
|
||||
id: i32,
|
||||
title: String,
|
||||
deadline: Option<chrono::NaiveDate>,
|
||||
category: Category,
|
||||
project_id: Option<i32>,
|
||||
created_at: NaiveDateTime,
|
||||
updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
pub fn id(&self) -> i32 {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &str {
|
||||
&self.title
|
||||
}
|
||||
|
||||
pub fn deadline(&self) -> Option<chrono::NaiveDate> {
|
||||
self.deadline
|
||||
}
|
||||
|
||||
pub fn category(&self) -> &Category {
|
||||
&self.category
|
||||
}
|
||||
|
||||
pub fn project_id(&self) -> Option<i32> {
|
||||
self.project_id
|
||||
}
|
||||
|
||||
pub fn created_at(&self) -> NaiveDateTime {
|
||||
self.created_at
|
||||
}
|
||||
|
||||
pub fn updated_at(&self) -> NaiveDateTime {
|
||||
self.updated_at
|
||||
}
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub deadline: Option<chrono::NaiveDate>,
|
||||
pub category: Category,
|
||||
pub project_id: Option<i32>,
|
||||
pub created_at: NaiveDateTime,
|
||||
pub updated_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Eq for Task {}
|
||||
@@ -83,24 +53,22 @@ impl Ord for Task {
|
||||
.cmp(other_date)
|
||||
.then(
|
||||
ReverseOrdOption::from(
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time()),
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time),
|
||||
)
|
||||
.cmp(&ReverseOrdOption::from(
|
||||
&other_time
|
||||
.as_ref()
|
||||
.map(|calendar_time| calendar_time.time()),
|
||||
&other_time.as_ref().map(|calendar_time| calendar_time.time),
|
||||
)),
|
||||
)
|
||||
.then(
|
||||
ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline())),
|
||||
ReverseOrdOption::from(&self.deadline)
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline)),
|
||||
)
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
(Category::Done, Category::Done) | (Category::Trash, Category::Trash) => {
|
||||
self.updated_at.cmp(&other.updated_at).reverse()
|
||||
}
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline()))
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline)
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline))
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
}
|
||||
}
|
||||
@@ -108,22 +76,8 @@ impl Ord for Task {
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
pub struct TaskWithSubtasks {
|
||||
task: Task,
|
||||
subtasks: Vec<Subtask>,
|
||||
}
|
||||
|
||||
impl TaskWithSubtasks {
|
||||
pub fn new(task: Task, subtasks: Vec<Subtask>) -> Self {
|
||||
Self { task, subtasks }
|
||||
}
|
||||
|
||||
pub fn task(&self) -> &Task {
|
||||
&self.task
|
||||
}
|
||||
|
||||
pub fn subtasks(&self) -> &Vec<Subtask> {
|
||||
&self.subtasks
|
||||
}
|
||||
pub task: Task,
|
||||
pub subtasks: Vec<Subtask>,
|
||||
}
|
||||
|
||||
impl Eq for TaskWithSubtasks {}
|
||||
@@ -136,7 +90,7 @@ impl PartialOrd<Self> for TaskWithSubtasks {
|
||||
|
||||
impl Ord for TaskWithSubtasks {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.task().cmp(other.task())
|
||||
self.task.cmp(&other.task)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,24 +109,13 @@ pub struct NewTask {
|
||||
pub project_id: Option<i32>,
|
||||
}
|
||||
|
||||
impl NewTask {
|
||||
pub fn new(
|
||||
title: String,
|
||||
deadline: Option<chrono::NaiveDate>,
|
||||
category: Category,
|
||||
project_id: Option<i32>,
|
||||
) -> Self {
|
||||
impl From<Task> for NewTask {
|
||||
fn from(task: Task) -> Self {
|
||||
Self {
|
||||
title,
|
||||
deadline,
|
||||
category,
|
||||
project_id,
|
||||
title: task.title,
|
||||
deadline: task.deadline,
|
||||
category: task.category,
|
||||
project_id: task.project_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Task> for NewTask {
|
||||
fn from(task: Task) -> Self {
|
||||
Self::new(task.title, task.deadline, task.category, task.project_id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user