2021-04-16 15:20:25 +02:00
|
|
|
use std::cmp::Ordering;
|
|
|
|
use std::str::FromStr;
|
2020-03-28 21:41:16 +01:00
|
|
|
|
2021-04-16 15:20:25 +02:00
|
|
|
use chrono::NaiveDateTime;
|
|
|
|
use derive_enum_iter::EnumIter;
|
|
|
|
use derive_enum_primitive::EnumPrimitive;
|
2021-01-16 14:31:31 +01:00
|
|
|
#[cfg(feature = "backend")]
|
|
|
|
use derive_enum_sql::EnumSql;
|
2021-04-16 15:20:25 +02:00
|
|
|
#[cfg(feature = "backend")]
|
|
|
|
use diesel::*;
|
|
|
|
pub use fields::*;
|
|
|
|
pub use msg::WsMsg;
|
|
|
|
pub use payloads::*;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use uuid::Uuid;
|
2020-04-01 13:29:43 +02:00
|
|
|
|
2021-01-06 18:47:54 +01:00
|
|
|
pub mod fields;
|
2020-10-21 23:59:17 +02:00
|
|
|
pub mod msg;
|
2020-08-11 22:15:56 +02:00
|
|
|
mod payloads;
|
|
|
|
|
2020-12-24 16:24:04 +01:00
|
|
|
pub type NumberOfDeleted = usize;
|
2020-04-11 11:18:41 +02:00
|
|
|
pub type IssueId = i32;
|
2021-01-15 22:57:26 +01:00
|
|
|
pub type ListPosition = i32;
|
2020-04-11 11:18:41 +02:00
|
|
|
pub type ProjectId = i32;
|
2021-01-06 18:47:54 +01:00
|
|
|
pub type ProjectName = String;
|
2020-04-11 11:18:41 +02:00
|
|
|
pub type UserId = i32;
|
2020-05-21 17:02:16 +02:00
|
|
|
pub type UserProjectId = i32;
|
2020-04-11 11:18:41 +02:00
|
|
|
pub type CommentId = i32;
|
|
|
|
pub type TokenId = i32;
|
2020-05-06 22:24:58 +02:00
|
|
|
pub type IssueStatusId = i32;
|
2021-01-06 18:47:54 +01:00
|
|
|
pub type IssueStatusName = String;
|
2020-04-21 08:35:08 +02:00
|
|
|
pub type InvitationId = i32;
|
2020-05-07 17:08:40 +02:00
|
|
|
pub type Position = i32;
|
2020-05-20 15:41:54 +02:00
|
|
|
pub type MessageId = i32;
|
2020-08-10 22:34:19 +02:00
|
|
|
pub type EpicId = i32;
|
2021-01-06 18:47:54 +01:00
|
|
|
pub type EpicName = String;
|
2020-08-11 22:15:56 +02:00
|
|
|
|
2020-04-15 20:28:07 +02:00
|
|
|
pub type EmailString = String;
|
|
|
|
pub type UsernameString = String;
|
2020-05-07 17:08:40 +02:00
|
|
|
pub type TitleString = String;
|
2020-08-11 22:15:56 +02:00
|
|
|
pub type NameString = String;
|
2020-12-24 16:24:04 +01:00
|
|
|
pub type AvatarUrl = String;
|
2021-01-19 21:57:48 +01:00
|
|
|
pub type DescriptionString = String;
|
2020-12-24 16:24:04 +01:00
|
|
|
|
|
|
|
pub type Code = String;
|
|
|
|
pub type Lang = String;
|
2020-08-11 22:15:56 +02:00
|
|
|
|
2020-05-22 17:35:32 +02:00
|
|
|
pub type BindToken = Uuid;
|
|
|
|
pub type InvitationToken = Uuid;
|
2020-04-11 11:18:41 +02:00
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-01 13:29:43 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "IssueTypeType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive,
|
|
|
|
)]
|
2020-03-31 14:28:30 +02:00
|
|
|
pub enum IssueType {
|
|
|
|
Task,
|
|
|
|
Bug,
|
|
|
|
Story,
|
|
|
|
}
|
|
|
|
|
2020-04-04 17:42:02 +02:00
|
|
|
impl Default for IssueType {
|
|
|
|
fn default() -> Self {
|
|
|
|
IssueType::Task
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:35:41 +02:00
|
|
|
impl std::fmt::Display for IssueType {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
f.write_str(self.to_str())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-01 13:29:43 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "IssuePriorityType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive,
|
|
|
|
)]
|
2020-03-31 14:28:30 +02:00
|
|
|
pub enum IssuePriority {
|
|
|
|
Highest,
|
|
|
|
High,
|
|
|
|
Medium,
|
|
|
|
Low,
|
|
|
|
Lowest,
|
|
|
|
}
|
|
|
|
|
2020-04-04 17:42:02 +02:00
|
|
|
impl Default for IssuePriority {
|
|
|
|
fn default() -> Self {
|
|
|
|
IssuePriority::Medium
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:35:41 +02:00
|
|
|
impl std::fmt::Display for IssuePriority {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
f.write_str(self.to_str())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-20 11:22:39 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "UserRoleType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(Clone, Copy, Deserialize, Serialize, Debug, PartialEq, Hash, EnumIter, EnumPrimitive)]
|
2020-04-20 11:22:39 +02:00
|
|
|
pub enum UserRole {
|
|
|
|
User,
|
|
|
|
Manager,
|
|
|
|
Owner,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PartialOrd for UserRole {
|
|
|
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
|
|
|
use UserRole::*;
|
|
|
|
|
|
|
|
if self == other {
|
|
|
|
return Some(Ordering::Equal);
|
|
|
|
}
|
|
|
|
let order = match (self, other) {
|
|
|
|
(User, Manager) | (User, Owner) | (Manager, Owner) => Ordering::Less,
|
|
|
|
_ => Ordering::Greater,
|
|
|
|
};
|
|
|
|
Some(order)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for UserRole {
|
|
|
|
fn default() -> Self {
|
|
|
|
UserRole::User
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:35:41 +02:00
|
|
|
impl std::fmt::Display for UserRole {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
f.write_str(self.to_str())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-14 16:20:05 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "ProjectCategoryType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive,
|
|
|
|
)]
|
2020-04-14 16:20:05 +02:00
|
|
|
pub enum ProjectCategory {
|
|
|
|
Software,
|
|
|
|
Marketing,
|
|
|
|
Business,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for ProjectCategory {
|
|
|
|
fn default() -> Self {
|
|
|
|
ProjectCategory::Software
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-18 10:35:41 +02:00
|
|
|
impl std::fmt::Display for ProjectCategory {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
f.write_str(self.to_str())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-21 08:35:08 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "InvitationStateType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive,
|
|
|
|
)]
|
2020-04-21 08:35:08 +02:00
|
|
|
pub enum InvitationState {
|
|
|
|
Sent,
|
|
|
|
Accepted,
|
|
|
|
Revoked,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for InvitationState {
|
|
|
|
fn default() -> Self {
|
|
|
|
InvitationState::Sent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::fmt::Display for InvitationState {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2021-01-07 23:34:36 +01:00
|
|
|
f.write_str(self.to_str())
|
2020-04-21 08:35:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-04-24 22:32:29 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "TimeTrackingType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive,
|
|
|
|
)]
|
2020-04-24 22:32:29 +02:00
|
|
|
pub enum TimeTracking {
|
|
|
|
Untracked,
|
|
|
|
Fibonacci,
|
|
|
|
Hourly,
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
impl Default for TimeTracking {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::Untracked
|
|
|
|
}
|
|
|
|
}
|
2020-04-25 16:12:06 +02:00
|
|
|
|
2020-04-08 20:26:28 +02:00
|
|
|
#[derive(Clone, Serialize, Debug, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct ErrorResponse {
|
|
|
|
pub errors: Vec<String>,
|
|
|
|
}
|
|
|
|
|
2020-12-18 22:31:29 +01:00
|
|
|
impl ErrorResponse {
|
|
|
|
pub fn single<S: Into<String>>(err: S) -> Self {
|
|
|
|
Self {
|
|
|
|
errors: vec![err.into()],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-21 09:19:15 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
2020-04-08 20:26:28 +02:00
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct Project {
|
2020-04-11 11:18:41 +02:00
|
|
|
pub id: ProjectId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub name: String,
|
|
|
|
pub url: String,
|
|
|
|
pub description: String,
|
2020-04-14 16:20:05 +02:00
|
|
|
pub category: ProjectCategory,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
2020-04-24 22:32:29 +02:00
|
|
|
pub time_tracking: TimeTracking,
|
2020-03-28 21:41:16 +01:00
|
|
|
}
|
|
|
|
|
2021-04-19 22:31:18 +02:00
|
|
|
impl Project {
|
|
|
|
pub fn name(&self) -> &str {
|
|
|
|
&self.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-08 20:26:28 +02:00
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct Issue {
|
2021-01-16 14:31:31 +01:00
|
|
|
pub id: EpicId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub title: String,
|
2020-04-01 13:29:43 +02:00
|
|
|
pub issue_type: IssueType,
|
|
|
|
pub priority: IssuePriority,
|
2021-01-19 21:57:48 +01:00
|
|
|
pub list_position: ListPosition,
|
|
|
|
pub description: Option<DescriptionString>,
|
|
|
|
pub description_text: Option<DescriptionString>,
|
2020-04-25 22:20:16 +02:00
|
|
|
pub estimate: Option<i32>,
|
|
|
|
pub time_spent: Option<i32>,
|
|
|
|
pub time_remaining: Option<i32>,
|
2020-04-11 11:18:41 +02:00
|
|
|
pub reporter_id: UserId,
|
|
|
|
pub project_id: ProjectId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
2020-05-06 22:24:58 +02:00
|
|
|
pub issue_status_id: IssueStatusId,
|
2020-08-10 22:34:19 +02:00
|
|
|
pub epic_id: Option<EpicId>,
|
2020-03-28 21:41:16 +01:00
|
|
|
|
|
|
|
pub user_ids: Vec<i32>,
|
|
|
|
}
|
|
|
|
|
2020-05-06 22:24:58 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
|
|
|
|
pub struct IssueStatus {
|
|
|
|
pub id: IssueStatusId,
|
|
|
|
pub name: String,
|
|
|
|
pub position: ProjectId,
|
|
|
|
pub project_id: ProjectId,
|
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2020-04-21 09:19:15 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct Invitation {
|
2021-01-19 21:57:48 +01:00
|
|
|
pub id: InvitationId,
|
2020-04-21 09:19:15 +02:00
|
|
|
pub name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub state: InvitationState,
|
2021-01-19 21:57:48 +01:00
|
|
|
pub project_id: ProjectId,
|
|
|
|
pub invited_by_id: UserId,
|
2020-04-21 09:19:15 +02:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
2020-04-22 09:26:53 +02:00
|
|
|
pub bind_token: Uuid,
|
2020-05-21 21:38:46 +02:00
|
|
|
pub role: UserRole,
|
2020-04-21 09:19:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
2020-04-08 20:26:28 +02:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct Comment {
|
2020-04-11 11:18:41 +02:00
|
|
|
pub id: CommentId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub body: String,
|
2020-04-11 11:18:41 +02:00
|
|
|
pub user_id: UserId,
|
2021-01-16 14:31:31 +01:00
|
|
|
pub issue_id: EpicId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2020-04-21 09:19:15 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
2020-04-08 08:58:02 +02:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct User {
|
2020-04-11 11:18:41 +02:00
|
|
|
pub id: UserId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub name: String,
|
|
|
|
pub email: String,
|
|
|
|
pub avatar_url: Option<String>,
|
2020-05-21 17:02:16 +02:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2021-04-19 22:31:18 +02:00
|
|
|
impl User {
|
|
|
|
pub fn name(&self) -> &str {
|
|
|
|
&self.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 17:02:16 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct UserProject {
|
|
|
|
pub id: UserProjectId,
|
|
|
|
pub user_id: UserId,
|
2020-04-11 11:18:41 +02:00
|
|
|
pub project_id: ProjectId,
|
2020-05-21 17:02:16 +02:00
|
|
|
pub is_default: bool,
|
|
|
|
pub is_current: bool,
|
|
|
|
pub role: UserRole,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2020-04-21 09:19:15 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
2020-04-08 20:26:28 +02:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
2020-03-28 21:41:16 +01:00
|
|
|
pub struct Token {
|
2020-04-11 11:18:41 +02:00
|
|
|
pub id: TokenId,
|
|
|
|
pub user_id: UserId,
|
2020-03-28 21:41:16 +01:00
|
|
|
pub access_token: Uuid,
|
|
|
|
pub refresh_token: Uuid,
|
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
2020-04-21 09:19:15 +02:00
|
|
|
pub bind_token: Option<Uuid>,
|
2020-03-28 21:41:16 +01:00
|
|
|
}
|
|
|
|
|
2020-04-21 09:19:15 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct IssueAssignee {
|
|
|
|
pub id: i32,
|
2021-01-16 14:31:31 +01:00
|
|
|
pub issue_id: EpicId,
|
2020-05-20 15:41:54 +02:00
|
|
|
pub user_id: UserId,
|
2020-04-21 09:19:15 +02:00
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
|
2020-05-26 09:57:58 +02:00
|
|
|
#[cfg_attr(feature = "backend", sql_type = "MessageTypeType")]
|
2021-01-07 23:34:36 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumPrimitive,
|
|
|
|
)]
|
2020-05-26 09:57:58 +02:00
|
|
|
pub enum MessageType {
|
|
|
|
ReceivedInvitation,
|
|
|
|
AssignedToIssue,
|
|
|
|
Mention,
|
|
|
|
}
|
|
|
|
|
2021-01-07 23:34:36 +01:00
|
|
|
impl Default for MessageType {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::Mention
|
|
|
|
}
|
|
|
|
}
|
2020-05-26 09:57:58 +02:00
|
|
|
|
|
|
|
impl std::fmt::Display for MessageType {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2021-01-07 23:34:36 +01:00
|
|
|
f.write_str(self.to_label())
|
2020-05-26 09:57:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 17:02:16 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
2020-05-20 15:41:54 +02:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct Message {
|
|
|
|
pub id: MessageId,
|
|
|
|
pub receiver_id: UserId,
|
|
|
|
pub sender_id: UserId,
|
|
|
|
pub summary: String,
|
|
|
|
pub description: String,
|
2020-05-26 09:57:58 +02:00
|
|
|
pub message_type: MessageType,
|
2020-05-20 15:41:54 +02:00
|
|
|
pub hyper_link: String,
|
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
2020-08-10 22:34:19 +02:00
|
|
|
#[cfg_attr(feature = "backend", derive(Queryable))]
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct Epic {
|
|
|
|
pub id: EpicId,
|
2020-08-11 22:15:56 +02:00
|
|
|
pub name: NameString,
|
2020-08-10 22:34:19 +02:00
|
|
|
pub user_id: UserId,
|
|
|
|
pub project_id: ProjectId,
|
|
|
|
pub created_at: NaiveDateTime,
|
|
|
|
pub updated_at: NaiveDateTime,
|
2020-08-17 23:18:51 +02:00
|
|
|
pub starts_at: Option<NaiveDateTime>,
|
|
|
|
pub ends_at: Option<NaiveDateTime>,
|
2021-01-19 21:57:48 +01:00
|
|
|
pub description: Option<DescriptionString>,
|
|
|
|
pub description_html: Option<DescriptionString>,
|
2020-08-10 22:34:19 +02:00
|
|
|
}
|
2021-01-06 18:47:54 +01:00
|
|
|
|
|
|
|
pub type FontStyle = u8;
|
|
|
|
|
|
|
|
pub static BOLD: FontStyle = 1;
|
|
|
|
pub static UNDERLINE: FontStyle = 2;
|
|
|
|
pub static ITALIC: FontStyle = 4;
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
pub struct Color {
|
|
|
|
/// Red component
|
|
|
|
pub r: u8,
|
|
|
|
/// Green component
|
|
|
|
pub g: u8,
|
|
|
|
/// Blue component
|
|
|
|
pub b: u8,
|
|
|
|
/// Alpha (transparency) component
|
|
|
|
pub a: u8,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct Style {
|
|
|
|
/// Foreground color
|
|
|
|
pub foreground: Color,
|
|
|
|
/// Background color
|
|
|
|
pub background: Color,
|
|
|
|
/// Style of the font
|
|
|
|
pub font_style: FontStyle,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
|
|
pub struct HighlightedCode {
|
|
|
|
pub parts: Vec<(Style, String)>,
|
|
|
|
}
|