Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
330383b
[FEATURE] Access control resources for services created:
Rafael24595 Apr 28, 2024
e58b6b6
[FEATURE] Supported repositories end-point implemented.
Rafael24595 Apr 30, 2024
af7b87a
[FEATURE] Autentication handler created:
Rafael24595 May 1, 2024
ca87cc8
[FEATURE] Cookie managment updated:
Rafael24595 May 2, 2024
99c54aa
[FEATURE] AuthException struct created.
Rafael24595 May 2, 2024
b5436e8
[FEATURE] Reset cookie control implemented.
Rafael24595 May 2, 2024
4df9fa7
[FEATURE] General refactorization.
Rafael24595 May 3, 2024
79a62c8
[FIX] Status code fixed in BuilderCookie results.
Rafael24595 May 3, 2024
0e342bd
[FEATURE] Database controller created.
Rafael24595 May 4, 2024
0c6dafc
[FEATURE] Service status response updated.
Rafael24595 May 5, 2024
e26ce19
[FEATURE] Service metadata end-point created.
Rafael24595 May 5, 2024
24511a6
[FEATURE]
Rafael24595 May 6, 2024
eac7ca4
[FEATURE] Collection and document controllers created.
Rafael24595 May 6, 2024
00afb87
[FEATURE] Collection definition implemented.
Rafael24595 May 7, 2024
648af3c
[FEATURE] Collection updates:
Rafael24595 May 9, 2024
38353fe
[FEATURE] Project reorganization and refactoring.
Rafael24595 May 10, 2024
036ba8a
[FEATURE] Find document end-point implemented.
Rafael24595 May 12, 2024
c4a5a8f
[FEATURE] Major improvements:
Rafael24595 May 14, 2024
9cf6336
[FEATURE] Rename, export and import API methods implemented for colle…
Rafael24595 May 15, 2024
4bc2866
[FEATURE] DocumentSchema struct updated.
Rafael24595 May 15, 2024
02f11d7
[FEATURE] Pagination logic added.
May 16, 2024
9b0dd03
[FEATURE] Import max size fixed.
Rafael24595 May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.vscode
/target
/docker
/docker
/assets
137 changes: 136 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[profile.dev]
opt-level = 3

[profile.release]
opt-level = 3

[dependencies]
tokio = { version = "1", features = ["full"] }
lazy_static = "1.4.0"
Expand All @@ -16,4 +22,9 @@ serde_json = "1.0"
crossterm = "0.27.0"
uuid = "1.8.0"
cargo_metadata = "0.18.1"
base64-compat = "1.0.0"
hmac = "0.12.1"
sha2 = "0.10.8"
jwt = "0.16.0"
regex = "1.10.4"
rust_db_manager_core = { git = "https://github.com/Rafael24595/rust-db-manager.git", branch = "dev" }
2 changes: 2 additions & 0 deletions src/commons/configuration/web_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct WebConfiguration {
}

impl WebConfiguration {

pub const COOKIE_NAME: &'static str = "DB_TOKEN";

pub fn initialize() -> WebConfiguration {
let _ = Configuration::initialize();
Expand Down
2 changes: 0 additions & 2 deletions src/commons/exception/api_exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::error::Error;

use rust_db_manager_core::commons::exception::connect_exception::ConnectException;

pub(crate) const EXCEPTION_HEADER: &str = "Error-Code";

#[derive(Debug, Clone)]
pub struct ApiException {
status: u16,
Expand Down
60 changes: 60 additions & 0 deletions src/commons/exception/auth_exception.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use std::fmt;
use std::error::Error;

use super::api_exception::ApiException;

#[derive(Debug, Clone)]
pub struct AuthException {
status: u16,
message: String,
reset: bool,
}

impl fmt::Display for AuthException {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "AuthException: {}", self.message)
}
}

impl Error for AuthException {}


impl AuthException {

pub fn from(status: u16, exception: ApiException, reset: bool) -> AuthException {
AuthException {
status: status,
message: exception.message(),
reset: reset
}
}

pub fn new(status: u16, message: String) -> AuthException {
AuthException {
status,
message,
reset: false
}
}

pub fn new_reset(status: u16, message: String) -> AuthException {
AuthException {
status,
message,
reset: true
}
}

pub fn status(&self) -> u16 {
return self.status;
}

pub fn message(&self) -> String {
return self.message.clone();
}

pub fn reset(&self) -> bool {
return self.reset;
}

}
6 changes: 3 additions & 3 deletions src/domain/builder_db_connection_data.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use rust_db_manager_core::{domain::connection_data::ConnectionData, infrastructure::repository::e_db_repository::EDBRepository};

use crate::{commons::exception::api_exception::ApiException, infrastructure::dto::db_service::dto_db_connection_data::DTOConnectionData};
use crate::{commons::exception::api_exception::ApiException, infrastructure::dto::service::generate::dto_db_connection_data::DTODBConnectionData};

pub struct BuilderConnectionData {
}

impl BuilderConnectionData {

pub fn make(dto: DTOConnectionData) -> Result<ConnectionData, ApiException> {
let category = EDBRepository::from_string(dto.category.clone());
pub fn make(dto: DTODBConnectionData) -> Result<ConnectionData, ApiException> {
let category = EDBRepository::from_string(&dto.category);
if let None = category {
let message = format!("Data base type '{}' not supported.", dto.category);
return Err(ApiException::new(404, message));
Expand Down
13 changes: 9 additions & 4 deletions src/domain/builder_db_service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rust_db_manager_core::infrastructure::db_service::DBService;

use crate::{commons::exception::api_exception::ApiException, infrastructure::dto::db_service::dto_db_service::DTODBService};
use crate::{commons::exception::api_exception::ApiException, infrastructure::dto::service::generate::dto_service_create_request::DTOServiceRequest};

use super::builder_db_connection_data::BuilderConnectionData;

Expand All @@ -9,10 +9,15 @@ pub struct BuilderDBService {

impl BuilderDBService {

pub fn make(dto: DTODBService) -> Result<DBService, ApiException> {
pub fn make(dto: DTOServiceRequest) -> Result<DBService, ApiException> {
let connection_data = BuilderConnectionData::make(dto.connection_data)?;
let service = DBService::new(dto.name, dto.owner, connection_data);
Ok(service)

let service = DBService::new(dto.name, dto.owner, dto.protected, dto.password, connection_data);
if service.is_err() {
return Err(ApiException::from(500, service.err().unwrap()));
}

Ok(service.unwrap())
}

}
Loading