fix: check stack name length
This commit is contained in:
parent
44ed832fd7
commit
0a8d91bfac
2 changed files with 10 additions and 1 deletions
|
@ -61,6 +61,13 @@ impl DataManager {
|
|||
/// # Arguments
|
||||
/// * `data` - a mock [`UserStack`] object to insert
|
||||
pub async fn create_stack(&self, data: UserStack) -> Result<UserStack> {
|
||||
// check values
|
||||
if data.name.len() < 2 {
|
||||
return Err(Error::DataTooShort("title".to_string()));
|
||||
} else if data.name.len() > 32 {
|
||||
return Err(Error::DataTooLong("title".to_string()));
|
||||
}
|
||||
|
||||
// check number of stacks
|
||||
let owner = self.get_user_by_id(data.owner).await?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue