* /badge/update/perms {perms} param is now {badge_perms}
This makes the parameter follow the naming convention of badge_* * badges.id field now uses BIGINT's as intended * Typo in sql where 'badges' was incorrectly set to 'perms' -_-
This commit is contained in:
parent
fa89088094
commit
ecb55fa4fe
@ -63,7 +63,7 @@ async fn badge_update(pool: &Pool, id: u64, query: &'static str, values: mysql_a
|
|||||||
pub async fn update_perms(pool: &Pool, id: u64, perms: u64) -> SqlResult<bool> {
|
pub async fn update_perms(pool: &Pool, id: u64, perms: u64) -> SqlResult<bool> {
|
||||||
// Ok(None) if that badge was not registered anywhere
|
// Ok(None) if that badge was not registered anywhere
|
||||||
// Ok(Some(Badge)) if that badge was registered
|
// Ok(Some(Badge)) if that badge was registered
|
||||||
let q = "UPDATE perms SET permissions = :perms WHERE id = :id";
|
let q = "UPDATE badges SET permissions = :perms WHERE id = :id";
|
||||||
let p = params!{"id" => id, "perms" => perms};
|
let p = params!{"id" => id, "perms" => perms};
|
||||||
return badge_update(pool, id, q, p).await;
|
return badge_update(pool, id, q, p).await;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `badges`(
|
CREATE TABLE IF NOT EXISTS `badges`(
|
||||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
`name` VARCHAR(256) NOT NULL,
|
`name` VARCHAR(256) NOT NULL,
|
||||||
`color` INTEGER UNSIGNED NOT NULL DEFAULT 0xFFFFFFFF,
|
`color` INTEGER UNSIGNED NOT NULL DEFAULT 0xFFFFFFFF,
|
||||||
`permissions` INTEGER UNSIGNED, -- nullable because this isn't logically applicable to every badge
|
`permissions` INTEGER UNSIGNED, -- nullable because this isn't logically applicable to every badge
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,7 @@ pub async fn new(p: &Pool, response: &mut Response<Body>, params: HashMap<String
|
|||||||
|
|
||||||
pub async fn update_perms(p: &Pool, response: &mut Response<Body>, params: HashMap<String, String>) {
|
pub async fn update_perms(p: &Pool, response: &mut Response<Body>, params: HashMap<String, String>) {
|
||||||
let id = qs_param!(params, "badge_id", u64);
|
let id = qs_param!(params, "badge_id", u64);
|
||||||
let perms = qs_param!(params, "perms", u64);
|
let perms = qs_param!(params, "badge_perms", u64);
|
||||||
if let (Some(id), Some(perms)) = (id, perms) {
|
if let (Some(id), Some(perms)) = (id, perms) {
|
||||||
match db::badges::update_perms(p, id, perms).await {
|
match db::badges::update_perms(p, id, perms).await {
|
||||||
// TODO: add rtc update here
|
// TODO: add rtc update here
|
||||||
|
Loading…
Reference in New Issue
Block a user