| 1 |
|
| 2 |
|
| 3 |
use chrono::{DateTime, Utc}; |
| 4 |
use serde::Serialize; |
| 5 |
use sqlx::FromRow; |
| 6 |
|
| 7 |
use super::super::enums::CreatorTier; |
| 8 |
use super::super::id_types::*; |
| 9 |
use super::super::validated_types::*; |
| 10 |
|
| 11 |
|
| 12 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 13 |
pub struct DbSshKey { |
| 14 |
|
| 15 |
pub id: SshKeyId, |
| 16 |
|
| 17 |
pub user_id: UserId, |
| 18 |
|
| 19 |
pub public_key: String, |
| 20 |
|
| 21 |
pub fingerprint: String, |
| 22 |
|
| 23 |
pub label: String, |
| 24 |
|
| 25 |
pub created_at: DateTime<Utc>, |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
#[derive(Debug, Clone, FromRow)] |
| 30 |
pub struct SshKeyWithUsername { |
| 31 |
|
| 32 |
pub id: SshKeyId, |
| 33 |
|
| 34 |
pub public_key: String, |
| 35 |
|
| 36 |
pub username: String, |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 41 |
pub struct SshKeyUserLookup { |
| 42 |
pub user_id: UserId, |
| 43 |
pub username: Username, |
| 44 |
pub display_name: Option<String>, |
| 45 |
pub email: Email, |
| 46 |
pub creator_tier: Option<CreatorTier>, |
| 47 |
pub can_create_projects: bool, |
| 48 |
pub suspended: bool, |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
#[derive(Debug, Clone, FromRow)] |
| 53 |
#[allow(dead_code)] |
| 54 |
pub struct DbOAuthCode { |
| 55 |
pub id: OAuthCodeId, |
| 56 |
pub code: String, |
| 57 |
pub app_id: SyncAppId, |
| 58 |
pub user_id: UserId, |
| 59 |
pub code_challenge: String, |
| 60 |
pub code_challenge_method: String, |
| 61 |
pub redirect_uri: String, |
| 62 |
pub expires_at: DateTime<Utc>, |
| 63 |
pub used_at: Option<DateTime<Utc>>, |
| 64 |
pub created_at: DateTime<Utc>, |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 71 |
pub struct DbIssue { |
| 72 |
pub id: IssueId, |
| 73 |
pub repo_id: GitRepoId, |
| 74 |
pub number: i32, |
| 75 |
pub author_user_id: UserId, |
| 76 |
pub title: String, |
| 77 |
pub body_markdown: String, |
| 78 |
pub body_html: String, |
| 79 |
pub status: super::super::IssueStatus, |
| 80 |
pub created_at: DateTime<Utc>, |
| 81 |
pub updated_at: DateTime<Utc>, |
| 82 |
|
| 83 |
|
| 84 |
pub mt_thread_id: Option<uuid::Uuid>, |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
#[derive(Debug, Clone, FromRow)] |
| 89 |
pub struct DbIssueWithMeta { |
| 90 |
pub id: IssueId, |
| 91 |
pub repo_id: GitRepoId, |
| 92 |
pub number: i32, |
| 93 |
pub author_user_id: UserId, |
| 94 |
pub title: String, |
| 95 |
pub status: super::super::IssueStatus, |
| 96 |
pub created_at: DateTime<Utc>, |
| 97 |
pub updated_at: DateTime<Utc>, |
| 98 |
pub author_username: String, |
| 99 |
pub comment_count: i64, |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 104 |
pub struct DbIssueComment { |
| 105 |
pub id: IssueCommentId, |
| 106 |
pub issue_id: IssueId, |
| 107 |
pub author_user_id: UserId, |
| 108 |
pub body_markdown: String, |
| 109 |
pub body_html: String, |
| 110 |
pub created_at: DateTime<Utc>, |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
#[derive(Debug, Clone, FromRow)] |
| 115 |
pub struct DbIssueCommentWithAuthor { |
| 116 |
pub id: IssueCommentId, |
| 117 |
pub issue_id: IssueId, |
| 118 |
pub author_user_id: UserId, |
| 119 |
pub body_markdown: String, |
| 120 |
pub body_html: String, |
| 121 |
pub created_at: DateTime<Utc>, |
| 122 |
pub author_username: String, |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 127 |
pub struct DbIssueLabel { |
| 128 |
pub id: IssueLabelId, |
| 129 |
pub repo_id: GitRepoId, |
| 130 |
pub name: String, |
| 131 |
pub color: String, |
| 132 |
} |
| 133 |
|