mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-22 15:51:30 +00:00

* refactor: weak passed-in params in handler * refactor: rename struct * chore: update tables * chore: update schema * chore: add permission * chore: update tables * chore: support transaction mode * chore: workspace database id * chore: add user workspace * feat: return list of workspaces * chore: add user to workspace * feat: separate database row table * refactor: update schema * chore: partition table * chore: use transaction * refactor: dir * refactor: collab db ref * fix: collab db lock * chore: rename files * chore: add tables descriptions * chore: update readme * docs: update documentation * chore: rename crate * chore: update ref * chore: update tests * chore: update tests * refactor: crate deps * chore: update crate ref * chore: remove unused deps * chore: remove unused deps * chore: update collab crate refs * chore: replace client with transaction in pooler * refactor: return error type * refactor: use anyhow error in deps * feat: supabase postgrest user signin (wip) * fix: Cargo.toml source git deps, changed Error to anyhow::Error * fix: uuid serialization * chore: fix conflict * chore: extend the response * feat: add implementation place holders * feat: impl get_user_workspaces * feat: impl get_user_profile * test: create workspace * fix: postgrest: field names and alias * chore: implement folder restful api * chore: implement collab storate with restful api * feat: added placeholders for impl: update_user_profile, check_user * feat: impl: update_user_profile * feat: impl: check_user * fix: use UidResponse, add more debug info for serde serialization error * fix: get_user_profile: use Optional<UserProfileResponse> * chore: imple init sync * chore: support soft delete * feat: postgresql: add migration test * feat: postgresql migration test: added UID display and colored output * feat: postgresql migration test: workspace role * feat: postgresql migration test: create shared common utils * feat: postgresql migration test: fixed shebang * chore: add flush_collab_update pg function * chore: implement datbaase and document restful api * chore: migrate to use restful api * chore: update table schema * chore: fix tests * chore: remove unused code * chore: format code * chore: remove unused env * fix: tauri build * fix: tauri build --------- Co-authored-by: Fu Zi Xiang <speed2exe@live.com.sg>
230 lines
4.9 KiB
Rust
230 lines
4.9 KiB
Rust
use serde_repr::*;
|
|
use thiserror::Error;
|
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Error, Serialize_repr, Deserialize_repr, ProtoBuf_Enum)]
|
|
#[repr(u8)]
|
|
pub enum ErrorCode {
|
|
#[error("Internal error")]
|
|
Internal = 0,
|
|
|
|
#[error("Unauthorized user")]
|
|
UserUnauthorized = 2,
|
|
|
|
#[error("Record not found")]
|
|
RecordNotFound = 3,
|
|
|
|
#[error("User id is empty")]
|
|
UserIdIsEmpty = 4,
|
|
|
|
#[error("Workspace name can not be empty or whitespace")]
|
|
WorkspaceNameInvalid = 5,
|
|
|
|
#[error("Workspace id can not be empty or whitespace")]
|
|
WorkspaceIdInvalid = 6,
|
|
|
|
#[error("Color style of the App is invalid")]
|
|
AppColorStyleInvalid = 7,
|
|
|
|
#[error("Workspace desc is invalid")]
|
|
WorkspaceDescTooLong = 8,
|
|
|
|
#[error("Workspace description too long")]
|
|
WorkspaceNameTooLong = 9,
|
|
|
|
#[error("App id can not be empty or whitespace")]
|
|
AppIdInvalid = 10,
|
|
|
|
#[error("App name can not be empty or whitespace")]
|
|
AppNameInvalid = 11,
|
|
|
|
#[error("View name can not be empty or whitespace")]
|
|
ViewNameInvalid = 12,
|
|
|
|
#[error("Thumbnail of the view is invalid")]
|
|
ViewThumbnailInvalid = 13,
|
|
|
|
#[error("View id can not be empty or whitespace")]
|
|
ViewIdIsInvalid = 14,
|
|
|
|
#[error("View desc too long")]
|
|
ViewDescTooLong = 15,
|
|
|
|
#[error("View data is invalid")]
|
|
ViewDataInvalid = 16,
|
|
|
|
#[error("View name too long")]
|
|
ViewNameTooLong = 17,
|
|
|
|
#[error("Email can not be empty or whitespace")]
|
|
EmailIsEmpty = 19,
|
|
|
|
#[error("Email format is not valid")]
|
|
EmailFormatInvalid = 20,
|
|
|
|
#[error("Email already exists")]
|
|
EmailAlreadyExists = 21,
|
|
|
|
#[error("Password can not be empty or whitespace")]
|
|
PasswordIsEmpty = 22,
|
|
|
|
#[error("Password format too long")]
|
|
PasswordTooLong = 23,
|
|
|
|
#[error("Password contains forbidden characters.")]
|
|
PasswordContainsForbidCharacters = 24,
|
|
|
|
#[error(
|
|
"Password should contain a minimum of 6 characters with 1 special 1 letter and 1 numeric"
|
|
)]
|
|
PasswordFormatInvalid = 25,
|
|
|
|
#[error("Password not match")]
|
|
PasswordNotMatch = 26,
|
|
|
|
#[error("User name is too long")]
|
|
UserNameTooLong = 27,
|
|
|
|
#[error("User name contain forbidden characters")]
|
|
UserNameContainForbiddenCharacters = 28,
|
|
|
|
#[error("User name can not be empty or whitespace")]
|
|
UserNameIsEmpty = 29,
|
|
|
|
#[error("user id is empty or whitespace")]
|
|
UserIdInvalid = 30,
|
|
|
|
#[error("User not exist")]
|
|
UserNotExist = 31,
|
|
|
|
#[error("Text is too long")]
|
|
TextTooLong = 32,
|
|
|
|
#[error("Database id is empty")]
|
|
DatabaseIdIsEmpty = 33,
|
|
|
|
#[error("Grid view id is empty")]
|
|
DatabaseViewIdIsEmpty = 34,
|
|
|
|
#[error("Grid block id is empty")]
|
|
BlockIdIsEmpty = 35,
|
|
|
|
#[error("Row id is empty")]
|
|
RowIdIsEmpty = 36,
|
|
|
|
#[error("Select option id is empty")]
|
|
OptionIdIsEmpty = 37,
|
|
|
|
#[error("Field id is empty")]
|
|
FieldIdIsEmpty = 38,
|
|
|
|
#[error("Field doesn't exist")]
|
|
FieldDoesNotExist = 39,
|
|
|
|
#[error("The name of the option should not be empty")]
|
|
SelectOptionNameIsEmpty = 40,
|
|
|
|
#[error("Field not exists")]
|
|
FieldNotExists = 41,
|
|
|
|
#[error("The operation in this field is invalid")]
|
|
FieldInvalidOperation = 42,
|
|
|
|
#[error("Filter id is empty")]
|
|
FilterIdIsEmpty = 43,
|
|
|
|
#[error("Field is not exist")]
|
|
FieldRecordNotFound = 44,
|
|
|
|
#[error("Field's type-option data should not be empty")]
|
|
TypeOptionDataIsEmpty = 45,
|
|
|
|
#[error("Group id is empty")]
|
|
GroupIdIsEmpty = 46,
|
|
|
|
#[error("Invalid date time format")]
|
|
InvalidDateTimeFormat = 47,
|
|
|
|
#[error("Invalid params")]
|
|
InvalidParams = 49,
|
|
|
|
#[error("Serde")]
|
|
Serde = 50,
|
|
|
|
#[error("Protobuf serde")]
|
|
ProtobufSerde = 51,
|
|
|
|
#[error("Out of bounds")]
|
|
OutOfBounds = 52,
|
|
|
|
#[error("Sort id is empty")]
|
|
SortIdIsEmpty = 53,
|
|
|
|
#[error("Connect refused")]
|
|
ConnectRefused = 54,
|
|
|
|
#[error("Connection timeout")]
|
|
ConnectTimeout = 55,
|
|
|
|
#[error("Connection closed")]
|
|
ConnectClose = 56,
|
|
|
|
#[error("Connection canceled")]
|
|
ConnectCancel = 57,
|
|
|
|
#[error("Sql error")]
|
|
SqlError = 58,
|
|
|
|
#[error("Http error")]
|
|
HttpError = 59,
|
|
|
|
#[error("The content should not be empty")]
|
|
UnexpectedEmpty = 60,
|
|
|
|
#[error("Only the date type can be used in calendar")]
|
|
UnexpectedCalendarFieldType = 61,
|
|
|
|
#[error("Document Data Invalid")]
|
|
DocumentDataInvalid = 62,
|
|
|
|
#[error("Unsupported auth type")]
|
|
UnsupportedAuthType = 63,
|
|
|
|
#[error("Invalid auth configuration")]
|
|
InvalidAuthConfig = 64,
|
|
|
|
#[error("Missing auth field")]
|
|
MissingAuthField = 65,
|
|
|
|
#[error("Only one application can access the database")]
|
|
MultipleDBInstance = 66,
|
|
|
|
#[error("Document id is empty")]
|
|
DocumentIdIsEmpty = 67,
|
|
|
|
#[error("Apply actions is empty")]
|
|
ApplyActionsIsEmpty = 68,
|
|
|
|
#[error("Connect postgres database failed")]
|
|
PgConnectError = 69,
|
|
|
|
#[error("Postgres database error")]
|
|
PgDatabaseError = 70,
|
|
|
|
#[error("Postgres transaction error")]
|
|
PgTransactionError = 71,
|
|
|
|
#[error("Enable supabase sync")]
|
|
SupabaseSyncRequired = 72,
|
|
|
|
#[error("Conflict")]
|
|
Conflict = 73,
|
|
}
|
|
|
|
impl ErrorCode {
|
|
pub fn value(&self) -> i32 {
|
|
self.clone() as i32
|
|
}
|
|
}
|