Compare commits
5 Commits
71c77e90bc
...
163436bd9e
Author | SHA1 | Date |
---|---|---|
|
163436bd9e | |
|
b093ea9f66 | |
|
d28deb87bb | |
|
c1e94ab77e | |
|
955e67f822 |
|
@ -12,14 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
* Migrated codebase to V 0.3.2
|
* Migrated codebase to V 0.3.2
|
||||||
* Cron expression parser now uses bitfields instead of bool arrays
|
* Cron expression parser now uses bitfields instead of bool arrays
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
* Arch value for target is now properly set if not provided
|
|
||||||
* All API endpoints now return proper JSON on success
|
|
||||||
* CLI no longer exits with non-zero status code when removing/patching
|
|
||||||
target
|
|
||||||
* Allow NULL values for branch in database
|
|
||||||
|
|
||||||
## [0.4.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.4.0)
|
## [0.4.0](https://git.rustybever.be/vieter-v/vieter/src/tag/0.4.0)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -227,7 +227,8 @@ fn remove(conf Config, id string) ! {
|
||||||
|
|
||||||
if id_int != 0 {
|
if id_int != 0 {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf.address, conf.api_key)
|
||||||
c.remove_target(id_int)!
|
res := c.remove_target(id_int)!
|
||||||
|
println(res.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +245,9 @@ fn patch(conf Config, id string, params map[string]string) ! {
|
||||||
id_int := id.int()
|
id_int := id.int()
|
||||||
if id_int != 0 {
|
if id_int != 0 {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf.address, conf.api_key)
|
||||||
c.patch_target(id_int, params)!
|
res := c.patch_target(id_int, params)!
|
||||||
|
|
||||||
|
println(res.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,11 @@ const (
|
||||||
$embed_file('migrations/001-initial/up.sql'),
|
$embed_file('migrations/001-initial/up.sql'),
|
||||||
$embed_file('migrations/002-rename-to-targets/up.sql'),
|
$embed_file('migrations/002-rename-to-targets/up.sql'),
|
||||||
$embed_file('migrations/003-target-url-type/up.sql'),
|
$embed_file('migrations/003-target-url-type/up.sql'),
|
||||||
$embed_file('migrations/004-nullable-branch/up.sql'),
|
|
||||||
]
|
]
|
||||||
migrations_down = [
|
migrations_down = [
|
||||||
$embed_file('migrations/001-initial/down.sql'),
|
$embed_file('migrations/001-initial/down.sql'),
|
||||||
$embed_file('migrations/002-rename-to-targets/down.sql'),
|
$embed_file('migrations/002-rename-to-targets/down.sql'),
|
||||||
$embed_file('migrations/003-target-url-type/down.sql'),
|
$embed_file('migrations/003-target-url-type/down.sql'),
|
||||||
$embed_file('migrations/004-nullable-branch/down.sql'),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,7 +60,7 @@ pub fn init(db_path string) !VieterDb {
|
||||||
res := conn.exec_none(part)
|
res := conn.exec_none(part)
|
||||||
|
|
||||||
if res != sqlite.sqlite_done {
|
if res != sqlite.sqlite_done {
|
||||||
return error('An error occurred while applying migration $version_num: SQLite error code $res')
|
return error('An error occurred while applying migration $version_num')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
-- This down won't really work because it'll throw NOT NULL errors, but I'm
|
|
||||||
-- just putting it here for future reference (still not sure whether I'm even
|
|
||||||
-- gonna use these)
|
|
||||||
PRAGMA foreign_keys=off;
|
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE Target RENAME TO _Target_old;
|
|
||||||
|
|
||||||
CREATE TABLE Target (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
branch TEXT NOT NULL,
|
|
||||||
repo TEXT NOT NULL,
|
|
||||||
schedule TEXT,
|
|
||||||
kind TEXT NOT NULL DEFAULT 'git'
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO Target (id, url, branch, repo, schedule, kind)
|
|
||||||
SELECT id, url, branch, repo, schedule, kind FROM _Target_old;
|
|
||||||
|
|
||||||
DROP TABLE _Target_old;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
PRAGMA foreign_keys=on;
|
|
|
@ -1,23 +0,0 @@
|
||||||
PRAGMA foreign_keys=off;
|
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE Target RENAME TO _Target_old;
|
|
||||||
|
|
||||||
CREATE TABLE Target (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
url TEXT NOT NULL,
|
|
||||||
branch TEXT,
|
|
||||||
repo TEXT NOT NULL,
|
|
||||||
schedule TEXT,
|
|
||||||
kind TEXT NOT NULL DEFAULT 'git'
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO Target (id, url, branch, repo, schedule, kind)
|
|
||||||
SELECT id, url, branch, repo, schedule, kind FROM _Target_old;
|
|
||||||
|
|
||||||
DROP TABLE _Target_old;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
PRAGMA foreign_keys=on;
|
|
|
@ -32,7 +32,7 @@ fn (mut app App) v1_post_target() web.Result {
|
||||||
|
|
||||||
// If a repo is created without specifying the arch, we assume it's meant
|
// If a repo is created without specifying the arch, we assume it's meant
|
||||||
// for the default architecture.
|
// for the default architecture.
|
||||||
if 'arch' !in params || params['arch'] == '' {
|
if 'arch' !in params {
|
||||||
params['arch'] = app.conf.default_arch
|
params['arch'] = app.conf.default_arch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ fn (mut app App) v1_post_target() web.Result {
|
||||||
|
|
||||||
id := app.db.add_target(new_repo)
|
id := app.db.add_target(new_repo)
|
||||||
|
|
||||||
return app.json(.ok, new_data_response(id))
|
return app.json(http.Status.ok, new_data_response(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// v1_delete_target removes a given target from the server's list.
|
// v1_delete_target removes a given target from the server's list.
|
||||||
|
@ -55,7 +55,7 @@ fn (mut app App) v1_post_target() web.Result {
|
||||||
fn (mut app App) v1_delete_target(id int) web.Result {
|
fn (mut app App) v1_delete_target(id int) web.Result {
|
||||||
app.db.delete_target(id)
|
app.db.delete_target(id)
|
||||||
|
|
||||||
return app.json(.ok, new_response(''))
|
return app.status(.ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
// v1_patch_target updates a target's data with the given query params.
|
// v1_patch_target updates a target's data with the given query params.
|
||||||
|
@ -69,7 +69,5 @@ fn (mut app App) v1_patch_target(id int) web.Result {
|
||||||
app.db.update_target_archs(id, arch_objs)
|
app.db.update_target_archs(id, arch_objs)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo := app.db.get_target(id) or { return app.status(.internal_server_error) }
|
return app.status(.ok)
|
||||||
|
|
||||||
return app.json(.ok, new_data_response(repo))
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue