Start of web app
This commit is contained in:
@ -24,10 +24,11 @@ post "/api/finish" do |env|
|
||||
env.response.status_code = 204
|
||||
end
|
||||
|
||||
get "/api/remaining-time" do |env|
|
||||
get "/api/status" do |env|
|
||||
profile = app.profile Dayoff::ProfileId.new(env.get("profile_id").to_s)
|
||||
rem_span = profile.remaining_time now
|
||||
data = {
|
||||
started: profile.started?,
|
||||
hours: rem_span.total_hours.to_i32,
|
||||
minutes: rem_span.minutes.to_i32,
|
||||
}
|
||||
@ -35,4 +36,8 @@ get "/api/remaining-time" do |env|
|
||||
data.to_json
|
||||
end
|
||||
|
||||
get "/" do
|
||||
render "public/index.ecr"
|
||||
end
|
||||
|
||||
Kemal.run
|
||||
|
@ -34,8 +34,12 @@ module Dayoff
|
||||
end
|
||||
end
|
||||
|
||||
def started? : Bool
|
||||
!started_point.nil?
|
||||
end
|
||||
|
||||
def start(time : Time) : Nil
|
||||
if started_point
|
||||
if started?
|
||||
raise AlreadyStarted.new
|
||||
end
|
||||
@wrecords.each do |wr|
|
||||
|
Reference in New Issue
Block a user