diff --git a/.sqlx/query-7c8fdc12c2a80c166d1696913273cb7da1a5ffefa1b09705eb4ba8abe94ae135.json b/.sqlx/query-7c8fdc12c2a80c166d1696913273cb7da1a5ffefa1b09705eb4ba8abe94ae135.json new file mode 100644 index 0000000..d86ec9d --- /dev/null +++ b/.sqlx/query-7c8fdc12c2a80c166d1696913273cb7da1a5ffefa1b09705eb4ba8abe94ae135.json @@ -0,0 +1,19 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO cqrs_identity_store_query (\n version, name, address, store_id, owner, deleted\n ) VALUES (\n $1, $2, $3, $4, $5, $6\n );", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Uuid", + "Uuid", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "7c8fdc12c2a80c166d1696913273cb7da1a5ffefa1b09705eb4ba8abe94ae135" +} diff --git a/.sqlx/query-840678753d65298539ef0a07bf7ea24f735604de370130c8752f6e64b0a39659.json b/.sqlx/query-840678753d65298539ef0a07bf7ea24f735604de370130c8752f6e64b0a39659.json new file mode 100644 index 0000000..df55af5 --- /dev/null +++ b/.sqlx/query-840678753d65298539ef0a07bf7ea24f735604de370130c8752f6e64b0a39659.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (\n SELECT 1\n FROM cqrs_identity_store_query\n WHERE\n name = $1\n AND\n deleted = false\n );", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "840678753d65298539ef0a07bf7ea24f735604de370130c8752f6e64b0a39659" +} diff --git a/.sqlx/query-a02ae03e94d928feece2996fbd344ddf4b1459c1487ed7dffd57fb5ea7cf97aa.json b/.sqlx/query-a02ae03e94d928feece2996fbd344ddf4b1459c1487ed7dffd57fb5ea7cf97aa.json new file mode 100644 index 0000000..f08cb3a --- /dev/null +++ b/.sqlx/query-a02ae03e94d928feece2996fbd344ddf4b1459c1487ed7dffd57fb5ea7cf97aa.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS (\n SELECT 1\n FROM cqrs_identity_store_query\n WHERE\n store_id = $1\n );", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + null + ] + }, + "hash": "a02ae03e94d928feece2996fbd344ddf4b1459c1487ed7dffd57fb5ea7cf97aa" +} diff --git a/.sqlx/query-a5b2bc2a46dfc083c6dc9b12945ac9eb5204f79e1742b827cfb1048f061351df.json b/.sqlx/query-a5b2bc2a46dfc083c6dc9b12945ac9eb5204f79e1742b827cfb1048f061351df.json new file mode 100644 index 0000000..b2a5733 --- /dev/null +++ b/.sqlx/query-a5b2bc2a46dfc083c6dc9b12945ac9eb5204f79e1742b827cfb1048f061351df.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \n name, address, store_id, owner, deleted\n FROM\n cqrs_identity_store_query\n WHERE\n store_id = $1;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "address", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "store_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "owner", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "deleted", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + true, + false, + false, + false + ] + }, + "hash": "a5b2bc2a46dfc083c6dc9b12945ac9eb5204f79e1742b827cfb1048f061351df" +} diff --git a/.sqlx/query-aa9219ef478854cc7e2afad1e80a5d5a49d01bc8c44e578baad926f5f163c0d2.json b/.sqlx/query-aa9219ef478854cc7e2afad1e80a5d5a49d01bc8c44e578baad926f5f163c0d2.json new file mode 100644 index 0000000..f6c272c --- /dev/null +++ b/.sqlx/query-aa9219ef478854cc7e2afad1e80a5d5a49d01bc8c44e578baad926f5f163c0d2.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \n store_id, version\n FROM\n cqrs_identity_store_query\n WHERE\n store_id = $1;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "store_id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "aa9219ef478854cc7e2afad1e80a5d5a49d01bc8c44e578baad926f5f163c0d2" +} diff --git a/.sqlx/query-b640ed9c2d601b3a78f3cac4b9a4c0c23a5cc8a7d51a270bdab73182b12e204c.json b/.sqlx/query-b640ed9c2d601b3a78f3cac4b9a4c0c23a5cc8a7d51a270bdab73182b12e204c.json new file mode 100644 index 0000000..1c0b052 --- /dev/null +++ b/.sqlx/query-b640ed9c2d601b3a78f3cac4b9a4c0c23a5cc8a7d51a270bdab73182b12e204c.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE\n cqrs_identity_store_query\n SET\n version = $1,\n name = $2,\n address = $3,\n owner = $4,\n deleted = $5;", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Uuid", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "b640ed9c2d601b3a78f3cac4b9a4c0c23a5cc8a7d51a270bdab73182b12e204c" +} diff --git a/src/identity/adapters/output/db/postgres/employee_view.rs b/src/identity/adapters/output/db/postgres/employee_view.rs index f742dcf..8a918ce 100644 --- a/src/identity/adapters/output/db/postgres/employee_view.rs +++ b/src/identity/adapters/output/db/postgres/employee_view.rs @@ -102,7 +102,7 @@ impl View for EmployeeView { IdentityEvent::PhoneNumberVerified(e) => self.phone_verified = true, IdentityEvent::VerificationOTPResent(e) => (), IdentityEvent::PhoneNumberChanged(e) => unimplemented!(), - IdentityEvent::InviteAccepted(e) => self.store_id = Some(*e.store_id()), + // IdentityEvent::InviteAccepted(e) => self.store_id = Some(*e.store_id()), IdentityEvent::OrganizationExited(e) => self.store_id = None, _ => (), diff --git a/src/identity/application/port/output/db/get_invite.rs b/src/identity/application/port/output/db/get_invite.rs index 1a8131e..9a4c582 100644 --- a/src/identity/application/port/output/db/get_invite.rs +++ b/src/identity/application/port/output/db/get_invite.rs @@ -17,7 +17,7 @@ pub use tests::*; #[automock] #[async_trait::async_trait] pub trait GetInviteOutDBPort: Send + Sync { - async fn get_invite(&self, invitge_id: Uuid) -> OutDBPortResult>; + async fn get_invite(&self, invite_id: Uuid) -> OutDBPortResult>; } pub type GetInviteOutDBPortObj = std::sync::Arc; diff --git a/src/identity/application/port/output/db/mod.rs b/src/identity/application/port/output/db/mod.rs index ad3bc00..264bc84 100644 --- a/src/identity/application/port/output/db/mod.rs +++ b/src/identity/application/port/output/db/mod.rs @@ -12,11 +12,11 @@ pub mod email_exists; pub mod emp_id_exists; pub mod errors; pub mod get_emp_id_from_phone_number; -pub mod get_invite; +//pub mod get_invite; pub mod get_login_otp; pub mod get_verification_otp; pub mod get_verification_secret; -pub mod invite_id_exists; +//pub mod invite_id_exists; pub mod phone_exists; pub mod store_id_exists; pub mod store_name_exists; diff --git a/src/identity/application/services/events.rs b/src/identity/application/services/events.rs index 4961adf..21f930d 100644 --- a/src/identity/application/services/events.rs +++ b/src/identity/application/services/events.rs @@ -12,10 +12,17 @@ use super::update_email::events::*; use super::update_password::events::*; use crate::identity::domain::{ - employee_logged_in_event::*, employee_registered_event::*, invite_accepted_event::*, - login_otp_sent_event::*, organization_exited_event::*, phone_number_changed_event::*, - phone_number_verified_event::*, resend_login_otp_event::*, store_added_event::*, - store_updated_event::*, verification_otp_resent_event::*, verification_otp_sent_event::*, + employee_logged_in_event::*, + employee_registered_event::*, //invite_accepted_event::*, + login_otp_sent_event::*, + organization_exited_event::*, + phone_number_changed_event::*, + phone_number_verified_event::*, + resend_login_otp_event::*, + store_added_event::*, + store_updated_event::*, + verification_otp_resent_event::*, + verification_otp_sent_event::*, }; #[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd)] @@ -37,7 +44,7 @@ pub enum IdentityEvent { PhoneNumberVerified(PhoneNumberVerifiedEvent), VerificationOTPResent(VerificationOTPResentEvent), PhoneNumberChanged(PhoneNumberChangedEvent), - InviteAccepted(InviteAcceptedEvent), + // InviteAccepted(InviteAcceptedEvent), OrganizationExited(OrganizationExitedEvent), // store events @@ -71,7 +78,7 @@ impl DomainEvent for IdentityEvent { IdentityEvent::PhoneNumberVerified { .. } => "EmployeePhoneNumberVerified", IdentityEvent::VerificationOTPResent { .. } => "EmployeeVerificationOTPResent", IdentityEvent::PhoneNumberChanged { .. } => "EmployeePhoneNumberChanged", - IdentityEvent::InviteAccepted { .. } => "EmployeeInviteAccepted", + // IdentityEvent::InviteAccepted { .. } => "EmployeeInviteAccepted", IdentityEvent::OrganizationExited { .. } => "EmployeeOrganizationExited", // store diff --git a/src/identity/domain/employee_aggregate.rs b/src/identity/domain/employee_aggregate.rs index 585854f..6214ec6 100644 --- a/src/identity/domain/employee_aggregate.rs +++ b/src/identity/domain/employee_aggregate.rs @@ -128,12 +128,12 @@ impl Aggregate for Employee { .await?, )]) } - IdentityCommand::EmployeeAcceptInvite(cmd) => Ok(vec![IdentityEvent::InviteAccepted( - services - .employee_accept_invite_service() - .accept_invite(cmd) - .await?, - )]), + // IdentityCommand::EmployeeAcceptInvite(cmd) => Ok(vec![IdentityEvent::InviteAccepted( + // services + // .employee_accept_invite_service() + // .accept_invite(cmd) + // .await?, + // )]), IdentityCommand::EmployeeExitOrganization(cmd) => { Ok(vec![IdentityEvent::OrganizationExited( services @@ -158,7 +158,7 @@ impl Aggregate for Employee { IdentityEvent::PhoneNumberVerified(e) => self.phone_verified = true, IdentityEvent::VerificationOTPResent(e) => (), IdentityEvent::PhoneNumberChanged(e) => unimplemented!(), - IdentityEvent::InviteAccepted(e) => self.store_id = Some(*e.store_id()), + // IdentityEvent::InviteAccepted(e) => self.store_id = Some(*e.store_id()), IdentityEvent::OrganizationExited(e) => self.store_id = None, _ => (), @@ -171,7 +171,7 @@ mod tests { use std::sync::Arc; use cqrs_es::test::TestFramework; - use employee_accept_invite_service::EmployeeAcceptInviteService; + // use employee_accept_invite_service::EmployeeAcceptInviteService; use employee_exit_organization_service::EmployeeExitOrganizationService; use employee_login_service::EmployeeLoginService; use employee_resend_login_otp_service::EmployeeResendLoginOTPService; @@ -179,13 +179,13 @@ mod tests { use employee_verify_phone_number_service::EmployeeVerifyPhoneNumberService; use crate::identity::domain::{ - accept_invite_command::AcceptInviteCommand, + // accept_invite_command::AcceptInviteCommand, employee_logged_in_event::{EmployeeInitLoggedInEvent, EmployeeLoggedInEvent}, employee_login_command::{EmployeeFinishLoginCommand, EmployeeInitLoginCommand}, employee_register_command::EmployeeRegisterCommand, employee_registered_event::EmployeeRegisteredEvent, exit_organization_command::ExitOrganizationCommand, - invite_accepted_event::InviteAcceptedEvent, + // invite_accepted_event::InviteAcceptedEvent, organization_exited_event::OrganizationExitedEvent, phone_number_verified_event::PhoneNumberVerifiedEvent, resend_login_otp_command::ResendLoginOTPCommand, @@ -327,26 +327,26 @@ mod tests { .then_expect_events(vec![expected]); } - #[test] - fn test_accept_invite() { - let cmd = AcceptInviteCommand::get_cmd(); - let expected = InviteAcceptedEvent::get_event(&cmd); - let expected = IdentityEvent::InviteAccepted(expected); - - let mut services = MockIdentityServicesInterface::new(); - services - .expect_employee_accept_invite_service() - .times(IS_CALLED_ONLY_ONCE.unwrap()) - .return_const(EmployeeAcceptInviteService::mock_service( - IS_CALLED_ONLY_ONCE, - cmd.clone(), - )); - - EmployeeTestFramework::with(Arc::new(services)) - .given_no_previous_events() - .when(IdentityCommand::EmployeeAcceptInvite(cmd)) - .then_expect_events(vec![expected]); - } + // #[test] + // fn test_accept_invite() { + // let cmd = AcceptInviteCommand::get_cmd(); + // let expected = InviteAcceptedEvent::get_event(&cmd); + // let expected = IdentityEvent::InviteAccepted(expected); + // + // let mut services = MockIdentityServicesInterface::new(); + // services + // .expect_employee_accept_invite_service() + // .times(IS_CALLED_ONLY_ONCE.unwrap()) + // .return_const(EmployeeAcceptInviteService::mock_service( + // IS_CALLED_ONLY_ONCE, + // cmd.clone(), + // )); + // + // EmployeeTestFramework::with(Arc::new(services)) + // .given_no_previous_events() + // .when(IdentityCommand::EmployeeAcceptInvite(cmd)) + // .then_expect_events(vec![expected]); + // } #[test] fn test_exit_organization() { diff --git a/src/identity/domain/mod.rs b/src/identity/domain/mod.rs index 9acec2f..e79ba9e 100644 --- a/src/identity/domain/mod.rs +++ b/src/identity/domain/mod.rs @@ -11,7 +11,7 @@ pub mod store_aggregate; // events pub mod employee_logged_in_event; pub mod employee_registered_event; -pub mod invite_accepted_event; +//pub mod invite_accepted_event; pub mod login_otp_sent_event; pub mod organization_exited_event; pub mod phone_number_changed_event; @@ -23,7 +23,7 @@ pub mod verification_otp_resent_event; pub mod verification_otp_sent_event; // commands -pub mod accept_invite_command; +//pub mod accept_invite_command; pub mod add_store_command; pub mod change_phone_number_command; pub mod employee_login_command;