From 1e31b71afd1ead4644e99df6838a55481176e09a Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sun, 23 Nov 2025 16:41:43 +0100 Subject: add fonts and create-user endpoint --- src/routes/api/auth/create-user.zig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/routes/api/auth/create-user.zig (limited to 'src/routes/api/auth/create-user.zig') diff --git a/src/routes/api/auth/create-user.zig b/src/routes/api/auth/create-user.zig new file mode 100644 index 0000000..6bd9a82 --- /dev/null +++ b/src/routes/api/auth/create-user.zig @@ -0,0 +1,29 @@ +const std = @import("std"); + +const memora = @import("memora"); +const Context = memora.Context; +const Storage = memora.Storage; + +pub const access = .admins; + +pub const Body = struct { + name: []const u8, + full_name: []const u8, + birthday: []const u8, + password: []const u8, +}; + +pub fn post(ctx: *Context, body: Body) anyerror!void { + var user = try Storage.User.new( + ctx.storage, + body.name, + body.full_name, + body.birthday, + body.password, + false, + ctx.storage.allocator, + ); + defer user.deinit(); + + try user.sync(); +} -- cgit v1.2.3-70-g09d2