fediglam/src/main/controllers/timelines.zig

29 lines
898 B
Zig
Raw Normal View History

2022-11-14 07:00:20 +00:00
const std = @import("std");
const api = @import("api");
const query_utils = @import("../query.zig");
2022-11-14 08:25:52 +00:00
const controller_utils = @import("../controllers.zig").helpers;
2022-11-14 07:00:20 +00:00
2022-11-12 12:39:49 +00:00
pub const global = struct {
pub const method = .GET;
pub const path = "/timelines/global";
2022-11-14 07:00:20 +00:00
pub const Query = api.TimelineArgs;
pub fn handler(req: anytype, res: anytype, srv: anytype) !void {
const results = try srv.globalTimeline(req.query);
2022-11-14 08:25:52 +00:00
try controller_utils.paginate(srv.community, path, results, res, req.allocator);
2022-11-12 12:39:49 +00:00
}
};
2022-11-12 13:23:55 +00:00
pub const local = struct {
pub const method = .GET;
pub const path = "/timelines/local";
2022-11-14 07:00:20 +00:00
pub const Query = api.TimelineArgs;
pub fn handler(req: anytype, res: anytype, srv: anytype) !void {
const results = try srv.localTimeline(req.query);
2022-11-14 08:25:52 +00:00
try controller_utils.paginate(srv.community, path, results, res, req.allocator);
2022-11-12 13:23:55 +00:00
}
};