Skip to content

Commit 3b6be38

Browse files
committed
chore: clippy: misnamed getter in Log
Jira: IAM-1908
1 parent 12fbff3 commit 3b6be38

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/db/logs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// DEBT: See DEBT later in this file. Applying this to the struct did not
2+
// resolve the warning, so here we are.
3+
#![allow(clippy::misnamed_getters)]
4+
15
use crate::db::model::Group;
26
use crate::db::schema::*;
37
use crate::db::types::*;
@@ -23,11 +27,21 @@ pub struct InsertLog {
2327
pub body: Option<Value>,
2428
}
2529

30+
// DEBT: `Identifiable` uses the `primary_key`. Quoting the docs:
31+
//
32+
// This trait can be automatically derived by adding #[derive(Identifiable)] to
33+
// your struct. By default, the “id” field is assumed to be a single field
34+
// called id. If it’s not, you can put #[primary_key(your_id)] on your struct.
35+
// If you have a composite primary key, the syntax is #[primary_key(id1, id2)].
36+
//
37+
// It's unclear why we _also_ specify an `id` field here. We can't remove it
38+
// without also generating a migration, which is out of scope for IAM-1908.
2639
#[derive(Identifiable, Associations, Queryable, PartialEq, Eq, Debug, Serialize)]
2740
#[belongs_to(Group)]
2841
#[primary_key(group_id)]
2942
#[table_name = "logs"]
3043
pub struct Log {
44+
// DEBT: consider removing this in a later migration.
3145
pub id: i32,
3246
pub ts: NaiveDateTime,
3347
pub target: LogTargetType,

0 commit comments

Comments
 (0)