preparing time module

This commit is contained in:
2025-08-15 15:11:56 +02:00
parent 28cb00ae2a
commit 90bbefd8a8

View File

@@ -47,7 +47,19 @@ public class TimeModule extends BaseHandler implements TimeService {
@Override
public boolean doGet(Path path, HttpExchange ex) throws IOException {
return super.doGet(path, ex);
addCors(ex);
try {
Optional<Token> token = SessionToken.from(ex).map(Token::of);
var user = registry.userService().loadUser(token);
if (user.isEmpty()) return unauthorized(ex);
var head = path.pop();
return switch (head) {
case null -> getUserTimes(user.get(),ex);
default -> super.doGet(path,ex);
};
} catch (UmbrellaException e){
return send(ex,e);
}
}
@Override
@@ -67,6 +79,10 @@ public class TimeModule extends BaseHandler implements TimeService {
}
}
private boolean getUserTimes(UmbrellaUser user, HttpExchange ex) {
// TODO
}
/*
{
1 : {