pub trait ActivityWriteOps: ActivityReadOps {
    // Required methods
    fn create_activity(&self, activity: Activity) -> PaceResult<ActivityGuid>;
    fn update_activity(
        &self,
        activity_id: ActivityGuid,
        activity: Activity
    ) -> PaceResult<Activity>;
    fn delete_activity(&self, activity_id: ActivityGuid) -> PaceResult<Activity>;
}
Expand description

Basic CUD Operations for Activities in the storage backend.

CUD stands for Create, Update, and Delete. These are the basic operations that can be performed on activities. These operations are essential for managing activities in the storage backend.

Required Methods§

source

fn create_activity(&self, activity: Activity) -> PaceResult<ActivityGuid>

Create an activity in the storage backend.

§Arguments
  • activity - The activity to create.
§Errors

This function should return an error if the activity cannot be created.

§Returns

If the activity was created successfully it should return the ID of the created activity.

source

fn update_activity( &self, activity_id: ActivityGuid, activity: Activity ) -> PaceResult<Activity>

Update an existing activity in the storage backend.

§Note

This function should not be used to update the state of an activity (e.g., start, end, hold, resume) directly. Use the ActivityStateManagement trait for that. This function is only for updating (as in replacing) the complete data of an activity.

Warning: It can’t be used to update the ID of an activity, because that’s the primary key. So it is immutable.

§Arguments
  • activity_id - The ID of the activity to update.
  • activity - The updated activity data.
§Errors

This function should return an error if the activity cannot be updated.

§Returns

If the activity was updated successfully it should return the activity before it was updated.

source

fn delete_activity(&self, activity_id: ActivityGuid) -> PaceResult<Activity>

Delete an activity from the storage backend.

§Arguments
  • activity_id - The ID of the activity to delete.
§Errors

This function should return an error if the activity cannot be deleted.

§Returns

If the activity was deleted successfully it should return the activity that was deleted.

Implementors§