Merge branch 'development_add_incremental_mode_to_heromodels'
This commit is contained in:
@@ -60,8 +60,12 @@ pub struct Event {
|
||||
|
||||
impl Event {
|
||||
/// Creates a new event
|
||||
pub fn new(id: i64) -> Self {
|
||||
Self {
|
||||
pub fn new(
|
||||
id: i64,
|
||||
title: impl ToString,
|
||||
start_time: DateTime<Utc>,
|
||||
end_time: DateTime<Utc>,
|
||||
) -> Self {
|
||||
base_data: BaseModelData::new(id as u32),
|
||||
title: String::new(),
|
||||
description: None,
|
||||
@@ -114,7 +118,11 @@ impl Event {
|
||||
}
|
||||
|
||||
/// Reschedules the event to new start and end times
|
||||
pub fn reschedule(mut self, new_start_time: DateTime<Utc>, new_end_time: DateTime<Utc>) -> Self {
|
||||
pub fn reschedule(
|
||||
mut self,
|
||||
new_start_time: DateTime<Utc>,
|
||||
new_end_time: DateTime<Utc>,
|
||||
) -> Self {
|
||||
// Basic validation: end_time should be after start_time
|
||||
if new_end_time > new_start_time {
|
||||
self.start_time = new_start_time;
|
||||
@@ -148,11 +156,20 @@ pub struct Calendar {
|
||||
}
|
||||
|
||||
impl Calendar {
|
||||
/// Creates a new calendar
|
||||
pub fn new(id: u32) -> Self {
|
||||
/// Creates a new calendar with auto-generated ID
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `id` - Optional ID for the calendar (use None for auto-generated ID)
|
||||
/// * `name` - Name of the calendar
|
||||
pub fn new(id: Option<u32>, name: impl ToString) -> Self {
|
||||
let mut base_data = BaseModelData::new();
|
||||
if let Some(id) = id {
|
||||
base_data.update_id(id);
|
||||
}
|
||||
|
||||
Self {
|
||||
base_data: BaseModelData::new(id as u32),
|
||||
name: String::new(),
|
||||
base_data,
|
||||
name: name.to_string(),
|
||||
description: None,
|
||||
events: Vec::new(),
|
||||
}
|
||||
|
Reference in New Issue
Block a user