integrationos_domain/domain/platform/
mod.rs1pub mod page;
2pub mod r#type;
3
4use crate::{
5 id::{prefix::IdPrefix, Id},
6 {
7 ownership::{Owners, SystemOwner},
8 record_metadata::RecordMetadata,
9 },
10};
11use bson::doc;
12use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
15#[cfg_attr(feature = "dummy", derive(fake::Dummy))]
16#[serde(rename_all = "camelCase")]
17pub struct PlatformData {
18 #[serde(rename = "_id")]
19 pub id: Id,
20 pub connection_definition_id: Id,
21 pub name: String,
22 pub url: String,
23 pub platform_version: String,
24
25 #[serde(flatten, default)]
26 pub record_metadata: RecordMetadata,
27 pub ownership: Owners,
28 pub analyzed: bool,
29}
30
31impl PlatformData {
32 pub fn new(connection_definition_id: Id, name: String, url: String, version: String) -> Self {
33 Self {
34 id: Id::new(IdPrefix::Platform, chrono::Utc::now()),
35 connection_definition_id,
36 name,
37 record_metadata: RecordMetadata::default(),
38 ownership: Owners::System(SystemOwner {
39 entity: "Event-Inc".to_string(),
40 is_internal: true,
41 }),
42 url,
43 platform_version: version,
44 analyzed: false,
45 }
46 }
47}