diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-15 11:54:00 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-15 11:56:24 +0100 |
| commit | e8ff326f0e5bd61fb0a8c22c48f296fcf0249830 (patch) | |
| tree | 19d8c026f8460ec577f446a7d61e68c38acddde0 /src/routes/api/session/current.zig | |
| parent | 007bc3fe0615f38cb31d5116759ed3500f6fd3e6 (diff) | |
backend implement auth-service
Diffstat (limited to 'src/routes/api/session/current.zig')
| -rw-r--r-- | src/routes/api/session/current.zig | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/routes/api/session/current.zig b/src/routes/api/session/current.zig new file mode 100644 index 0000000..31c8476 --- /dev/null +++ b/src/routes/api/session/current.zig @@ -0,0 +1,23 @@ +const std = @import("std"); +const Context = @import("../../context.zig"); + +pub const access = .users; + +const Result = struct { + name: []const u8, + full_name: []const u8, + birthday: []const u8, +}; + +pub fn get(ctx: *Context) !Result { + const session = ctx.storage.sessions.get( + ctx.storage, + ctx.fingerprint, + ) orelse return error.UserDoesNotExist; + + return .{ + .name = session.info.name, + .full_name = session.info.full_name, + .birthday = session.info.birthday, + }; +} |