pub struct ShowcaseEntry {Show 16 fields
pub id: Uuid,
pub slug: String,
pub org_id: Option<Uuid>,
pub submitted_by: Option<Uuid>,
pub title: String,
pub description: String,
pub body: Option<String>,
pub screenshots: Vec<String>,
pub demo_url: Option<String>,
pub source_url: Option<String>,
pub tags: Vec<String>,
pub is_featured: bool,
pub is_published: bool,
pub likes_count: i32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Fields§
§id: Uuid§slug: String§org_id: Option<Uuid>§submitted_by: Option<Uuid>§title: String§description: String§body: Option<String>§screenshots: Vec<String>§demo_url: Option<String>§source_url: Option<String>§is_featured: bool§is_published: bool§likes_count: i32§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl ShowcaseEntry
impl ShowcaseEntry
Sourcepub async fn list_published(
pool: &Pool<Postgres>,
tag: Option<&str>,
limit: i64,
) -> Result<Vec<ShowcaseEntry>, Error>
pub async fn list_published( pool: &Pool<Postgres>, tag: Option<&str>, limit: i64, ) -> Result<Vec<ShowcaseEntry>, Error>
Public list. Defaults to published only; tag filter is optional. Featured entries surface first, then by likes_count, then recency.
pub async fn find_by_slug( pool: &Pool<Postgres>, slug: &str, ) -> Result<Option<ShowcaseEntry>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<ShowcaseEntry>, Error>
Sourcepub async fn list_all(
pool: &Pool<Postgres>,
limit: i64,
) -> Result<Vec<ShowcaseEntry>, Error>
pub async fn list_all( pool: &Pool<Postgres>, limit: i64, ) -> Result<Vec<ShowcaseEntry>, Error>
Admin: list every entry regardless of published status. Used by the admin authoring UI so submissions are visible before publish.
Sourcepub async fn set_published(
pool: &Pool<Postgres>,
id: Uuid,
published: bool,
) -> Result<Option<ShowcaseEntry>, Error>
pub async fn set_published( pool: &Pool<Postgres>, id: Uuid, published: bool, ) -> Result<Option<ShowcaseEntry>, Error>
Admin authoring: flip is_published. Idempotent — repeated calls with the same value just bump updated_at.
Sourcepub async fn set_featured(
pool: &Pool<Postgres>,
id: Uuid,
featured: bool,
) -> Result<Option<ShowcaseEntry>, Error>
pub async fn set_featured( pool: &Pool<Postgres>, id: Uuid, featured: bool, ) -> Result<Option<ShowcaseEntry>, Error>
Admin authoring: flip is_featured (homepage spotlight).
pub async fn delete(pool: &Pool<Postgres>, id: Uuid) -> Result<bool, Error>
pub async fn create( pool: &Pool<Postgres>, input: CreateShowcaseEntry<'_>, ) -> Result<ShowcaseEntry, Error>
Sourcepub async fn toggle_like(
pool: &Pool<Postgres>,
entry_id: Uuid,
user_id: Uuid,
) -> Result<(bool, i32), Error>
pub async fn toggle_like( pool: &Pool<Postgres>, entry_id: Uuid, user_id: Uuid, ) -> Result<(bool, i32), Error>
Toggle a like. Returns (now_liked, new_count). The count is
authoritative — computed in the same transaction as the
insert/delete so it never lies about the state the client just set.
Same shape as ScenarioStar::toggle.
Trait Implementations§
Source§impl Clone for ShowcaseEntry
impl Clone for ShowcaseEntry
Source§fn clone(&self) -> ShowcaseEntry
fn clone(&self) -> ShowcaseEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShowcaseEntry
impl Debug for ShowcaseEntry
Source§impl<'de> Deserialize<'de> for ShowcaseEntry
impl<'de> Deserialize<'de> for ShowcaseEntry
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShowcaseEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShowcaseEntry, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, R> FromRow<'a, R> for ShowcaseEntrywhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Vec<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i32: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
impl<'a, R> FromRow<'a, R> for ShowcaseEntrywhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Vec<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i32: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Source§impl Serialize for ShowcaseEntry
impl Serialize for ShowcaseEntry
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ShowcaseEntry
impl RefUnwindSafe for ShowcaseEntry
impl Send for ShowcaseEntry
impl Sync for ShowcaseEntry
impl Unpin for ShowcaseEntry
impl UnsafeUnpin for ShowcaseEntry
impl UnwindSafe for ShowcaseEntry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.