~vpzom/lotide

d139ce2cf2c58138e694df11762a2f773cc359ef — Colin Reeder 26 days ago d8c494a trad
Add old sort type
1 files changed, 3 insertions(+), 0 deletions(-)

M src/routes/api/mod.rs
M src/routes/api/mod.rs => src/routes/api/mod.rs +3 -0
@@ 27,6 27,7 @@ lazy_static::lazy_static! {
enum SortType {
    Hot,
    New,
    Old,
}

impl SortType {


@@ 34,6 35,7 @@ impl SortType {
        match self {
            SortType::Hot => "hot_rank((SELECT COUNT(*) FROM post_like WHERE post = post.id AND person != post.author), post.created) DESC",
            SortType::New => "post.created DESC",
            SortType::Old => "post.created ASC",
        }
    }



@@ 41,6 43,7 @@ impl SortType {
        match self {
            SortType::Hot => "hot_rank((SELECT COUNT(*) FROM reply_like WHERE reply = reply.id AND person != reply.author), reply.created) DESC",
            SortType::New => "reply.created DESC",
            SortType::Old => "reply.created ASC",
        }
    }
}