Files
db/heromodels/src/models/object/object.rs
2025-08-05 13:00:09 +02:00

41 lines
903 B
Rust

use heromodels_core::BaseModelData;
use heromodels_derive::model;
use rhai::CustomType;
use rhai::TypeBuilder;
use serde::{Deserialize, Serialize};
/// Represents an event in a contact
#[model]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default)]
pub struct Object {
/// Base model data
pub base_data: BaseModelData,
#[index]
pub title: String,
pub description: String,
}
impl Object {
pub fn new() -> Self {
Object {
title: String::new(),
base_data: BaseModelData::new(),
description: String::new(),
}
}
pub fn id(&self) -> u32 {
self.base_data.id
}
pub fn title(mut self, title: String) -> Self {
self.title = title;
self
}
pub fn description(mut self, description: String) -> Self {
self.description = description;
self
}
}