fix: rm accept invite command,event,service and ports
This commit is contained in:
parent
335714fa32
commit
4b0df692f1
12 changed files with 204 additions and 42 deletions
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -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"
|
||||
}
|
|
@ -102,7 +102,7 @@ impl View<Employee> 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,
|
||||
|
||||
_ => (),
|
||||
|
|
|
@ -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<Option<Uuid>>;
|
||||
async fn get_invite(&self, invite_id: Uuid) -> OutDBPortResult<Option<Uuid>>;
|
||||
}
|
||||
|
||||
pub type GetInviteOutDBPortObj = std::sync::Arc<dyn GetInviteOutDBPort>;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue