fix: check stack name length
This commit is contained in:
parent
44ed832fd7
commit
0a8d91bfac
2 changed files with 10 additions and 1 deletions
|
@ -92,7 +92,9 @@
|
|||
</button>
|
||||
|
||||
{% for user in users %}
|
||||
<div class="card secondary flex gap-2 items-center justify-between">
|
||||
<div
|
||||
class="card secondary flex flex-wrap gap-2 items-center justify-between"
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
{{ components::avatar(username=user.username) }} {{
|
||||
components::full_username(user=user) }}
|
||||
|
|
|
@ -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