order media so that latest added are top #660
1 changed files with 9 additions and 1 deletions
|
@ -62,7 +62,14 @@ impl MediaCategory {
|
|||
impl Media {
|
||||
insert!(medias, NewMedia);
|
||||
get!(medias);
|
||||
list_by!(medias, for_user, owner_id as i32);
|
||||
|
||||
pub fn for_user(conn: &Connection, owner: i32) -> Result<Vec<Media>> {
|
||||
medias::table
|
||||
.filter(medias::owner_id.eq(owner))
|
||||
.order(medias::id.desc())
|
||||
.load::<Self>(conn)
|
||||
trinity-1686a
commented
we don't have date, and the ids we use are monotonic counter, unless we overflow that 64b signed counter (not likely to happen) we don't have date, and the ids we use are monotonic counter, unless we overflow that 64b signed counter (not likely to happen)
![]() i wonder if anyone expects that editing a media pushes it to the top again… i wonder if anyone expects that editing a media pushes it to the top again…
![]() We can't edit media information for the moment, so… We can't edit media information for the moment, so…
![]() well then… pushes [resolve] button well then… *pushes [resolve] button*
|
||||
.map_err(Error::from)
|
||||
}
|
||||
|
||||
pub fn list_all_medias(conn: &Connection) -> Result<Vec<Media>> {
|
||||
medias::table.load::<Media>(conn).map_err(Error::from)
|
||||
|
@ -75,6 +82,7 @@ impl Media {
|
|||
) -> Result<Vec<Media>> {
|
||||
medias::table
|
||||
.filter(medias::owner_id.eq(user.id))
|
||||
.order(medias::id.desc())
|
||||
.offset(i64::from(min))
|
||||
.limit(i64::from(max - min))
|
||||
.load::<Media>(conn)
|
||||
|
|
Loading…
Add table
Reference in a new issue
is this guaranteed to be such?
do we have a create date anywhere?