removed useless fields from todo. removed debug trait

This commit is contained in:
jellywx 2020-12-19 22:14:16 +00:00
parent ec04c40cc8
commit 632d01f503

View File

@ -30,12 +30,8 @@ impl fmt::Display for TodoNotFound {
} }
} }
#[derive(Debug)]
struct Todo { struct Todo {
id: u32, id: u32,
user_id: Option<u32>,
guild_id: Option<u32>,
channel_id: Option<u32>,
value: String, value: String,
} }
@ -81,7 +77,7 @@ impl TodoTarget {
sqlx::query_as!( sqlx::query_as!(
Todo, Todo,
" "
SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE channel_id = (SELECT id FROM channels WHERE channel = ?) SELECT id, value FROM todos WHERE channel_id = (SELECT id FROM channels WHERE channel = ?)
", ",
cid.as_u64() cid.as_u64()
) )
@ -91,7 +87,7 @@ SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE channel_id = (S
sqlx::query_as!( sqlx::query_as!(
Todo, Todo,
" "
SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?) AND channel_id IS NULL SELECT id, value FROM todos WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?) AND channel_id IS NULL
", ",
gid.as_u64() gid.as_u64()
) )
@ -101,7 +97,7 @@ SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE guild_id = (SEL
sqlx::query_as!( sqlx::query_as!(
Todo, Todo,
" "
SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE user_id = (SELECT id FROM users WHERE user = ?) AND guild_id IS NULL SELECT id, value FROM todos WHERE user_id = (SELECT id FROM users WHERE user = ?) AND guild_id IS NULL
", ",
self.user.as_u64() self.user.as_u64()
) )
@ -176,7 +172,7 @@ INSERT INTO todos (user_id, value) VALUES (
let deleting = sqlx::query_as!( let deleting = sqlx::query_as!(
Todo, Todo,
" "
SELECT id, user_id, guild_id, channel_id, value FROM todos WHERE id = ? SELECT id, value FROM todos WHERE id = ?
", ",
removal_todo.id removal_todo.id
) )