feat(server): added proper filtering the BuildLog API
This commit is contained in:
parent
4f32dec5b5
commit
a39c1aa5eb
4 changed files with 40 additions and 14 deletions
|
|
@ -35,7 +35,6 @@ pub mut:
|
|||
repo int
|
||||
before time.Time
|
||||
after time.Time
|
||||
exit_codes_whitelist []u8
|
||||
exit_codes_blacklist []u8
|
||||
arch string
|
||||
exit_codes []string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
module models
|
||||
|
||||
import time
|
||||
|
||||
// from_params<T> creates a new instance of T from the given map by parsing all
|
||||
// of its fields from the map.
|
||||
pub fn from_params<T>(params map[string]string) ?T {
|
||||
|
|
@ -23,7 +25,12 @@ pub fn patch_from_params<T>(mut o T, params map[string]string) ? {
|
|||
o.$(field.name) = params[field.name].u64()
|
||||
} $else $if field.typ is []GitRepoArch {
|
||||
o.$(field.name) = params[field.name].split(',').map(GitRepoArch{ value: it })
|
||||
} $else $if field.typ is time.Time {
|
||||
o.$(field.name) = time.unix(params[field.name].int())
|
||||
} $else $if field.typ is []string {
|
||||
o.$(field.name) = params[field.name].split(',')
|
||||
}
|
||||
|
||||
} else if field.attrs.contains('nonull') {
|
||||
return error('Missing parameter: ${field.name}.')
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue