| 1 |
|
| 2 |
|
| 3 |
use chrono::{DateTime, Utc}; |
| 4 |
use mt_core::types::{BanType, CommunityRole, CommunityState, ModAction, SortColumn, SortOrder}; |
| 5 |
use sqlx::PgPool; |
| 6 |
use uuid::Uuid; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
pub struct Unscoped<T> { |
| 19 |
inner: T, |
| 20 |
community_id: Uuid, |
| 21 |
} |
| 22 |
|
| 23 |
impl<T> Unscoped<T> { |
| 24 |
|
| 25 |
pub fn new(inner: T, community_id: Uuid) -> Self { |
| 26 |
Self { |
| 27 |
inner, |
| 28 |
community_id, |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
pub fn in_community(self, expected_community: Uuid) -> Option<T> { |
| 36 |
(self.community_id == expected_community).then_some(self.inner) |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
pub fn into_inner_unchecked(self) -> T { |
| 46 |
self.inner |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
mod admin; |
| 51 |
mod category; |
| 52 |
mod community; |
| 53 |
mod endorsement; |
| 54 |
mod footnote; |
| 55 |
mod image; |
| 56 |
mod link_preview; |
| 57 |
mod member; |
| 58 |
mod mention; |
| 59 |
mod moderation; |
| 60 |
mod post; |
| 61 |
mod search; |
| 62 |
mod tag; |
| 63 |
mod thread; |
| 64 |
mod tracked_thread; |
| 65 |
mod user; |
| 66 |
|
| 67 |
pub use admin::*; |
| 68 |
pub use category::*; |
| 69 |
pub use community::*; |
| 70 |
pub use endorsement::*; |
| 71 |
pub use footnote::*; |
| 72 |
pub use image::*; |
| 73 |
pub use link_preview::*; |
| 74 |
pub use member::*; |
| 75 |
pub use mention::*; |
| 76 |
pub use moderation::*; |
| 77 |
pub use post::*; |
| 78 |
pub use search::*; |
| 79 |
pub use tag::*; |
| 80 |
pub use thread::*; |
| 81 |
pub use tracked_thread::*; |
| 82 |
pub use user::*; |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
pub use post::get_post_for_edit; |
| 87 |
pub use thread::get_thread_with_breadcrumb; |
| 88 |
|