add: forges ui
TODO: forges tickets feed, posts open/closed state
This commit is contained in:
parent
5b1db42c51
commit
a6140f7c8c
40 changed files with 1664 additions and 1270 deletions
crates/app/src/routes/api/v1
|
@ -29,7 +29,7 @@ use tetratto_core::{
|
|||
};
|
||||
|
||||
#[cfg(feature = "redis")]
|
||||
use redis::Commands;
|
||||
use tetratto_core::cache::redis::Commands;
|
||||
use tetratto_shared::hash;
|
||||
|
||||
pub async fn redirect_from_id(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use std::{collections::HashMap, time::Duration};
|
||||
use redis::Commands;
|
||||
use axum::{
|
||||
extract::{
|
||||
ws::{Message as WsMessage, WebSocket, WebSocketUpgrade},
|
||||
|
@ -10,7 +9,7 @@ use axum::{
|
|||
};
|
||||
use axum_extra::extract::CookieJar;
|
||||
use tetratto_core::{
|
||||
cache::Cache,
|
||||
cache::{Cache, redis::Commands},
|
||||
model::{
|
||||
auth::User,
|
||||
channels::Message,
|
||||
|
|
|
@ -49,10 +49,15 @@ pub async fn create_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
match data
|
||||
.create_community(Community::new(req.title, user.id))
|
||||
.await
|
||||
{
|
||||
let mut c = Community::new(req.title, user.id);
|
||||
|
||||
if req.forge {
|
||||
c.is_forge = true;
|
||||
c.context.enable_titles = true;
|
||||
c.context.require_titles = true;
|
||||
}
|
||||
|
||||
match data.create_community(c).await {
|
||||
Ok(id) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Community created".to_string(),
|
||||
|
@ -117,6 +122,16 @@ pub async fn update_context_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
// check lengths
|
||||
if req.context.display_name.len() > 32 {
|
||||
return Json(Error::DataTooLong("display name".to_string()).into());
|
||||
}
|
||||
|
||||
if req.context.description.len() > 2_usize.pow(14) {
|
||||
return Json(Error::DataTooLong("description".to_string()).into());
|
||||
}
|
||||
|
||||
// ...
|
||||
match data.update_community_context(id, &user, req.context).await {
|
||||
Ok(_) => Json(ApiReturn {
|
||||
ok: true,
|
||||
|
|
|
@ -404,6 +404,8 @@ pub struct RegisterProps {
|
|||
#[derive(Deserialize)]
|
||||
pub struct CreateCommunity {
|
||||
pub title: String,
|
||||
#[serde(default)]
|
||||
pub forge: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue