-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(model, http)!: fix role position update payload and allow audit l…
…og reason (#2342) Closes #2338 and adds audit log reason support for this endpoint. --------- Co-authored-by: Tim Vilgot Mikael Fredenberg <26655508+vilgotf@users.noreply.github.com>
- Loading branch information
1 parent
15630d2
commit 0063af4
Showing
5 changed files
with
79 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::id::{marker::RoleMarker, Id}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] | ||
/// Data used to update the positions of roles. | ||
pub struct RolePosition { | ||
/// Role identifier. | ||
pub id: Id<RoleMarker>, | ||
/// Sorting position of the role. | ||
pub position: u64, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::{Id, RolePosition}; | ||
use serde_test::Token; | ||
|
||
#[test] | ||
fn role_position() { | ||
let role_position = RolePosition { | ||
id: Id::new(123), | ||
position: 12, | ||
}; | ||
|
||
serde_test::assert_tokens( | ||
&role_position, | ||
&[ | ||
Token::Struct { | ||
name: "RolePosition", | ||
len: 2, | ||
}, | ||
Token::Str("id"), | ||
Token::NewtypeStruct { name: "Id" }, | ||
Token::Str("123"), | ||
Token::Str("position"), | ||
Token::U64(12), | ||
Token::StructEnd, | ||
], | ||
); | ||
} | ||
} |