forked from vieter-v/vieter
fix(server): publish build log now uses epoch value for dates
parent
7ad5830e9f
commit
e734e658a0
|
@ -42,8 +42,8 @@ pub fn (c &Client) get_build_log_content(id int) ?string {
|
||||||
pub fn (c &Client) add_build_log(repo_id int, start_time time.Time, end_time time.Time, arch string, exit_code int, content string) ?Response<string> {
|
pub fn (c &Client) add_build_log(repo_id int, start_time time.Time, end_time time.Time, arch string, exit_code int, content string) ?Response<string> {
|
||||||
params := {
|
params := {
|
||||||
'repo': repo_id.str()
|
'repo': repo_id.str()
|
||||||
'startTime': start_time.str()
|
'startTime': start_time.unix_time().str()
|
||||||
'endTime': end_time.str()
|
'endTime': end_time.unix_time().str()
|
||||||
'arch': arch
|
'arch': arch
|
||||||
'exitCode': exit_code.str()
|
'exitCode': exit_code.str()
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,13 +70,19 @@ fn (mut app App) post_log() web.Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse query params
|
// Parse query params
|
||||||
start_time := parse_query_time(app.query['startTime']) or {
|
start_time_int := app.query['startTime'].int()
|
||||||
|
|
||||||
|
if start_time_int == 0 {
|
||||||
return app.json(http.Status.bad_request, new_response('Invalid or missing start time.'))
|
return app.json(http.Status.bad_request, new_response('Invalid or missing start time.'))
|
||||||
}
|
}
|
||||||
|
start_time := time.unix(start_time_int)
|
||||||
|
|
||||||
end_time := parse_query_time(app.query['endTime']) or {
|
end_time_int := app.query['endTime'].int()
|
||||||
|
|
||||||
|
if end_time_int == 0 {
|
||||||
return app.json(http.Status.bad_request, new_response('Invalid or missing end time.'))
|
return app.json(http.Status.bad_request, new_response('Invalid or missing end time.'))
|
||||||
}
|
}
|
||||||
|
end_time := time.unix(end_time_int)
|
||||||
|
|
||||||
if 'exitCode' !in app.query {
|
if 'exitCode' !in app.query {
|
||||||
return app.json(http.Status.bad_request, new_response('Missing exit code.'))
|
return app.json(http.Status.bad_request, new_response('Missing exit code.'))
|
||||||
|
|
Loading…
Reference in New Issue