max / makenotwork
| 1 | //! Project and git repository models. |
| 2 | |
| 3 | use ; |
| 4 | use Serialize; |
| 5 | use FromRow; |
| 6 | |
| 7 | use ; |
| 8 | use Slug; |
| 9 | |
| 10 | /// A creator's project (collection of items). |
| 11 | |
| 12 | |
| 13 | /// Database primary key. |
| 14 | pub id: ProjectId, |
| 15 | /// Owning user's ID. |
| 16 | pub user_id: UserId, |
| 17 | /// URL-safe slug unique per user. |
| 18 | pub slug: Slug, |
| 19 | /// Display title. |
| 20 | pub title: String, |
| 21 | /// Optional longer description. |
| 22 | pub description: , |
| 23 | /// Category type (e.g. software, music, blog). |
| 24 | pub project_type: ProjectType, |
| 25 | /// URL to the project's cover image. |
| 26 | pub cover_image_url: , |
| 27 | /// Malware scan status for the cover image (`cover_s3_key`/`cover_image_url`), |
| 28 | /// which renders straight from the CDN. `String` (not `FileScanStatus`) so a |
| 29 | /// forward-compat DB value can't fail the row decode; the render gate treats |
| 30 | /// anything other than `"clean"` as hidden. Default `'pending'`. |
| 31 | pub cover_scan_status: String, |
| 32 | /// Whether this project is publicly visible. |
| 33 | pub is_public: bool, |
| 34 | /// When the project was created. |
| 35 | pub created_at: , |
| 36 | /// When the project was last modified. |
| 37 | pub updated_at: , |
| 38 | /// Generation counter for ETag-based HTTP caching. Bumped on any project-visible write. |
| 39 | pub cache_generation: i64, |
| 40 | /// Linked MT community ID (None if not yet provisioned or MT unavailable). |
| 41 | pub mt_community_id: , |
| 42 | /// Platform features enabled for this project (e.g. audio, blog, downloads). |
| 43 | pub features: , |
| 44 | /// Pricing model: free, buy_once, pwyw, or subscription. |
| 45 | pub pricing_model: PricingKind, |
| 46 | /// Price in cents (for buy_once); 0 for free projects. |
| 47 | pub price_cents: i32, |
| 48 | /// Minimum price in cents when PWYW is enabled (floor). |
| 49 | pub pwyw_min_cents: , |
| 50 | /// Whether this project requires license verification (phone-home) on content access. |
| 51 | pub license_verification_enabled: bool, |
| 52 | /// AI content tier: handmade, assisted, or generated. |
| 53 | pub ai_tier: AiTier, |
| 54 | /// Required disclosure text when ai_tier is assisted. |
| 55 | pub ai_disclosure: , |
| 56 | /// Chosen built-in theme id for this project's public pages (and its items, |
| 57 | /// which inherit it). `None` = the platform default. See `crate::theming`. |
| 58 | pub theme_id: , |
| 59 | /// Creator-authored project-page HTML (original source, pre-sanitization). |
| 60 | /// Empty string = default rendering. Item pages inherit this project's CSS |
| 61 | /// but have no HTML of their own. Served from `u.makenot.work`. |
| 62 | pub custom_html: String, |
| 63 | /// Creator-authored project-page CSS (original source, pre-sanitization). |
| 64 | /// Re-scoped onto this project's item pages at render time. |
| 65 | pub custom_css: String, |
| 66 | /// When the custom page was last saved (cache-key + moderation review). |
| 67 | pub custom_pages_updated_at: , |
| 68 | |
| 69 | |
| 70 | /// A git repository tracked on disk, optionally linked to a project. |
| 71 | |
| 72 | |
| 73 | /// Database primary key. |
| 74 | pub id: GitRepoId, |
| 75 | /// Owning user's ID. |
| 76 | pub user_id: UserId, |
| 77 | /// Bare repository name (no path separators). |
| 78 | pub name: String, |
| 79 | /// Linked project (many repos can link to one project). |
| 80 | pub project_id: , |
| 81 | /// When the repo was registered. |
| 82 | pub created_at: , |
| 83 | /// Visibility: public, unlisted, or private. |
| 84 | pub visibility: Visibility, |
| 85 | /// Short description of the repository (editable via settings). |
| 86 | pub description: String, |
| 87 | |
| 88 | |
| 89 | /// A project row with an aggregated public item count (avoids N+1 queries). |
| 90 | |
| 91 | // Fields populated by sqlx query, read during type conversion |
| 92 | |
| 93 | /// Database primary key. |
| 94 | pub id: ProjectId, |
| 95 | /// Owning user's ID. |
| 96 | pub user_id: UserId, |
| 97 | /// URL-safe slug unique per user. |
| 98 | pub slug: Slug, |
| 99 | /// Display title. |
| 100 | pub title: String, |
| 101 | /// Optional longer description. |
| 102 | pub description: , |
| 103 | /// Category type. |
| 104 | pub project_type: ProjectType, |
| 105 | /// URL to the project's cover image. |
| 106 | pub cover_image_url: , |
| 107 | /// Malware scan status for the cover image; the render gate hides anything |
| 108 | /// other than `"clean"`. Selected explicitly by |
| 109 | /// `get_public_projects_with_item_counts`. |
| 110 | pub cover_scan_status: String, |
| 111 | /// Whether this project is publicly visible. |
| 112 | pub is_public: bool, |
| 113 | /// When the project was created. |
| 114 | pub created_at: , |
| 115 | /// When the project was last modified. |
| 116 | pub updated_at: , |
| 117 | /// Number of public items in this project. |
| 118 | pub item_count: i64, |
| 119 | |
| 120 | |
| 121 | /// A tabbed content section within a project. |
| 122 | |
| 123 | |
| 124 | /// Database primary key. |
| 125 | pub id: ProjectSectionId, |
| 126 | /// Parent project ID. |
| 127 | pub project_id: ProjectId, |
| 128 | /// Section tab title. |
| 129 | pub title: String, |
| 130 | /// URL-safe slug (unique per project). |
| 131 | pub slug: String, |
| 132 | /// Markdown body content. |
| 133 | pub body: String, |
| 134 | /// Display order among sibling sections. |
| 135 | pub sort_order: i32, |
| 136 | /// When this section was created. |
| 137 | pub created_at: , |
| 138 | /// When this section was last modified. |
| 139 | pub updated_at: , |
| 140 | |
| 141 |