-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add /all/users and /all/packages endpoints
- Loading branch information
Showing
8 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const http = @import("apple_pie"); | ||
|
||
const db = @import("./../db/_db.zig"); | ||
|
||
const _internal = @import("./_internal.zig"); | ||
|
||
pub fn users(_: void, response: *http.Response, request: http.Request, args: struct {}) !void { | ||
_ = args; | ||
const alloc = request.arena; | ||
|
||
try _internal.writePageResponse(alloc, response, request, "/all_users.pek", .{ | ||
.aquila_version = @import("root").version, | ||
.title = "All Users", | ||
.user = try _internal.getUserOp(response, request), | ||
.list = try db.User.all(alloc, .asc), | ||
}); | ||
} | ||
|
||
pub fn packages(_: void, response: *http.Response, request: http.Request, args: struct {}) !void { | ||
_ = args; | ||
const alloc = request.arena; | ||
|
||
try _internal.writePageResponse(alloc, response, request, "/all_packages.pek", .{ | ||
.aquila_version = @import("root").version, | ||
.title = "All Packages", | ||
.user = try _internal.getUserOp(response, request), | ||
.list = try db.Package.all(alloc, .desc), | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
h1("All Packages") | ||
div( | ||
{#each list} | ||
div[class="terminal-card"]( | ||
div( | ||
h3[class="wide-title" style="margin-bottom: 0;"]( | ||
a[href=("../"{#get_user_path this.owner}"/"{this.name})]({#get_user_path this.owner}"/"{this.name}) | ||
div( | ||
i[class="tag icon"]{this.latest_version}" " | ||
i[class="balance scale icon"]" "{#if this.license}{this.license}<else>"No"/if/" License" | ||
) | ||
div | ||
) | ||
{#if this.description} | ||
div({this.description}" ") | ||
/if/ | ||
) | ||
) | ||
/each/ | ||
) | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
h1("All Users") | ||
ul( | ||
{#each list} | ||
li(a[href=("../"{this.provider}"/"{this.name})]({this.provider}"/"{this.name})) | ||
/each/ | ||
) | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters