scufflecloud_video_api_db_types/models/
streams.rs

1use core_db_types::models::ProjectId;
2use diesel::Selectable;
3use diesel::prelude::{AsChangeset, Identifiable, Insertable, Queryable};
4use id::impl_id;
5
6impl_id!(pub StreamId, "s_");
7
8#[derive(Queryable, Selectable, Insertable, Identifiable, AsChangeset, Debug, serde_derive::Serialize, Clone)]
9#[diesel(table_name = crate::schema::streams)]
10#[diesel(check_for_backend(diesel::pg::Pg))]
11pub struct Stream {
12    pub id: StreamId,
13    pub project_id: ProjectId,
14    pub name: String,
15}
16
17impl From<Stream> for pb::scufflecloud::video::api::v1::Stream {
18    fn from(value: Stream) -> Self {
19        Self {
20            id: value.id.to_string(),
21            project_id: value.project_id.to_string(),
22            name: value.name,
23        }
24    }
25}