From 7aee0dd106e0733b7e8c3c4ac93ca00cfc58af54 Mon Sep 17 00:00:00 2001 From: nkamuo Date: Sat, 30 Sep 2023 23:10:30 +0100 Subject: [PATCH] Chat feature and CQRS - messegnger Initialized --- config/graphql/types/Scalar.yaml | 12 + config/packages/graphql.yaml | 6 +- migrations/Version20230930081522.php | 37 +++ migrations/Version20230930084905.php | 31 ++ .../EntityCreationCommandInterface.php | 6 + .../Command/EntityCreationCommandTrait.php | 24 ++ .../EntityMutationCommandInterface.php | 11 + .../Command/EntityMutationCommandTrait.php | 21 ++ .../Command/EntityUpdateCommandInterface.php | 6 + src/CQRS/Command/MutationCommandContext.php | 36 ++ src/CQRS/Command/Result/CQRSCommandResult.php | 22 ++ .../Result/CQRSEntityMutationResult.php | 32 ++ .../Result/CQRSEntryCreationCommandResult.php | 9 + .../Result/CQRSEntryUpdateCommandResult.php | 9 + src/CQRS/CommandBus.php | 62 ++++ src/CQRS/CommandBusInterface.php | 11 + .../InitiatingUserAwareMessageInterface.php | 14 + .../InitiatingUserAwareMessageTrait.php | 24 ++ src/CQRS/CustomMessageBus.php | 24 ++ src/CQRS/Event/EventInterface.php | 7 + src/CQRS/EventBus.php | 6 + src/CQRS/EventBusInterface.php | 7 + src/CQRS/MessageBus.php | 21 ++ src/CQRS/MessageBusInterface.php | 11 + src/CQRS/MessageInterface.php | 7 + src/CQRS/Query/CollectionCountQuery.php | 22 ++ src/CQRS/Query/CollectionSearchQuery.php | 28 ++ src/CQRS/Query/QueryInterface.php | 7 + src/CQRS/QueryBus.php | 25 ++ src/CQRS/QueryBusInterface.php | 7 + src/Entity/Chat/ChatBusinessParticipant.php | 27 ++ src/Entity/Chat/ChatChannel.php | 310 ++++++++++++++++++ src/Entity/Chat/ChatChannelRole.php | 151 +++++++++ src/Entity/Chat/ChatMessage.php | 231 +++++++++++++ src/Entity/Chat/ChatMessageAttachment.php | 90 +++++ src/Entity/Chat/ChatMessageView.php | 79 +++++ src/Entity/Chat/ChatParticipant.php | 113 +++++++ src/Entity/Chat/ChatSubject.php | 120 +++++++ src/Entity/Chat/ChatUserParticipant.php | 48 +++ .../Shipment/Document/ShipmentDocument.php | 36 +- .../Document/ShipmentDocumentAttachment.php | 10 +- .../ShipmentDocumentAttachmentType.php | 12 + .../Document/ShipmentDocumentType.php | 12 + src/Entity/Shipment/ShipmentOrder.php | 47 ++- src/Entity/Shipment/ShipmentOrderStatus.php | 1 + src/Entity/Shipment/ShipmentStatus.php | 3 + .../Channel/ChatChannelCreationInput.php | 8 + .../Chat/Input/Channel/ChatChannelInput.php | 17 + .../Input/Channel/ChatChannelUpdateInput.php | 9 + .../Message/ChatMessageAttachmentInput.php | 14 + .../Message/ChatMessageCreationInput.php | 8 + .../Chat/Input/Message/ChatMessageInput.php | 41 +++ .../Input/Message/ChatMessageUpdateInput.php | 9 + .../Resolver/ChatChannelMutationResolver.php | 72 ++++ .../Resolver/ChatChannelQueryResolver.php | 72 ++++ .../ChatChannelRoleMutationResolver.php | 91 +++++ .../Resolver/ChatChannelRoleQueryResolver.php | 79 +++++ src/GraphQL/Chat/Resolver/ChatGptRBAC.php-r | 170 ++++++++++ .../Resolver/ChatMessageMutationResolver.php | 93 ++++++ .../Resolver/ChatMessageQueryResolver.php | 135 ++++++++ .../ChatParticipantMutationResolver.php | 102 ++++++ .../Resolver/ChatParticipantQueryResolver.php | 93 ++++++ .../Chat/Type/ChatChannelConnection.php | 12 + src/GraphQL/Chat/Type/ChatChannelEdge.php | 9 + .../Chat/Type/ChatChannelRoleConnection.php | 12 + src/GraphQL/Chat/Type/ChatChannelRoleEdge.php | 9 + .../Chat/Type/ChatMessageConnection.php | 12 + src/GraphQL/Chat/Type/ChatMessageEdge.php | 9 + .../Chat/Type/ChatParticipantConnection.php | 12 + src/GraphQL/Chat/Type/ChatParticipantEdge.php | 9 + .../Document/ShipmentOrderAttachmentInput.php | 25 ++ .../Document/ShipmentOrderDocumentInput.php | 24 ++ ...ShipmentOrderEstimatedNodeArrivalInput.php | 21 ++ .../Input/ShipmentOrderNodeExecutionInput.php | 18 + .../Resolver/DriverShipmentOrderResolver.php | 173 +++++++++- .../Chat/Channel/ChannelMutationCommand.php | 131 ++++++++ src/Message/Chat/Channel/CountChannel.php | 9 + src/Message/Chat/Channel/CreateChannel.php | 9 + src/Message/Chat/Channel/DeleteChannel.php | 26 ++ src/Message/Chat/Channel/FindChannelById.php | 16 + src/Message/Chat/Channel/SearchChannel.php | 9 + src/Message/Chat/Channel/UpdateChannel.php | 23 ++ ...ActiveParticipantAwareMessageInterface.php | 10 + .../ActiveParticipantAwareMessageTrait.php | 20 ++ .../ActiveUserAwareMessageInterface.php | 10 + .../ActiveUserAwareMessageTrait.php | 20 ++ .../ChannelAwareMessageInterface.php | 10 + .../Composition/ChannelAwareMessageTrait.php | 20 ++ .../ParticipantAwareMessageInterface.php | 10 + .../ParticipantAwareMessageTrait.php | 20 ++ .../SubjectAwareMessageInterface.php | 10 + .../Composition/SubjectAwareMessageTrait.php | 20 ++ .../Message/ChatMessageMutationCommand.php | 60 ++++ src/Message/Chat/Message/CountChatMessage.php | 18 + .../Chat/Message/CreateChatMessage.php | 9 + .../Chat/Message/DeleteChatMessage.php | 26 ++ .../Chat/Message/FindChatMessageById.php | 16 + .../Chat/Message/SearchChatMessage.php | 18 + .../Chat/Message/UpdateChatMessage.php | 23 ++ .../Chat/Participant/CountParticipant.php | 9 + .../Chat/Participant/CreateParticipant.php | 9 + .../Chat/Participant/DeleteParticipant.php | 26 ++ .../Chat/Participant/FindParticipantById.php | 16 + .../ParticipantMutationCommand.php | 134 ++++++++ .../Chat/Participant/SearchParticipant.php | 9 + .../Chat/Participant/UpdateParticipant.php | 23 ++ src/Message/Chat/Role/CountRole.php | 9 + src/Message/Chat/Role/CreateRole.php | 9 + src/Message/Chat/Role/DeleteRole.php | 26 ++ src/Message/Chat/Role/FindRoleById.php | 16 + src/Message/Chat/Role/RoleMutationCommand.php | 134 ++++++++ src/Message/Chat/Role/SearchRole.php | 9 + src/Message/Chat/Role/UpdateRole.php | 23 ++ src/Message/Chat/Subject/CountSubject.php | 9 + src/Message/Chat/Subject/CreateSubject.php | 9 + src/Message/Chat/Subject/DeleteSubject.php | 26 ++ src/Message/Chat/Subject/FindSubjectById.php | 16 + src/Message/Chat/Subject/SearchSubject.php | 9 + .../Chat/Subject/SubjectMutationCommand.php | 134 ++++++++ src/Message/Chat/Subject/UpdateSubject.php | 23 ++ .../Chat/ChatChannelMutationHandler.php | 87 +++++ .../Chat/ChatChannelQueryHandler.php | 91 +++++ .../Chat/ChatMessageMutationHandler.php | 126 +++++++ .../Chat/ChatMessageQueryHandler.php | 87 +++++ .../Chat/ChatParticipantMutationHandler.php | 50 +++ .../Chat/ChatParticipantQueryHandler.php | 67 ++++ .../Chat/ChatSubjectMutationHandler.php | 50 +++ .../Chat/ChatSubjectQueryHandler.php | 67 ++++ .../ChatBusinessParticipantRepository.php | 66 ++++ src/Repository/Chat/ChatChannelRepository.php | 66 ++++ .../Chat/ChatChannelRoleRepository.php | 66 ++++ .../Chat/ChatMessageAttachmentRepository.php | 66 ++++ src/Repository/Chat/ChatMessageRepository.php | 66 ++++ .../Chat/ChatMessageViewRepository.php | 66 ++++ .../Chat/ChatParticipantRepository.php | 66 ++++ src/Repository/Chat/ChatSubjectRepository.php | 66 ++++ .../Chat/ChatUserParticipantRepository.php | 66 ++++ src/Service/Chat/ChainChatContextResolver.php | 58 ++++ .../Chat/ChatContextResolverInterface.php | 15 + ...atChannelParticipanResolutionException.php | 21 ++ src/Service/File/Uploader.php | 8 +- 141 files changed, 5712 insertions(+), 23 deletions(-) create mode 100644 config/graphql/types/Scalar.yaml create mode 100644 migrations/Version20230930081522.php create mode 100644 migrations/Version20230930084905.php create mode 100644 src/CQRS/Command/EntityCreationCommandInterface.php create mode 100644 src/CQRS/Command/EntityCreationCommandTrait.php create mode 100644 src/CQRS/Command/EntityMutationCommandInterface.php create mode 100644 src/CQRS/Command/EntityMutationCommandTrait.php create mode 100644 src/CQRS/Command/EntityUpdateCommandInterface.php create mode 100644 src/CQRS/Command/MutationCommandContext.php create mode 100644 src/CQRS/Command/Result/CQRSCommandResult.php create mode 100644 src/CQRS/Command/Result/CQRSEntityMutationResult.php create mode 100644 src/CQRS/Command/Result/CQRSEntryCreationCommandResult.php create mode 100644 src/CQRS/Command/Result/CQRSEntryUpdateCommandResult.php create mode 100644 src/CQRS/CommandBus.php create mode 100644 src/CQRS/CommandBusInterface.php create mode 100644 src/CQRS/Composition/InitiatingUserAwareMessageInterface.php create mode 100644 src/CQRS/Composition/InitiatingUserAwareMessageTrait.php create mode 100644 src/CQRS/CustomMessageBus.php create mode 100644 src/CQRS/Event/EventInterface.php create mode 100644 src/CQRS/EventBus.php create mode 100644 src/CQRS/EventBusInterface.php create mode 100644 src/CQRS/MessageBus.php create mode 100644 src/CQRS/MessageBusInterface.php create mode 100644 src/CQRS/MessageInterface.php create mode 100644 src/CQRS/Query/CollectionCountQuery.php create mode 100644 src/CQRS/Query/CollectionSearchQuery.php create mode 100644 src/CQRS/Query/QueryInterface.php create mode 100644 src/CQRS/QueryBus.php create mode 100644 src/CQRS/QueryBusInterface.php create mode 100644 src/Entity/Chat/ChatBusinessParticipant.php create mode 100644 src/Entity/Chat/ChatChannel.php create mode 100644 src/Entity/Chat/ChatChannelRole.php create mode 100644 src/Entity/Chat/ChatMessage.php create mode 100644 src/Entity/Chat/ChatMessageAttachment.php create mode 100644 src/Entity/Chat/ChatMessageView.php create mode 100644 src/Entity/Chat/ChatParticipant.php create mode 100644 src/Entity/Chat/ChatSubject.php create mode 100644 src/Entity/Chat/ChatUserParticipant.php create mode 100644 src/Entity/Shipment/Document/ShipmentDocumentAttachmentType.php create mode 100644 src/Entity/Shipment/Document/ShipmentDocumentType.php create mode 100644 src/GraphQL/Chat/Input/Channel/ChatChannelCreationInput.php create mode 100644 src/GraphQL/Chat/Input/Channel/ChatChannelInput.php create mode 100644 src/GraphQL/Chat/Input/Channel/ChatChannelUpdateInput.php create mode 100644 src/GraphQL/Chat/Input/Message/ChatMessageAttachmentInput.php create mode 100644 src/GraphQL/Chat/Input/Message/ChatMessageCreationInput.php create mode 100644 src/GraphQL/Chat/Input/Message/ChatMessageInput.php create mode 100644 src/GraphQL/Chat/Input/Message/ChatMessageUpdateInput.php create mode 100644 src/GraphQL/Chat/Resolver/ChatChannelMutationResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatChannelQueryResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatChannelRoleMutationResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatChannelRoleQueryResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatGptRBAC.php-r create mode 100644 src/GraphQL/Chat/Resolver/ChatMessageMutationResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatMessageQueryResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatParticipantMutationResolver.php create mode 100644 src/GraphQL/Chat/Resolver/ChatParticipantQueryResolver.php create mode 100644 src/GraphQL/Chat/Type/ChatChannelConnection.php create mode 100644 src/GraphQL/Chat/Type/ChatChannelEdge.php create mode 100644 src/GraphQL/Chat/Type/ChatChannelRoleConnection.php create mode 100644 src/GraphQL/Chat/Type/ChatChannelRoleEdge.php create mode 100644 src/GraphQL/Chat/Type/ChatMessageConnection.php create mode 100644 src/GraphQL/Chat/Type/ChatMessageEdge.php create mode 100644 src/GraphQL/Chat/Type/ChatParticipantConnection.php create mode 100644 src/GraphQL/Chat/Type/ChatParticipantEdge.php create mode 100644 src/GraphQL/Shipment/Input/Document/ShipmentOrderAttachmentInput.php create mode 100644 src/GraphQL/Shipment/Input/Document/ShipmentOrderDocumentInput.php create mode 100644 src/GraphQL/Shipment/Input/ShipmentOrderEstimatedNodeArrivalInput.php create mode 100644 src/GraphQL/Shipment/Input/ShipmentOrderNodeExecutionInput.php create mode 100644 src/Message/Chat/Channel/ChannelMutationCommand.php create mode 100644 src/Message/Chat/Channel/CountChannel.php create mode 100644 src/Message/Chat/Channel/CreateChannel.php create mode 100644 src/Message/Chat/Channel/DeleteChannel.php create mode 100644 src/Message/Chat/Channel/FindChannelById.php create mode 100644 src/Message/Chat/Channel/SearchChannel.php create mode 100644 src/Message/Chat/Channel/UpdateChannel.php create mode 100644 src/Message/Chat/Composition/ActiveParticipantAwareMessageInterface.php create mode 100644 src/Message/Chat/Composition/ActiveParticipantAwareMessageTrait.php create mode 100644 src/Message/Chat/Composition/ActiveUserAwareMessageInterface.php create mode 100644 src/Message/Chat/Composition/ActiveUserAwareMessageTrait.php create mode 100644 src/Message/Chat/Composition/ChannelAwareMessageInterface.php create mode 100644 src/Message/Chat/Composition/ChannelAwareMessageTrait.php create mode 100644 src/Message/Chat/Composition/ParticipantAwareMessageInterface.php create mode 100644 src/Message/Chat/Composition/ParticipantAwareMessageTrait.php create mode 100644 src/Message/Chat/Composition/SubjectAwareMessageInterface.php create mode 100644 src/Message/Chat/Composition/SubjectAwareMessageTrait.php create mode 100644 src/Message/Chat/Message/ChatMessageMutationCommand.php create mode 100644 src/Message/Chat/Message/CountChatMessage.php create mode 100644 src/Message/Chat/Message/CreateChatMessage.php create mode 100644 src/Message/Chat/Message/DeleteChatMessage.php create mode 100644 src/Message/Chat/Message/FindChatMessageById.php create mode 100644 src/Message/Chat/Message/SearchChatMessage.php create mode 100644 src/Message/Chat/Message/UpdateChatMessage.php create mode 100644 src/Message/Chat/Participant/CountParticipant.php create mode 100644 src/Message/Chat/Participant/CreateParticipant.php create mode 100644 src/Message/Chat/Participant/DeleteParticipant.php create mode 100644 src/Message/Chat/Participant/FindParticipantById.php create mode 100644 src/Message/Chat/Participant/ParticipantMutationCommand.php create mode 100644 src/Message/Chat/Participant/SearchParticipant.php create mode 100644 src/Message/Chat/Participant/UpdateParticipant.php create mode 100644 src/Message/Chat/Role/CountRole.php create mode 100644 src/Message/Chat/Role/CreateRole.php create mode 100644 src/Message/Chat/Role/DeleteRole.php create mode 100644 src/Message/Chat/Role/FindRoleById.php create mode 100644 src/Message/Chat/Role/RoleMutationCommand.php create mode 100644 src/Message/Chat/Role/SearchRole.php create mode 100644 src/Message/Chat/Role/UpdateRole.php create mode 100644 src/Message/Chat/Subject/CountSubject.php create mode 100644 src/Message/Chat/Subject/CreateSubject.php create mode 100644 src/Message/Chat/Subject/DeleteSubject.php create mode 100644 src/Message/Chat/Subject/FindSubjectById.php create mode 100644 src/Message/Chat/Subject/SearchSubject.php create mode 100644 src/Message/Chat/Subject/SubjectMutationCommand.php create mode 100644 src/Message/Chat/Subject/UpdateSubject.php create mode 100644 src/MessageHandler/Chat/ChatChannelMutationHandler.php create mode 100644 src/MessageHandler/Chat/ChatChannelQueryHandler.php create mode 100644 src/MessageHandler/Chat/ChatMessageMutationHandler.php create mode 100644 src/MessageHandler/Chat/ChatMessageQueryHandler.php create mode 100644 src/MessageHandler/Chat/ChatParticipantMutationHandler.php create mode 100644 src/MessageHandler/Chat/ChatParticipantQueryHandler.php create mode 100644 src/MessageHandler/Chat/ChatSubjectMutationHandler.php create mode 100644 src/MessageHandler/Chat/ChatSubjectQueryHandler.php create mode 100644 src/Repository/Chat/ChatBusinessParticipantRepository.php create mode 100644 src/Repository/Chat/ChatChannelRepository.php create mode 100644 src/Repository/Chat/ChatChannelRoleRepository.php create mode 100644 src/Repository/Chat/ChatMessageAttachmentRepository.php create mode 100644 src/Repository/Chat/ChatMessageRepository.php create mode 100644 src/Repository/Chat/ChatMessageViewRepository.php create mode 100644 src/Repository/Chat/ChatParticipantRepository.php create mode 100644 src/Repository/Chat/ChatSubjectRepository.php create mode 100644 src/Repository/Chat/ChatUserParticipantRepository.php create mode 100644 src/Service/Chat/ChainChatContextResolver.php create mode 100644 src/Service/Chat/ChatContextResolverInterface.php create mode 100644 src/Service/Chat/Exception/ChatChannelParticipanResolutionException.php diff --git a/config/graphql/types/Scalar.yaml b/config/graphql/types/Scalar.yaml new file mode 100644 index 0000000..35339b8 --- /dev/null +++ b/config/graphql/types/Scalar.yaml @@ -0,0 +1,12 @@ +# VehicleStatus: +# type: enum +# config: +# enumClass: App\Entity\Transport\Vehicle\VehicleStatus +# # values: +# # GREEN: +# # description: "The color green" + +UploadFile: + type: custom-scalar + config: + scalarType: '@=newObject("Overblog\\GraphQLBundle\\Upload\\Type\\GraphQLUploadType")' diff --git a/config/packages/graphql.yaml b/config/packages/graphql.yaml index 46e1b93..0d11c24 100644 --- a/config/packages/graphql.yaml +++ b/config/packages/graphql.yaml @@ -15,7 +15,7 @@ overblog_graphql: driver: query: DriverQuery mutation: DriverMutation - + admin: query: AdminQuery mutation: AdminMutation @@ -33,3 +33,7 @@ overblog_graphql: - type: attribute dir: "%kernel.project_dir%/src/GraphQL" suffix: null + + - type: attribute + dir: "%kernel.project_dir%/src/CQRS" + suffix: null diff --git a/migrations/Version20230930081522.php b/migrations/Version20230930081522.php new file mode 100644 index 0000000..030a313 --- /dev/null +++ b/migrations/Version20230930081522.php @@ -0,0 +1,37 @@ +addSql('CREATE TABLE shipment_order_shipment_document (shipment_order_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', shipment_document_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', INDEX IDX_4D2269C72BC89259 (shipment_order_id), INDEX IDX_4D2269C7EC01E0A3 (shipment_document_id), PRIMARY KEY(shipment_order_id, shipment_document_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE shipment_order_shipment_document ADD CONSTRAINT FK_4D2269C72BC89259 FOREIGN KEY (shipment_order_id) REFERENCES shipment_order (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE shipment_order_shipment_document ADD CONSTRAINT FK_4D2269C7EC01E0A3 FOREIGN KEY (shipment_document_id) REFERENCES shipment_document (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE shipment_document ADD meta LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', ADD type VARCHAR(32) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE shipment_order_shipment_document DROP FOREIGN KEY FK_4D2269C72BC89259'); + $this->addSql('ALTER TABLE shipment_order_shipment_document DROP FOREIGN KEY FK_4D2269C7EC01E0A3'); + $this->addSql('DROP TABLE shipment_order_shipment_document'); + $this->addSql('ALTER TABLE shipment_document DROP meta, DROP type'); + } +} diff --git a/migrations/Version20230930084905.php b/migrations/Version20230930084905.php new file mode 100644 index 0000000..31c3d50 --- /dev/null +++ b/migrations/Version20230930084905.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE shipment_document_attachment CHANGE src src VARCHAR(225) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE shipment_document_attachment CHANGE src src VARCHAR(64) NOT NULL'); + } +} diff --git a/src/CQRS/Command/EntityCreationCommandInterface.php b/src/CQRS/Command/EntityCreationCommandInterface.php new file mode 100644 index 0000000..41b5f37 --- /dev/null +++ b/src/CQRS/Command/EntityCreationCommandInterface.php @@ -0,0 +1,6 @@ +uid; + } + + public function setUid(?Ulid $uid): static{ + $this->uid = $uid; + return $this; + } + + +} \ No newline at end of file diff --git a/src/CQRS/Command/EntityMutationCommandInterface.php b/src/CQRS/Command/EntityMutationCommandInterface.php new file mode 100644 index 0000000..c5d60cf --- /dev/null +++ b/src/CQRS/Command/EntityMutationCommandInterface.php @@ -0,0 +1,11 @@ +uid; + } + + public function setUid(?Ulid $uid): static{ + $this->uid = $uid; + return $this; + } + + +} \ No newline at end of file diff --git a/src/CQRS/Command/EntityUpdateCommandInterface.php b/src/CQRS/Command/EntityUpdateCommandInterface.php new file mode 100644 index 0000000..bbe2ac4 --- /dev/null +++ b/src/CQRS/Command/EntityUpdateCommandInterface.php @@ -0,0 +1,6 @@ +getUid())){ + $uid = new Ulid(); + $command->setUid($uid); + } + + $this->commandBus->dispatch($command, $stamps); + + return $this->result ??= ( + ($command instanceof EntityCreationCommandInterface) ? + new CQRSEntryCreationCommandResult($uid, $this->clientMuationId) + : + new CQRSEntryUpdateCommandResult($uid, $this->clientMuationId) + ); + + } + +} \ No newline at end of file diff --git a/src/CQRS/Command/Result/CQRSCommandResult.php b/src/CQRS/Command/Result/CQRSCommandResult.php new file mode 100644 index 0000000..f7622a6 --- /dev/null +++ b/src/CQRS/Command/Result/CQRSCommandResult.php @@ -0,0 +1,22 @@ +clientMutationId = $clientMutationId; + } + + public function getClientMutationId(): ?string{ + return $this->clientMutationId; + } + +} \ No newline at end of file diff --git a/src/CQRS/Command/Result/CQRSEntityMutationResult.php b/src/CQRS/Command/Result/CQRSEntityMutationResult.php new file mode 100644 index 0000000..88a2340 --- /dev/null +++ b/src/CQRS/Command/Result/CQRSEntityMutationResult.php @@ -0,0 +1,32 @@ +uid = $uid; + parent::__construct($clientMutationId); + } + + + public function getUid(): ?Ulid{ + return $this->uid; + } + + #[Field(name: 'id', type: 'Ulid')] + public function getId(): ?Ulid{ + return $this->getUid(); + } + +} \ No newline at end of file diff --git a/src/CQRS/Command/Result/CQRSEntryCreationCommandResult.php b/src/CQRS/Command/Result/CQRSEntryCreationCommandResult.php new file mode 100644 index 0000000..565407d --- /dev/null +++ b/src/CQRS/Command/Result/CQRSEntryCreationCommandResult.php @@ -0,0 +1,9 @@ + + */ + private array $results = []; + + + /** + * @var array + */ + private array $mutationContexts = []; + + + public function __construct(private BaseMessageBusInterface $commandBus,private UlidFactory $ulidFactory) { + parent::__construct($commandBus); + } + + public function getMutationContext(?string $clientMutationId = null): MutationCommandContext{ + + if( is_string($clientMutationId) && array_key_exists($clientMutationId,$this->mutationContexts)){ + return $this->mutationContexts[$clientMutationId]; + } + + $context = new MutationCommandContext($this, $clientMutationId); + + if(is_string($clientMutationId)) + return $this->mutationContexts[$clientMutationId] = $context; + + return $context; + } + + public function dispatchContextual(EntityCreationCommandInterface $command, ?string $clientMuationId): CQRSEntryCreationCommandResult{ + return $this->getMutationContext($clientMuationId)->dispatch($command); + } + + + // public function getOptimisticEntryCreationResult(?string $clientMutationId = null): CQRSEntryCreationCommandResult{ + + // if( is_string($clientMutationId) && array_key_exists($clientMutationId,$this->results)){ + // return $this->results[$clientMutationId]; + // } + + // $ulid = $this->ulidFactory->create(); + // $result = new CQRSEntryCreationCommandResult($ulid); + + // if(is_string($clientMutationId)) + // return $this->results[$clientMutationId] = $result; + + // return $result; + // } + +} \ No newline at end of file diff --git a/src/CQRS/CommandBusInterface.php b/src/CQRS/CommandBusInterface.php new file mode 100644 index 0000000..99ff931 --- /dev/null +++ b/src/CQRS/CommandBusInterface.php @@ -0,0 +1,11 @@ +initiatingUserId = $initiatingUserId; + return $this; + } + + public function getInitiatingUserId(): ?Ulid{ + // if (!isset($this->initiatingUserId)) + // throw new \LogicException("initiatingUserId is not yet set"); + + return $this->initiatingUserId; + } +} \ No newline at end of file diff --git a/src/CQRS/CustomMessageBus.php b/src/CQRS/CustomMessageBus.php new file mode 100644 index 0000000..71d5348 --- /dev/null +++ b/src/CQRS/CustomMessageBus.php @@ -0,0 +1,24 @@ +defaultBus = $defaultBus; + } + + public function dispatch($message, array $stamps = []): Envelope + { + // Add the TransportStamp to specify the transport as "sync" + $stamps[] = new TransportNamesStamp(['sync']); + return $this->defaultBus->dispatch($message, $stamps); + } +} diff --git a/src/CQRS/Event/EventInterface.php b/src/CQRS/Event/EventInterface.php new file mode 100644 index 0000000..0fdccb4 --- /dev/null +++ b/src/CQRS/Event/EventInterface.php @@ -0,0 +1,7 @@ +messageBus->dispatch($query, $stamps); + } +} \ No newline at end of file diff --git a/src/CQRS/MessageBusInterface.php b/src/CQRS/MessageBusInterface.php new file mode 100644 index 0000000..cc1ce4d --- /dev/null +++ b/src/CQRS/MessageBusInterface.php @@ -0,0 +1,11 @@ + $stamps + */ + public function dispatch(object $message,array $stamps = []): Envelope; +} \ No newline at end of file diff --git a/src/CQRS/MessageInterface.php b/src/CQRS/MessageInterface.php new file mode 100644 index 0000000..0597766 --- /dev/null +++ b/src/CQRS/MessageInterface.php @@ -0,0 +1,7 @@ +filter; + } + + + public function getAdditionalConstraints(): ?array{ + return $this->additionalConstraints; + } + +} \ No newline at end of file diff --git a/src/CQRS/Query/CollectionSearchQuery.php b/src/CQRS/Query/CollectionSearchQuery.php new file mode 100644 index 0000000..26cf7d7 --- /dev/null +++ b/src/CQRS/Query/CollectionSearchQuery.php @@ -0,0 +1,28 @@ +filter; + } + + + public function getOffset(): int{ + return $this->offset; + } + + public function getLimit(): ?int{ + return $this->limit; + } +} \ No newline at end of file diff --git a/src/CQRS/Query/QueryInterface.php b/src/CQRS/Query/QueryInterface.php new file mode 100644 index 0000000..69da472 --- /dev/null +++ b/src/CQRS/Query/QueryInterface.php @@ -0,0 +1,7 @@ +messageBus = $queryBus; + } + + /** + * @param object $query + * @param mixed $stamps + * @return mixed + */ + public function query(object $query, array $stamps = array()): mixed { + return $this->handle($query); + } +} \ No newline at end of file diff --git a/src/CQRS/QueryBusInterface.php b/src/CQRS/QueryBusInterface.php new file mode 100644 index 0000000..ab4fa40 --- /dev/null +++ b/src/CQRS/QueryBusInterface.php @@ -0,0 +1,7 @@ +businessId; + } + + public function setBusinessId(?Ulid $businessId): self + { + $this->businessId = $businessId; + + return $this; + } +} diff --git a/src/Entity/Chat/ChatChannel.php b/src/Entity/Chat/ChatChannel.php new file mode 100644 index 0000000..707f15e --- /dev/null +++ b/src/Entity/Chat/ChatChannel.php @@ -0,0 +1,310 @@ + 0])] + private ?int $participantCount = 0; + + /** + * @var ChatParticipant[] + */ + #[GQL\Field()] + #[ORM\OneToMany(mappedBy: 'channel', targetEntity: ChatParticipant::class, cascade: ['persist','remove'], orphanRemoval: true)] + private Collection $participants; + + /** + * @var ChatSubject[] + */ + #[GQL\Field()] + #[ORM\OneToMany(mappedBy: 'channel', targetEntity: ChatSubject::class, cascade: ['persist','remove'], orphanRemoval: true)] + private Collection $subjects; + + /** + * @var ChatMessage[] + */ + #[ORM\OneToMany(mappedBy: 'channel', targetEntity: ChatMessage::class, cascade: ['persist','remove'], orphanRemoval: true)] + private Collection $messages; + + /** + * @var ChatChannelRole[] + */ + #[GQL\Field()] + #[ORM\OneToMany(mappedBy: 'channel', targetEntity: ChatChannelRole::class, cascade: ['persist','remove'], orphanRemoval: true)] + private Collection $chatChannelRoles; + + #[GQL\Field()] + #[ORM\Column(length: 64, nullable: true)] + private ?string $title = null; + + #[GQL\Field()] + #[ORM\Column(length: 255, nullable: true)] + private ?string $subtitle = null; + + + public function __construct(?Ulid $id = null) + { + $this->id = $id; + $this->participants = new ArrayCollection(); + $this->createdAt = new \DateTimeImmutable(); + $this->subjects = new ArrayCollection(); + $this->messages = new ArrayCollection(); + $this->chatChannelRoles = new ArrayCollection(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): self + { + $this->code = $code; + + return $this; + } + + public function getReference(): ?string + { + return $this->reference; + } + + public function setReference(string $reference): self + { + $this->reference = $reference; + + return $this; + } + + public function getSubject(): ?string + { + return $this->subject; + } + + public function setSubject(?string $subject): self + { + $this->subject = $subject; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(\DateTimeImmutable $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return Collection + */ + public function getParticipants(): Collection + { + return $this->participants; + } + + public function addParticipant(ChatParticipant $participant): self + { + if (!$this->participants->contains($participant)) { + $this->participants->add($participant); + $participant->setChannel($this); + } + + $this->updateParticipantCount(); + return $this; + } + + public function removeParticipant(ChatParticipant $participant): self + { + if ($this->participants->removeElement($participant)) { + // set the owning side to null (unless already changed) + if ($participant->getChannel() === $this) { + $participant->setChannel(null); + } + } + + $this->updateParticipantCount(); + return $this; + } + + /** + * @return Collection + */ + public function getSubjects(): Collection + { + return $this->subjects; + } + + public function addSubject(ChatSubject $subject): self + { + if (!$this->subjects->contains($subject)) { + $this->subjects->add($subject); + $subject->setChannel($this); + } + + return $this; + } + + public function removeSubject(ChatSubject $subject): self + { + if ($this->subjects->removeElement($subject)) { + // set the owning side to null (unless already changed) + if ($subject->getChannel() === $this) { + $subject->setChannel(null); + } + } + + return $this; + } + + /** + * @return Collection + */ + public function getMessages(): Collection + { + return $this->messages; + } + + public function addMessage(ChatMessage $message): self + { + if (!$this->messages->contains($message)) { + $this->messages->add($message); + $message->setChannel($this); + } + + return $this; + } + + public function removeMessage(ChatMessage $message): self + { + if ($this->messages->removeElement($message)) { + // set the owning side to null (unless already changed) + if ($message->getChannel() === $this) { + $message->setChannel(null); + } + } + + return $this; + } + + /** + * @return Collection + */ + public function getChatChannelRoles(): Collection + { + return $this->chatChannelRoles; + } + + public function addChatChannelRole(ChatChannelRole $chatChannelRole): self + { + if (!$this->chatChannelRoles->contains($chatChannelRole)) { + $this->chatChannelRoles->add($chatChannelRole); + $chatChannelRole->setChannel($this); + } + + return $this; + } + + public function removeChatChannelRole(ChatChannelRole $chatChannelRole): self + { + if ($this->chatChannelRoles->removeElement($chatChannelRole)) { + // set the owning side to null (unless already changed) + if ($chatChannelRole->getChannel() === $this) { + $chatChannelRole->setChannel(null); + } + } + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(?string $title): self + { + $this->title = $title; + + return $this; + } + + public function getSubtitle(): ?string + { + return $this->subtitle; + } + + public function setSubtitle(?string $subtitle): self + { + $this->subtitle = $subtitle; + + return $this; + } + + + + #[GQL\Field(name: 'participantCount')] + public function getParticipantCount(?string $role = null): ?int + { + if($role){ + return $this->participants + ->filter(fn(ChatParticipant $participant) => $participant->getRole()?->getCode() === $role) + ->count(); + } + + + return $this->participants->count(); + + // return $this->participantCount; + } + + public function updateParticipantCount(): self + { + $this->participantCount = $this->participants->count(); + return $this; + } +} diff --git a/src/Entity/Chat/ChatChannelRole.php b/src/Entity/Chat/ChatChannelRole.php new file mode 100644 index 0000000..078f3a4 --- /dev/null +++ b/src/Entity/Chat/ChatChannelRole.php @@ -0,0 +1,151 @@ +chatParticipants = new ArrayCollection(); + $this->createdAt = new \DateTimeImmutable(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getChannel(): ?ChatChannel + { + return $this->channel; + } + + public function setChannel(?ChatChannel $channel): self + { + $this->channel = $channel; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): self + { + $this->code = $code; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(?string $title): self + { + $this->title = $title; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(\DateTimeImmutable $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @return Collection + */ + public function getChatParticipants(): Collection + { + return $this->chatParticipants; + } + + public function addChatParticipant(ChatParticipant $chatParticipant): self + { + if (!$this->chatParticipants->contains($chatParticipant)) { + $this->chatParticipants->add($chatParticipant); + $chatParticipant->setRole($this); + } + + return $this; + } + + public function removeChatParticipant(ChatParticipant $chatParticipant): self + { + if ($this->chatParticipants->removeElement($chatParticipant)) { + // set the owning side to null (unless already changed) + if ($chatParticipant->getRole() === $this) { + $chatParticipant->setRole(null); + } + } + + return $this; + } + + public function getMaxNumOfParticipant(): ?int + { + return $this->maxNumOfParticipant; + } + + public function setMaxNumOfParticipant(int $maxNumOfParticipant): self + { + $this->maxNumOfParticipant = $maxNumOfParticipant; + + return $this; + } +} diff --git a/src/Entity/Chat/ChatMessage.php b/src/Entity/Chat/ChatMessage.php new file mode 100644 index 0000000..3ca7fe7 --- /dev/null +++ b/src/Entity/Chat/ChatMessage.php @@ -0,0 +1,231 @@ +attachments = new ArrayCollection(); + $this->chatMessageViews = new ArrayCollection(); + $this->id = $id; + $this->createdAt = new \DateTimeImmutable(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getChannel(): ?ChatChannel + { + return $this->channel; + } + + public function setChannel(?ChatChannel $channel): self + { + $this->channel = $channel; + + return $this; + } + + public function getSubject(): ?ChatSubject + { + return $this->subject; + } + + public function setSubject(?ChatSubject $subject): self + { + $this->subject = $subject; + + return $this; + } + + + public function getParticipant(): ?ChatParticipant + { + return $this->participant; + } + + public function setParticipant(?ChatParticipant $participant): self + { + $this->participant = $participant; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(?string $title): self + { + $this->title = $title; + + return $this; + } + + public function getBody(): ?string + { + return $this->body; + } + + public function setBody(string $body): self + { + $this->body = $body; + + return $this; + } + + /** + * @return Collection + */ + public function getAttachments(): Collection + { + return $this->attachments; + } + + public function addAttachment(ChatMessageAttachment $attachment): self + { + if (!$this->attachments->contains($attachment)) { + $this->attachments->add($attachment); + $attachment->setMessage($this); + } + + return $this; + } + + public function removeAttachment(ChatMessageAttachment $attachment): self + { + if ($this->attachments->removeElement($attachment)) { + // set the owning side to null (unless already changed) + if ($attachment->getMessage() === $this) { + $attachment->setMessage(null); + } + } + + return $this; + } + + public function getSentAt(): ?\DateTimeImmutable + { + return $this->sentAt; + } + + public function setSentAt(?\DateTimeImmutable $sentAt): self + { + $this->sentAt = $sentAt; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(\DateTimeImmutable $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + + + /** + * @return Collection + */ + public function getChatMessageViews(): Collection + { + return $this->chatMessageViews; + } + + public function addChatMessageView(ChatMessageView $chatMessageView): self + { + if (!$this->chatMessageViews->contains($chatMessageView)) { + $this->chatMessageViews->add($chatMessageView); + $chatMessageView->setMessage($this); + } + + return $this; + } + + public function removeChatMessageView(ChatMessageView $chatMessageView): self + { + if ($this->chatMessageViews->removeElement($chatMessageView)) { + // set the owning side to null (unless already changed) + if ($chatMessageView->getMessage() === $this) { + $chatMessageView->setMessage(null); + } + } + + return $this; + } + +} diff --git a/src/Entity/Chat/ChatMessageAttachment.php b/src/Entity/Chat/ChatMessageAttachment.php new file mode 100644 index 0000000..8be7209 --- /dev/null +++ b/src/Entity/Chat/ChatMessageAttachment.php @@ -0,0 +1,90 @@ +id; + } + + public function getMessage(): ?ChatMessage + { + return $this->message; + } + + public function setMessage(?ChatMessage $message): self + { + $this->message = $message; + + return $this; + } + + public function getUri(): ?string + { + return $this->uri; + } + + public function setUri(string $uri): self + { + $this->uri = $uri; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(?string $type): self + { + $this->type = $type; + + return $this; + } + + public function getSize(): ?int + { + return $this->size; + } + + public function setSize(?int $size): self + { + $this->size = $size; + + return $this; + } +} diff --git a/src/Entity/Chat/ChatMessageView.php b/src/Entity/Chat/ChatMessageView.php new file mode 100644 index 0000000..aabd5fd --- /dev/null +++ b/src/Entity/Chat/ChatMessageView.php @@ -0,0 +1,79 @@ +id = $id; + $this->viewedAt = new \DateTimeImmutable(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getMessage(): ?ChatMessage + { + return $this->message; + } + + public function setMessage(?ChatMessage $message): self + { + $this->message = $message; + + return $this; + } + + public function getParticipant(): ?ChatParticipant + { + return $this->participant; + } + + public function setParticipant(?ChatParticipant $participant): self + { + $this->participant = $participant; + + return $this; + } + + public function getViewedAt(): ?\DateTimeImmutable + { + return $this->viewedAt; + } + + public function setViewedAt(\DateTimeImmutable $viewedAt): self + { + $this->viewedAt = $viewedAt; + + return $this; + } +} diff --git a/src/Entity/Chat/ChatParticipant.php b/src/Entity/Chat/ChatParticipant.php new file mode 100644 index 0000000..6aa2ab6 --- /dev/null +++ b/src/Entity/Chat/ChatParticipant.php @@ -0,0 +1,113 @@ +id = $id; + $this->createdAt = new \DateTimeImmutable(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(?string $code): self + { + $this->code = $code; + + return $this; + } + + public function getChannel(): ?ChatChannel + { + return $this->channel; + } + + public function setChannel(?ChatChannel $channel): self + { + $this->channel = $channel; + + return $this; + } + + public function getCreatedAt(): ?\DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(\DateTimeImmutable $createdAt): self + { + $this->createdAt = $createdAt; + + return $this; + } + + public function getRole(): ?ChatChannelRole + { + return $this->role; + } + + public function setRole(?ChatChannelRole $role): self + { + $this->role = $role; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): self + { + $this->name = $name; + + return $this; + } +} diff --git a/src/Entity/Chat/ChatSubject.php b/src/Entity/Chat/ChatSubject.php new file mode 100644 index 0000000..e94fe0e --- /dev/null +++ b/src/Entity/Chat/ChatSubject.php @@ -0,0 +1,120 @@ +id = $id; + $this->messages = new ArrayCollection(); + // $this->createdAt = new \DateTimeImmutable(); + } + + public function getId(): ?Ulid + { + return $this->id; + } + + public function getChannel(): ?ChatChannel + { + return $this->channel; + } + + public function setChannel(?ChatChannel $channel): self + { + $this->channel = $channel; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(?string $title): self + { + $this->title = $title; + + return $this; + } + + public function getSubtitle(): ?string + { + return $this->subtitle; + } + + public function setSubtitle(?string $subtitle): self + { + $this->subtitle = $subtitle; + + return $this; + } + + /** + * @return Collection + */ + public function getMessages(): Collection + { + return $this->messages; + } + + public function addMessage(ChatMessage $message): self + { + if (!$this->messages->contains($message)) { + $this->messages->add($message); + $message->setSubject($this); + } + + return $this; + } + + public function removeMessage(ChatMessage $message): self + { + if ($this->messages->removeElement($message)) { + // set the owning side to null (unless already changed) + if ($message->getSubject() === $this) { + $message->setSubject(null); + } + } + + return $this; + } +} diff --git a/src/Entity/Chat/ChatUserParticipant.php b/src/Entity/Chat/ChatUserParticipant.php new file mode 100644 index 0000000..33258fb --- /dev/null +++ b/src/Entity/Chat/ChatUserParticipant.php @@ -0,0 +1,48 @@ +user; + // } + + // public function setUser(?User $user): self + // { + // $this->user = $user; + + // return $this; + // } + + public function getUserId(): ?Ulid + { + return $this->userId; + } + + public function setUserId(?Ulid $userId): self + { + $this->userId = $userId; + + return $this; + } +} diff --git a/src/Entity/Shipment/Document/ShipmentDocument.php b/src/Entity/Shipment/Document/ShipmentDocument.php index fe4278c..18dd4f4 100644 --- a/src/Entity/Shipment/Document/ShipmentDocument.php +++ b/src/Entity/Shipment/Document/ShipmentDocument.php @@ -22,14 +22,22 @@ class ShipmentDocument #[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')] private ?Ulid $id = null; - #[GQL\Field(type:'[ShipmentDocumentAttachment!]!')] - #[ORM\OneToMany(mappedBy: 'document', targetEntity: ShipmentDocumentAttachment::class, orphanRemoval: true)] + #[GQL\Field(type: '[ShipmentDocumentAttachment!]!')] + #[ORM\OneToMany(mappedBy: 'document', targetEntity: ShipmentDocumentAttachment::class, orphanRemoval: true, cascade:['persist', 'remove'])] private Collection $attachments; #[GQL\Field()] #[ORM\OneToOne(mappedBy: 'pickupConfirmation', cascade: ['persist', 'remove'])] private ?ShipmentOrder $shipmentOrder = null; + #[GQL\Field(type: 'Json')] + #[ORM\Column] + private array $meta = []; + + #[GQL\Field()] + #[ORM\Column(length: 32, enumType: ShipmentDocumentType::class)] + private ?ShipmentDocumentType $type = null; + public function __construct() { $this->attachments = new ArrayCollection(); @@ -91,4 +99,28 @@ public function setShipmentOrder(?ShipmentOrder $shipmentOrder): static return $this; } + + public function getMeta(): array + { + return $this->meta; + } + + public function setMeta(array $meta): static + { + $this->meta = $meta; + + return $this; + } + + public function getType(): ?ShipmentDocumentType + { + return $this->type; + } + + public function setType(ShipmentDocumentType $type): static + { + $this->type = $type; + + return $this; + } } diff --git a/src/Entity/Shipment/Document/ShipmentDocumentAttachment.php b/src/Entity/Shipment/Document/ShipmentDocumentAttachment.php index 8104ec7..8d102b6 100644 --- a/src/Entity/Shipment/Document/ShipmentDocumentAttachment.php +++ b/src/Entity/Shipment/Document/ShipmentDocumentAttachment.php @@ -20,11 +20,11 @@ class ShipmentDocumentAttachment private ?Ulid $id = null; #[GQL\Field()] - #[ORM\Column(length: 32)] - private ?string $type = null; + #[ORM\Column(length: 32, enumType: ShipmentDocumentAttachmentType::class)] + private ?ShipmentDocumentAttachmentType $type = null; #[GQL\Field()] - #[ORM\Column(length: 64)] + #[ORM\Column(length: 225)] private ?string $src = null; #[GQL\Field()] @@ -45,12 +45,12 @@ public function getId(): ?Ulid return $this->id; } - public function getType(): ?string + public function getType(): ?ShipmentDocumentAttachmentType { return $this->type; } - public function setType(string $type): static + public function setType(ShipmentDocumentAttachmentType $type): static { $this->type = $type; diff --git a/src/Entity/Shipment/Document/ShipmentDocumentAttachmentType.php b/src/Entity/Shipment/Document/ShipmentDocumentAttachmentType.php new file mode 100644 index 0000000..368e1c6 --- /dev/null +++ b/src/Entity/Shipment/Document/ShipmentDocumentAttachmentType.php @@ -0,0 +1,12 @@ +createdAt = new \DateTimeImmutable(); $this->activities = new ArrayCollection(); $this->charges = new ArrayCollection(); + $this->documents = new ArrayCollection(); } public function getId(): ?Ulid { @@ -422,6 +427,14 @@ public function getPickupConfirmation(): ?ShipmentDocument public function setPickupConfirmation(?ShipmentDocument $pickupConfirmation): static { + $crnt = $this->pickupConfirmation; + if (!($pickupConfirmation)) { + if ($crnt) + $this->removeDocument($crnt); + } else { + $this->addDocument($pickupConfirmation); + } + $this->pickupConfirmation = $pickupConfirmation; return $this; @@ -434,8 +447,40 @@ public function getProofOfDelivery(): ?ShipmentDocument public function setProofOfDelivery(?ShipmentDocument $proofOfDelivery): static { + $crnt = $this->proofOfDelivery; + if (!($proofOfDelivery)) { + if ($crnt) + $this->removeDocument($crnt); + } else { + $this->addDocument($proofOfDelivery); + } + $this->proofOfDelivery = $proofOfDelivery; return $this; } + + /** + * @return Collection + */ + public function getDocuments(): Collection + { + return $this->documents; + } + + public function addDocument(ShipmentDocument $document): static + { + if (!$this->documents->contains($document)) { + $this->documents->add($document); + } + + return $this; + } + + public function removeDocument(ShipmentDocument $document): static + { + $this->documents->removeElement($document); + + return $this; + } } diff --git a/src/Entity/Shipment/ShipmentOrderStatus.php b/src/Entity/Shipment/ShipmentOrderStatus.php index 3f6aadb..f231807 100644 --- a/src/Entity/Shipment/ShipmentOrderStatus.php +++ b/src/Entity/Shipment/ShipmentOrderStatus.php @@ -11,5 +11,6 @@ enum ShipmentOrderStatus: string case CANCELLED = 'CANCELLED'; case PROCESSING = 'PROCESSING'; case INTRANSIT = 'INTRANSIT'; + case DELIVERED = 'DELIVERED'; case COMPLETED = 'COMPLETED'; } diff --git a/src/Entity/Shipment/ShipmentStatus.php b/src/Entity/Shipment/ShipmentStatus.php index e96f7b0..d79a52d 100644 --- a/src/Entity/Shipment/ShipmentStatus.php +++ b/src/Entity/Shipment/ShipmentStatus.php @@ -9,6 +9,9 @@ enum ShipmentStatus: string{ case PUBLISHED = 'PUBLISHED'; case CANCELLED = 'CANCELLED'; case PROCESSING = 'PROCESSING'; + + case INTRANSIT = 'INTRANSIT'; + case DELIVERED = 'DELIVERED'; case ACTIVE = 'ACTIVE'; case COMPLETED = 'COMPLETED'; } \ No newline at end of file diff --git a/src/GraphQL/Chat/Input/Channel/ChatChannelCreationInput.php b/src/GraphQL/Chat/Input/Channel/ChatChannelCreationInput.php new file mode 100644 index 0000000..bdc2675 --- /dev/null +++ b/src/GraphQL/Chat/Input/Channel/ChatChannelCreationInput.php @@ -0,0 +1,8 @@ +setTitlte($input->title) + ; + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg(name: 'clientId', type: 'Ulid!')] + #[Arg(name: 'input', type: 'ChatChannelUpdateInput!')] + #[Arg(name: 'clientMutationId', type: 'String')] + public function updateChatChannel(Ulid $id, ChatChannelUpdateInput $input, ?string $clientMutationId = null): CQRSEntryUpdateCommandResult + { + + $command = new UpdateChannel($id); + $command + // ->setTitle($input->title) + ; + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg(name: 'clientId', type: 'Ulid!'),] + #[Arg(name: 'clientMutationId', type: 'String')] + public function deleteChatChannel(Ulid $id, ?string $clientMutationId = null): ?bool + { + $command = new DeleteChannel($id); + $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + return null; + } +} diff --git a/src/GraphQL/Chat/Resolver/ChatChannelQueryResolver.php b/src/GraphQL/Chat/Resolver/ChatChannelQueryResolver.php new file mode 100644 index 0000000..0855948 --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatChannelQueryResolver.php @@ -0,0 +1,72 @@ +queryBus->query(new FindChannelById($id)); + } + + + + #[Query(name: 'get_chat_channel_list')] + public function getChatChannelList( + ?string $filter = null, + ?int $first = null, + ?string $after = null, + ): ChatChannelConnection { + + $cb = new ConnectionBuilder( + null, + fn ($edges, PageInfoInterface $pageInfo) => new ChatChannelConnection($edges, $pageInfo), + fn (string $coursor, ChatChannel $brand, int $index) => new ChatChannelEdge($coursor, $brand) + ); + $total = fn () => $this->queryBus->query(new CountChannel($filter)); + $paginator = new Paginator(function (?int $offset, ?int $limit) use ($filter) { + + $query = new SearchChannel( + filter: $filter, + offset: $offset, + limit: $limit, + + ); + + return $this->queryBus->query($query); + }, false, $cb); + + + return $paginator->auto(new Argument(['first' => $first, 'after' => $after]), $total); + } +} diff --git a/src/GraphQL/Chat/Resolver/ChatChannelRoleMutationResolver.php b/src/GraphQL/Chat/Resolver/ChatChannelRoleMutationResolver.php new file mode 100644 index 0000000..5ebd1fb --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatChannelRoleMutationResolver.php @@ -0,0 +1,91 @@ +getChannelRoleByChannelId($input->channelId); + $command = new CreateChatMessage(); + $command + // ->setChannelId($input->channelId) + // ->setSubjectId($input->subjectId) + // ->setChannelRoleId($role->getId()) + // ->setBody($input->body) + ; + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg(name: 'clientId', type: 'Ulid!')] + #[Arg(name: 'input', type: 'ChatMessageUpdateInput!')] + #[Arg(name: 'clientMutationId', type: 'String')] + public function updateChatMessage(Ulid $id, ChatMessageUpdateInput $input, ?string $clientMutationId = null): CQRSEntryUpdateCommandResult + { + + // if( $input->code && $this->queryBus->query(new CountChatMessage(filter: ['code' => $input->code])) > 0){ + // throw new UserError("ChatMessage ChatMessage With [code:{$input->code}] already exists"); + // } + + $role = $this->getChannelRoleByChannelId($input->channelId); + $command = new UpdateChatMessage($id); + $command + // ->setChannelId($input->channelId) + // ->setSubjectId($input->subjectId) + // ->setChannelRoleId($role->getId()) + // ->setBody($input->body) + ; + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg(name: 'clientId', type: 'Ulid!')] + #[Arg(name: 'clientMutationId', type: 'String')] + public function deleteChatMessage(Ulid $id, ?string $clientMutationId = null): ?bool + { + $command = new DeleteChatMessage($id); + $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + return null; + } + + + + + public function getChannelRoleByChannelId(Ulid $id): ChatParticipant{ + return $this->chatContextResolver->resolveCurrentChatParticipantForChannelId($id); + } + + +} \ No newline at end of file diff --git a/src/GraphQL/Chat/Resolver/ChatChannelRoleQueryResolver.php b/src/GraphQL/Chat/Resolver/ChatChannelRoleQueryResolver.php new file mode 100644 index 0000000..8e4afb2 --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatChannelRoleQueryResolver.php @@ -0,0 +1,79 @@ +queryBus->query(new FindRoleById($id)); + + } + + + + #[Query(name: 'get_chat_channel_role_list')] + #[Arg(name: 'channelId', type: 'Ulid!')] + #[Arg(name: 'filter', type: 'String!')] + #[Arg(name: 'first', type: 'String')] + #[Arg(name: 'after', type: 'String')] + public function getChatChannelRoleList( + Ulid $channelId, + ?string $filter = null, + ?int $first = null, + ?string $after = null, + ): ChatChannelRoleConnection { + + $cb = new ConnectionBuilder( + null, + fn($edges, PageInfoInterface $pageInfo) => new ChatChannelRoleConnection($edges, $pageInfo), fn(string $coursor, ChatChannelRole $brand, int $index) => new ChatChannelRoleEdge($coursor, $brand) + ); + + $total = fn() => $this->queryBus->query((new CountRole($filter))->setChannelId($channelId)); + $paginator = new Paginator(function (?int $offset, ?int $limit) use ($filter, $channelId) { + + $query = (new SearchRole( + filter: $filter, + offset: $offset, + limit: $limit, + + ))->setChannelId($channelId); + + return $this->queryBus->query($query); + }, false, $cb); + + + return $paginator->auto(new Argument(['first' => $first, 'after' => $after]), $total); + } +} \ No newline at end of file diff --git a/src/GraphQL/Chat/Resolver/ChatGptRBAC.php-r b/src/GraphQL/Chat/Resolver/ChatGptRBAC.php-r new file mode 100644 index 0000000..f92e58f --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatGptRBAC.php-r @@ -0,0 +1,170 @@ +subjects = new ArrayCollection(); + $this->roles = new ArrayCollection(); + } + + // getters and setters +} + +// Subject entity +class Subject { + /** + * @ORM\Id() + * @ORM\GeneratedValue() + * @ORM\Column(type="integer") + */ + private $id; + + /** + * @ORM\Column(type="string", length=255) + */ + private $name; + + /** + * @ORM\ManyToOne(targetEntity="App\Entity\SubjectType", inversedBy="subjects") + */ + private $subjectType; + + /** + * @ORM\OneToMany(targetEntity="App\Entity\UserPermission", mappedBy="subject") + */ + private $userPermissions; + + public function __construct() + { + $this->userPermissions = new ArrayCollection(); + } + + // getters and setters +} + +// Role entity +class Role { + /** + * @ORM\Id() + * @ORM\GeneratedValue() + * @ORM\Column(type="integer") + */ + private $id; + + /** + * @ORM\Column(type="string", length=255) + */ + private $name; + + /** + * @ORM\ManyToOne(targetEntity="App\Entity\SubjectType", inversedBy="roles") + */ + private $subjectType; + + /** + * @ORM\OneToMany(targetEntity="App\Entity\ConsumerRoleAssignment", mappedBy="role") + */ + private $consumerRoleAssignments; + + public function __construct() + { + $this->consumerRoleAssignments = new ArrayCollection(); + } + + // getters and setters +} + +// Permission entity +class Permission { + /** + * @ORM\Id() + * @ORM\GeneratedValue() + * @ORM\Column(type="integer") + */ + private $id; + + /** + * @ORM\Column(type="string", length=255) + */ + private $name; + + /** + * @ORM\Column(type="string", length=255) + */ + private $operation; + + /** + * @ORM\ManyToMany(targetEntity="App\Entity\Role", inversedBy="permissions") + */ + private $roles; + + /** + * @ORM\ManyToMany(targetEntity="App\Entity\PermissionConsumer", inversedBy="permissions") + */ + private $permissionConsumers; + + /** + * @ORM\OneToMany(targetEntity="App\Entity\UserPermission", mappedBy="permission") + */ + private $userPermissions; + + public function __construct() + { + $this->roles = new ArrayCollection(); + $this->permissionConsumers = new ArrayCollection(); + $this->userPermissions = new ArrayCollection(); + } + + // getters and setters +} + +// PermissionConsumer entity +class PermissionConsumer { + /** + * @ORM\Id() + * @ORM\GeneratedValue() + * @ORM\Column(type="integer") + */ + private $id; + + /** + * @ORM\Column(type="string", length=255) + */ + private $name; + + /** + * @ORM\Column(type="string", length=255) + */ + private $type; + + /** + * @ORM\OneToMany + * + */ + +} diff --git a/src/GraphQL/Chat/Resolver/ChatMessageMutationResolver.php b/src/GraphQL/Chat/Resolver/ChatMessageMutationResolver.php new file mode 100644 index 0000000..7f2c0fa --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatMessageMutationResolver.php @@ -0,0 +1,93 @@ +getParticipantByChannelId($input->channelId); + $command = new CreateChatMessage(); + $command + ->setChannelId($input->channelId) + ->setSubjectId($input->subjectId) + ->setParticipantId($participant->getId()) + ->setBody($input->body); + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg(name: 'clientId', type: 'Ulid!')] + #[Arg(name: 'input', type: 'ChatMessageUpdateInput!')] + #[Arg(name: 'clientMutationId', type: 'String')] + public function updateChatMessage(Ulid $id, ChatMessageUpdateInput $input, ?string $clientMutationId = null): CQRSEntryUpdateCommandResult + { + + // if( $input->code && $this->queryBus->query(new CountChatMessage(filter: ['code' => $input->code])) > 0){ + // throw new UserError("ChatMessage ChatMessage With [code:{$input->code}] already exists"); + // } + + $participant = $this->getParticipantByChannelId($input->channelId); + $command = new UpdateChatMessage($id); + $command + ->setChannelId($input->channelId) + ->setSubjectId($input->subjectId) + ->setParticipantId($participant->getId()) + ->setBody($input->body); + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg( + name: 'clientId', + type: 'Ulid!' + )] + #[Arg( + name: 'clientMutationId', + type: 'String' + )] + public function deleteChatMessage(Ulid $id, ?string $clientMutationId = null): ?bool + { + $command = new DeleteChatMessage($id); + $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + return null; + } + + + + + public function getParticipantByChannelId(Ulid $id): ChatParticipant + { + return $this->chatContextResolver->resolveCurrentChatParticipantForChannelId($id); + } +} diff --git a/src/GraphQL/Chat/Resolver/ChatMessageQueryResolver.php b/src/GraphQL/Chat/Resolver/ChatMessageQueryResolver.php new file mode 100644 index 0000000..fe67942 --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatMessageQueryResolver.php @@ -0,0 +1,135 @@ +chatContextResolver->resolveCurrentChatParticipantForChannelId($channelId); + } + + + + + + #[Query(name: "get_chat_message")] + #[Arg(name: 'id', type: 'Ulid!')] + public function getChatMessage(Ulid $id): ?ChatMessage + { + + return $this->queryBus->query(new FindChatMessageById($id)); + } + + + + #[Query(name: 'get_chat_message_list')] + #[Arg( + name: 'channelId', + type: 'Ulid!' + )] + #[ + Arg( + name: 'subjectId', + type: 'Ulid' + ) + ] + #[Arg( + name: 'filter', + type: 'String' + )] + #[Arg( + name: 'first', + type: 'Int' + )] + #[Arg( + name: 'after', + type: 'String' + )] + public function getChatMessageList( + Ulid $channelId, + ?Ulid $subjectId = null, + ?string $filter = null, + ?int $first = null, + ?string $after = null, + ): ChatMessageConnection { + + + $participant = $this->getoptionalParticipantByChannelId($channelId); + $participantId = $participant?->getId(); + + $cb = new ConnectionBuilder( + null, + fn ($edges, PageInfoInterface $pageInfo) => new ChatMessageConnection($edges, $pageInfo), + fn (string $coursor, ChatMessage $brand, int $index) => new ChatMessageEdge($coursor, $brand) + ); + + $total = fn () => $this->queryBus->query( + (new CountChatMessage($filter)) + ->setChannelId($channelId) + ->setSubjectId($subjectId) + ->setActiveParticipantId($participantId) + ); + + $paginator = new Paginator(function (?int $offset, ?int $limit) use ($filter, $channelId, $subjectId, $participantId) { + + $query = (new SearchChatMessage( + filter: $filter, + offset: $offset, + limit: $limit, + + ) + ) + ->setChannelId($channelId) + ->setSubjectId($subjectId) + ->setActiveParticipantId($participantId); + + return $this->queryBus->query($query); + }, false, $cb); + + + return $paginator->auto(new Argument(['first' => $first, 'after' => $after]), $total); + } + + + + private function getoptionalParticipantByChannelId(Ulid $channelId): ?ChatParticipant + { + try { + return $this->chatContextResolver->resolveCurrentChatParticipantForChannelId($channelId); + } catch (\Exception $e) { + return null; + } + } +} diff --git a/src/GraphQL/Chat/Resolver/ChatParticipantMutationResolver.php b/src/GraphQL/Chat/Resolver/ChatParticipantMutationResolver.php new file mode 100644 index 0000000..113073d --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatParticipantMutationResolver.php @@ -0,0 +1,102 @@ +getParticipantByChannelId($input->channelId); + $command = new CreateChatMessage(); + $command + ->setChannelId($input->channelId) + ->setSubjectId($input->subjectId) + ->setParticipantId($participant->getId()) + ->setBody($input->body); + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg( + name: 'clientId', + type: 'Ulid!' + )] + #[Arg( + name: 'input', + type: 'ChatMessageUpdateInput!' + )] + #[Arg( + name: 'clientMutationId', + type: 'String' + )] + public function updateChatMessage(Ulid $id, ChatMessageUpdateInput $input, ?string $clientMutationId = null): CQRSEntryUpdateCommandResult + { + + // if( $input->code && $this->queryBus->query(new CountChatMessage(filter: ['code' => $input->code])) > 0){ + // throw new UserError("ChatMessage ChatMessage With [code:{$input->code}] already exists"); + // } + + $participant = $this->getParticipantByChannelId($input->channelId); + $command = new UpdateChatMessage($id); + $command + ->setChannelId($input->channelId) + ->setSubjectId($input->subjectId) + ->setParticipantId($participant->getId()) + ->setBody($input->body); + return $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + } + + + #[Mutation()] + #[Arg( + name: 'clientId', + type: 'Ulid!' + )] + #[Arg( + name: 'clientMutationId', + type: 'String' + )] + public function deleteChatMessage(Ulid $id, ?string $clientMutationId = null): ?bool + { + $command = new DeleteChatMessage($id); + $this->commandBus->getMutationContext($clientMutationId)->dispatch($command); + return null; + } + + + + + public function getParticipantByChannelId(Ulid $id): ChatParticipant + { + return $this->chatContextResolver->resolveCurrentChatParticipantForChannelId($id); + } +} diff --git a/src/GraphQL/Chat/Resolver/ChatParticipantQueryResolver.php b/src/GraphQL/Chat/Resolver/ChatParticipantQueryResolver.php new file mode 100644 index 0000000..1654860 --- /dev/null +++ b/src/GraphQL/Chat/Resolver/ChatParticipantQueryResolver.php @@ -0,0 +1,93 @@ +queryBus->query(new FindParticipantById($id)); + } + + + + #[Query(name: 'get_chat_participant_list')] + #[Arg( + name: 'channelId', + type: 'Ulid!' + )] + #[Arg( + name: 'filter', + type: 'String' + )] + #[Arg( + name: 'first', + type: 'Int' + )] + #[Arg( + name: 'after', + type: 'String' + )] + public function getChatParticipantList( + Ulid $channelId, + ?string $filter = null, + ?int $first = null, + ?string $after = null, + ): ChatParticipantConnection { + + $cb = new ConnectionBuilder( + null, + fn ($edges, PageInfoInterface $pageInfo) => new ChatParticipantConnection($edges, $pageInfo), + fn (string $coursor, ChatParticipant $brand, int $index) => new ChatParticipantEdge($coursor, $brand) + ); + + $total = fn () => $this->queryBus->query((new CountParticipant($filter))->setChannelId($channelId)); + $paginator = new Paginator(function (?int $offset, ?int $limit) use ($filter, $channelId) { + + $query = (new SearchParticipant( + filter: $filter, + offset: $offset, + limit: $limit, + + ))->setChannelId($channelId); + + return $this->queryBus->query($query); + }, false, $cb); + + + return $paginator->auto(new Argument(['first' => $first, 'after' => $after]), $total); + } +} diff --git a/src/GraphQL/Chat/Type/ChatChannelConnection.php b/src/GraphQL/Chat/Type/ChatChannelConnection.php new file mode 100644 index 0000000..665c0d2 --- /dev/null +++ b/src/GraphQL/Chat/Type/ChatChannelConnection.php @@ -0,0 +1,12 @@ +shipmentOrderRepository->createQueryBuilder('_order'); - + $qb ->innerJoin('_order.driver', 'driver') ->andWhere("driver.id = :driver") @@ -118,7 +129,7 @@ public function getShipmentOrderConnection( - + #[GQL\Mutation()] #[GQL\Arg(name: 'id', type: 'Ulid!')] @@ -128,7 +139,7 @@ public function startShipmentOrder(Ulid $id): ShipmentOrder $order = $this->getDriverShipmentOrder($id); $shipment = $order->getShipment(); - + if (($status = $order->getExecution()) != null) { throw new UserError(sprintf("This shipment order execution is already \"%s\"", $status->getStatus()->value)); } @@ -143,13 +154,11 @@ public function startShipmentOrder(Ulid $id): ShipmentOrder $execution ->setCode($code) ->setVehicle($order->getVehicle()) - ->setDriver($driver) - ; + ->setDriver($driver); $execution ->addOrder($order) - ->setStatus(ShipmentExecutionStatus::PROCESSING) - ; + ->setStatus(ShipmentExecutionStatus::PROCESSING); $order->setStatus(ShipmentOrderStatus::PROCESSING); $this->entityManager->persist($execution); @@ -159,7 +168,150 @@ public function startShipmentOrder(Ulid $id): ShipmentOrder } - + + #[GQL\Mutation()] + #[GQL\Arg(name: 'id', type: 'Ulid!')] + #[GQL\Arg(name: 'input', type: 'ShipmentOrderEstimatedNodeArrivalInput!')] + public function updateShipmentOrderEstimatedPickup(Ulid $id, ShipmentOrderEstimatedNodeArrivalInput $input): ShipmentOrder + { + $order = $this->getDriverShipmentOrder($id); + + if (($status = $order->getExecution()) == null) { + throw new UserError(sprintf("This shipment order execution is not started yet")); + } + + $order + ->setExpectedPickupAt($input->datetime); + $this->entityManager->persist($order); + $this->entityManager->flush(); + + return $order; + } + + + + #[GQL\Mutation()] + #[GQL\Arg(name: 'id', type: 'Ulid!')] + #[GQL\Arg(name: 'input', type: 'ShipmentOrderEstimatedNodeArrivalInput!')] + public function updateShipmentOrderEstimatedDelivery(Ulid $id, ShipmentOrderEstimatedNodeArrivalInput $input): ShipmentOrder + { + $order = $this->getDriverShipmentOrder($id); + + if (($status = $order->getExecution()) == null) { + throw new UserError(sprintf("This shipment order execution is not started yet")); + } + + $order + ->setExpectedDeliveryAt($input->datetime); + $this->entityManager->persist($order); + $this->entityManager->flush(); + + return $order; + } + + + + #[GQL\Mutation()] + #[GQL\Arg(name: 'id', type: 'Ulid!')] + #[GQL\Arg(name: 'input', type: 'ShipmentOrderNodeExecutionInput!')] + public function executeShipmentOrderPickup(Ulid $id, ShipmentOrderNodeExecutionInput $input): ShipmentOrder + { + $order = $this->getDriverShipmentOrder($id); + $shipment = $order->getShipment(); + + if (($status = $order->getExecution()) == null) { + throw new UserError(sprintf("This shipment order execution is not started yet")); + } + + if (($status = $order->getStatus()) != ShipmentOrderStatus::PROCESSING) { + throw new UserError(sprintf("This shipment order is not in \"%s\" state yet. Currently \"\%s\"", ShipmentOrderStatus::PROCESSING->name, $status->name)); + } + + $document = $this->handleDocument( + shipment: $shipment, + input: $input->document, + ); + $order->setPickupConfirmation($document); + $order->setStatus(ShipmentOrderStatus::INTRANSIT); + $shipment->setStatus(ShipmentStatus::INTRANSIT); + + $this->entityManager->persist($shipment); + $this->entityManager->flush(); + + return $order; + } + + + + #[GQL\Mutation()] + #[GQL\Arg(name: 'id', type: 'Ulid!')] + #[GQL\Arg(name: 'input', type: 'ShipmentOrderNodeExecutionInput!')] + public function executeShipmentOrderDelivery(Ulid $id, ShipmentOrderNodeExecutionInput $input): ShipmentOrder + { + $order = $this->getDriverShipmentOrder($id); + $shipment = $order->getShipment(); + + if (($status = $order->getExecution()) == null) { + throw new UserError(sprintf("This shipment order execution is not started yet")); + } + + if (($status = $order->getStatus()) != ShipmentOrderStatus::INTRANSIT) { + throw new UserError(sprintf("This shipment order is not in \"%s\" state yet. Currently \"\%s\"", ShipmentOrderStatus::INTRANSIT->name, $status->name)); + } + + $document = $this->handleDocument( + shipment: $shipment, + input: $input->document, + ); + $order->setProofOfDelivery($document); + $order->setStatus(ShipmentOrderStatus::DELIVERED); + $shipment->setStatus(ShipmentStatus::INTRANSIT); + + $this->entityManager->persist($order); + $this->entityManager->flush(); + + return $order; + } + + + + private function handleDocument(Shipment $shipment, ShipmentOrderDocumentInput $input): ShipmentDocument + { + + $document = new ShipmentDocument(); + $document + ->setType($input->type) + ->setMeta($input->meta); + foreach ($input->attachments as $aInput) { + $attachment = $this->handleDocumentAttachment(shipment: $shipment, input: $aInput); + $document->addAttachment($attachment); + } + return $document; + } + + + + private function handleDocumentAttachment(Shipment $shipment, ShipmentOrderAttachmentInput $input): ShipmentDocumentAttachment + { + $uri = $this->handleFileUpload(shipment: $shipment, file: $input->src); + $attachment = new ShipmentDocumentAttachment(); + $attachment + ->setType($input->type) + ->setSrc($uri) + ->setCaption($input->caption) + ->setMeta($input->meta); + return $attachment; + } + + + private function handleFileUpload(Shipment $shipment, UploadedFile $file) + { + $path = sprintf('shipment/%s/documents/attachments', $shipment->getCode()); + $uri = $this->uploader->upload($file, $path); + return $uri; + } + + private function getDriverShipmentOrder(Ulid $id): ShipmentOrder { $order = $this->shipmentOrderRepository->find($id); @@ -189,9 +341,10 @@ private function getDriver() } - private function getShipmentOrderById(Ulid $id): ShipmentOrder{ + private function getShipmentOrderById(Ulid $id): ShipmentOrder + { $shipment = $this->shipmentOrderRepository->find($id); - if(null == $shipment){ + if (null == $shipment) { throw new UserError("Cannot find shipment with [id: {$id}]"); } return $shipment; diff --git a/src/Message/Chat/Channel/ChannelMutationCommand.php b/src/Message/Chat/Channel/ChannelMutationCommand.php new file mode 100644 index 0000000..89b0f63 --- /dev/null +++ b/src/Message/Chat/Channel/ChannelMutationCommand.php @@ -0,0 +1,131 @@ +userId; + } + + public function setUserId(?Ulid $userId): static{ + $this->userId = $userId; + return $this; + } + + public function getCode(): ?string{ + return $this->code; + } + + public function setCode(?string $code): static{ + $this->code = $code; + return $this; + } + + + public function getName(): ?string{ + return $this->name; + } + + public function setName(?string $name): static{ + $this->name = $name; + return $this; + } + + + + public function getEmailAddress(): ?string + { + return $this->emailAddress; + } + + public function setEmailAddress(?string $emailAddress): self + { + $this->emailAddress = $emailAddress; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phoneNumber; + } + + public function setPhoneNumber(?string $phoneNumber): self + { + $this->phoneNumber = $phoneNumber; + + return $this; + } + + + + public function getNote(): ?string + { + return $this->note; + } + + public function setNote(?string $note): self + { + $this->note = $note; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): self + { + $this->description = $description; + + return $this; + } + + public function getAddress(): ?Address + { + return $this->address; + } + + public function setAddress(?Address $address): self + { + $this->address = $address; + + return $this; + } + + +} diff --git a/src/Message/Chat/Channel/CountChannel.php b/src/Message/Chat/Channel/CountChannel.php new file mode 100644 index 0000000..b1fac4f --- /dev/null +++ b/src/Message/Chat/Channel/CountChannel.php @@ -0,0 +1,9 @@ +setUid($channel->getId()); + else + $this->setUid($channel); + } + + } +} diff --git a/src/Message/Chat/Channel/FindChannelById.php b/src/Message/Chat/Channel/FindChannelById.php new file mode 100644 index 0000000..20fdb24 --- /dev/null +++ b/src/Message/Chat/Channel/FindChannelById.php @@ -0,0 +1,16 @@ +id; + } +} \ No newline at end of file diff --git a/src/Message/Chat/Channel/SearchChannel.php b/src/Message/Chat/Channel/SearchChannel.php new file mode 100644 index 0000000..3109ba2 --- /dev/null +++ b/src/Message/Chat/Channel/SearchChannel.php @@ -0,0 +1,9 @@ +setUid($channel->getId()); + else + $this->setUid($channel); + } + + } +} diff --git a/src/Message/Chat/Composition/ActiveParticipantAwareMessageInterface.php b/src/Message/Chat/Composition/ActiveParticipantAwareMessageInterface.php new file mode 100644 index 0000000..56b2142 --- /dev/null +++ b/src/Message/Chat/Composition/ActiveParticipantAwareMessageInterface.php @@ -0,0 +1,10 @@ +activeParticipantId; + } + + public function setActiveParticipantId(?Ulid $activeParticipantId): static{ + $this->activeParticipantId = $activeParticipantId; + return $this; + } + +} \ No newline at end of file diff --git a/src/Message/Chat/Composition/ActiveUserAwareMessageInterface.php b/src/Message/Chat/Composition/ActiveUserAwareMessageInterface.php new file mode 100644 index 0000000..98bbd72 --- /dev/null +++ b/src/Message/Chat/Composition/ActiveUserAwareMessageInterface.php @@ -0,0 +1,10 @@ +activeUserId; + } + + public function setActiveUserId(?Ulid $activeUserId): static{ + $this->activeUserId = $activeUserId; + return $this; + } + +} \ No newline at end of file diff --git a/src/Message/Chat/Composition/ChannelAwareMessageInterface.php b/src/Message/Chat/Composition/ChannelAwareMessageInterface.php new file mode 100644 index 0000000..47573ea --- /dev/null +++ b/src/Message/Chat/Composition/ChannelAwareMessageInterface.php @@ -0,0 +1,10 @@ +channelId; + } + + public function setChannelId(?Ulid $channelId): static{ + $this->channelId = $channelId; + return $this; + } + +} \ No newline at end of file diff --git a/src/Message/Chat/Composition/ParticipantAwareMessageInterface.php b/src/Message/Chat/Composition/ParticipantAwareMessageInterface.php new file mode 100644 index 0000000..1d4198a --- /dev/null +++ b/src/Message/Chat/Composition/ParticipantAwareMessageInterface.php @@ -0,0 +1,10 @@ +participantId; + } + + public function setParticipantId(?Ulid $participantId): static{ + $this->participantId = $participantId; + return $this; + } + +} \ No newline at end of file diff --git a/src/Message/Chat/Composition/SubjectAwareMessageInterface.php b/src/Message/Chat/Composition/SubjectAwareMessageInterface.php new file mode 100644 index 0000000..b3f6e26 --- /dev/null +++ b/src/Message/Chat/Composition/SubjectAwareMessageInterface.php @@ -0,0 +1,10 @@ +subjectId; + } + + public function setSubjectId(?Ulid $subjectId): static{ + $this->subjectId = $subjectId; + return $this; + } + +} \ No newline at end of file diff --git a/src/Message/Chat/Message/ChatMessageMutationCommand.php b/src/Message/Chat/Message/ChatMessageMutationCommand.php new file mode 100644 index 0000000..1c11fdb --- /dev/null +++ b/src/Message/Chat/Message/ChatMessageMutationCommand.php @@ -0,0 +1,60 @@ +title; + } + + public function setTitle(?string $title): self + { + $this->title = $title; + + return $this; + } + + public function getBody(): ?string + { + return $this->body; + } + + public function setBody(string $body): self + { + $this->body = $body; + + return $this; + } + + +} diff --git a/src/Message/Chat/Message/CountChatMessage.php b/src/Message/Chat/Message/CountChatMessage.php new file mode 100644 index 0000000..a3b3f73 --- /dev/null +++ b/src/Message/Chat/Message/CountChatMessage.php @@ -0,0 +1,18 @@ +setUid($message->getId()); + else + $this->setUid($message); + } + + } +} diff --git a/src/Message/Chat/Message/FindChatMessageById.php b/src/Message/Chat/Message/FindChatMessageById.php new file mode 100644 index 0000000..8718899 --- /dev/null +++ b/src/Message/Chat/Message/FindChatMessageById.php @@ -0,0 +1,16 @@ +id; + } +} \ No newline at end of file diff --git a/src/Message/Chat/Message/SearchChatMessage.php b/src/Message/Chat/Message/SearchChatMessage.php new file mode 100644 index 0000000..36885f6 --- /dev/null +++ b/src/Message/Chat/Message/SearchChatMessage.php @@ -0,0 +1,18 @@ +setUid($message->getId()); + else + $this->setUid($message); + } + + } +} diff --git a/src/Message/Chat/Participant/CountParticipant.php b/src/Message/Chat/Participant/CountParticipant.php new file mode 100644 index 0000000..63c4b2d --- /dev/null +++ b/src/Message/Chat/Participant/CountParticipant.php @@ -0,0 +1,9 @@ +setUid($participant->getId()); + else + $this->setUid($participant); + } + + } +} diff --git a/src/Message/Chat/Participant/FindParticipantById.php b/src/Message/Chat/Participant/FindParticipantById.php new file mode 100644 index 0000000..d8394b8 --- /dev/null +++ b/src/Message/Chat/Participant/FindParticipantById.php @@ -0,0 +1,16 @@ +id; + } +} \ No newline at end of file diff --git a/src/Message/Chat/Participant/ParticipantMutationCommand.php b/src/Message/Chat/Participant/ParticipantMutationCommand.php new file mode 100644 index 0000000..fc10dac --- /dev/null +++ b/src/Message/Chat/Participant/ParticipantMutationCommand.php @@ -0,0 +1,134 @@ +userId; + } + + public function setUserId(?Ulid $userId): static{ + $this->userId = $userId; + return $this; + } + + public function getCode(): ?string{ + return $this->code; + } + + public function setCode(?string $code): static{ + $this->code = $code; + return $this; + } + + + public function getName(): ?string{ + return $this->name; + } + + public function setName(?string $name): static{ + $this->name = $name; + return $this; + } + + + + public function getEmailAddress(): ?string + { + return $this->emailAddress; + } + + public function setEmailAddress(?string $emailAddress): self + { + $this->emailAddress = $emailAddress; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phoneNumber; + } + + public function setPhoneNumber(?string $phoneNumber): self + { + $this->phoneNumber = $phoneNumber; + + return $this; + } + + + + public function getNote(): ?string + { + return $this->note; + } + + public function setNote(?string $note): self + { + $this->note = $note; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): self + { + $this->description = $description; + + return $this; + } + + public function getAddress(): ?Address + { + return $this->address; + } + + public function setAddress(?Address $address): self + { + $this->address = $address; + + return $this; + } + + +} diff --git a/src/Message/Chat/Participant/SearchParticipant.php b/src/Message/Chat/Participant/SearchParticipant.php new file mode 100644 index 0000000..ec79af6 --- /dev/null +++ b/src/Message/Chat/Participant/SearchParticipant.php @@ -0,0 +1,9 @@ +setUid($participant->getId()); + else + $this->setUid($participant); + } + + } +} diff --git a/src/Message/Chat/Role/CountRole.php b/src/Message/Chat/Role/CountRole.php new file mode 100644 index 0000000..561e00b --- /dev/null +++ b/src/Message/Chat/Role/CountRole.php @@ -0,0 +1,9 @@ +setUid($role->getId()); + else + $this->setUid($role); + } + + } +} diff --git a/src/Message/Chat/Role/FindRoleById.php b/src/Message/Chat/Role/FindRoleById.php new file mode 100644 index 0000000..4597b67 --- /dev/null +++ b/src/Message/Chat/Role/FindRoleById.php @@ -0,0 +1,16 @@ +id; + } +} \ No newline at end of file diff --git a/src/Message/Chat/Role/RoleMutationCommand.php b/src/Message/Chat/Role/RoleMutationCommand.php new file mode 100644 index 0000000..e14730b --- /dev/null +++ b/src/Message/Chat/Role/RoleMutationCommand.php @@ -0,0 +1,134 @@ +userId; + } + + public function setUserId(?Ulid $userId): static{ + $this->userId = $userId; + return $this; + } + + public function getCode(): ?string{ + return $this->code; + } + + public function setCode(?string $code): static{ + $this->code = $code; + return $this; + } + + + public function getName(): ?string{ + return $this->name; + } + + public function setName(?string $name): static{ + $this->name = $name; + return $this; + } + + + + public function getEmailAddress(): ?string + { + return $this->emailAddress; + } + + public function setEmailAddress(?string $emailAddress): self + { + $this->emailAddress = $emailAddress; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phoneNumber; + } + + public function setPhoneNumber(?string $phoneNumber): self + { + $this->phoneNumber = $phoneNumber; + + return $this; + } + + + + public function getNote(): ?string + { + return $this->note; + } + + public function setNote(?string $note): self + { + $this->note = $note; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): self + { + $this->description = $description; + + return $this; + } + + public function getAddress(): ?Address + { + return $this->address; + } + + public function setAddress(?Address $address): self + { + $this->address = $address; + + return $this; + } + + +} diff --git a/src/Message/Chat/Role/SearchRole.php b/src/Message/Chat/Role/SearchRole.php new file mode 100644 index 0000000..f3280e9 --- /dev/null +++ b/src/Message/Chat/Role/SearchRole.php @@ -0,0 +1,9 @@ +setUid($role->getId()); + else + $this->setUid($role); + } + + } +} diff --git a/src/Message/Chat/Subject/CountSubject.php b/src/Message/Chat/Subject/CountSubject.php new file mode 100644 index 0000000..5004e02 --- /dev/null +++ b/src/Message/Chat/Subject/CountSubject.php @@ -0,0 +1,9 @@ +setUid($subject->getId()); + else + $this->setUid($subject); + } + + } +} diff --git a/src/Message/Chat/Subject/FindSubjectById.php b/src/Message/Chat/Subject/FindSubjectById.php new file mode 100644 index 0000000..06d144c --- /dev/null +++ b/src/Message/Chat/Subject/FindSubjectById.php @@ -0,0 +1,16 @@ +id; + } +} \ No newline at end of file diff --git a/src/Message/Chat/Subject/SearchSubject.php b/src/Message/Chat/Subject/SearchSubject.php new file mode 100644 index 0000000..0c2f292 --- /dev/null +++ b/src/Message/Chat/Subject/SearchSubject.php @@ -0,0 +1,9 @@ +userId; + } + + public function setUserId(?Ulid $userId): static{ + $this->userId = $userId; + return $this; + } + + public function getCode(): ?string{ + return $this->code; + } + + public function setCode(?string $code): static{ + $this->code = $code; + return $this; + } + + + public function getName(): ?string{ + return $this->name; + } + + public function setName(?string $name): static{ + $this->name = $name; + return $this; + } + + + + public function getEmailAddress(): ?string + { + return $this->emailAddress; + } + + public function setEmailAddress(?string $emailAddress): self + { + $this->emailAddress = $emailAddress; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phoneNumber; + } + + public function setPhoneNumber(?string $phoneNumber): self + { + $this->phoneNumber = $phoneNumber; + + return $this; + } + + + + public function getNote(): ?string + { + return $this->note; + } + + public function setNote(?string $note): self + { + $this->note = $note; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): self + { + $this->description = $description; + + return $this; + } + + public function getAddress(): ?Address + { + return $this->address; + } + + public function setAddress(?Address $address): self + { + $this->address = $address; + + return $this; + } + + +} diff --git a/src/Message/Chat/Subject/UpdateSubject.php b/src/Message/Chat/Subject/UpdateSubject.php new file mode 100644 index 0000000..8d01547 --- /dev/null +++ b/src/Message/Chat/Subject/UpdateSubject.php @@ -0,0 +1,23 @@ +setUid($subject->getId()); + else + $this->setUid($subject); + } + + } +} diff --git a/src/MessageHandler/Chat/ChatChannelMutationHandler.php b/src/MessageHandler/Chat/ChatChannelMutationHandler.php new file mode 100644 index 0000000..8b80dab --- /dev/null +++ b/src/MessageHandler/Chat/ChatChannelMutationHandler.php @@ -0,0 +1,87 @@ +getUid()); + + $channel + // ->setReference($command->get()) + ; + + $this->chatChannelRepository->save($channel, true); + } + + + + // #[AsMessageHandler] + // public function updateChatChannel(UpdateChatChannel $command) + // { + + // $message = $this->repository->find($command->getUid()); + + // if (null === $message) { + + // throw new \LogicException('Cannot find the ChatChannel with the specified id'); + + // // return; + // } + + // $message + // ->setCode($command->getCode()) + // ->setName($command->getName()) + // ->setAddress($command->getAddress()) + // ->setEmailAddress($command->getEmailAddress()) + // ->setPhoneNumber($command->getPhoneNumber()) + // ->setNote($command->getNote()) + // ->setDescription($command->getDescription()) + // ; + + // if($userId = $command->getUserId()){ + + // $user = $this->queryBus->query(new FindUserById($userId)); + // if (!($user instanceof User)) + // throw new \InvalidArgumentException("Could not find user with [id:{$userId}]"); + + // $message + // ->setUser($user) + // ->setUserId($user->getId()); + // } + + // $this->repository->save($message, true); + // } + + + #[AsMessageHandler] + public function deleteChatChannel(DeleteChannel $command) + { + $message = $this->repository->find($command->getUid()); + if (null === $message) { + return; + } + $this->repository->remove($message, true); + + } + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatChannelQueryHandler.php b/src/MessageHandler/Chat/ChatChannelQueryHandler.php new file mode 100644 index 0000000..439ff88 --- /dev/null +++ b/src/MessageHandler/Chat/ChatChannelQueryHandler.php @@ -0,0 +1,91 @@ +repository->find($query->getId()); + } + + + #[AsMessageHandler] + public function search(SearchChannel $search): array + { + + $qb = $this->repository->createQueryBuilder('chat_channel'); + + $this->applyFilters($qb, $search); + + return $qb + ->setFirstResult($search->getOffset()) + ->setMaxResults($search->getLimit()) + ->getQuery() + ->getResult(); + } + + + #[AsMessageHandler] + public function count(CountChannel $search): int + { + + $qb = $this->repository->createQueryBuilder('chat_channel'); + $this->applyFilters($qb, $search); + return (int) $qb->select('COUNT(chat_channel.id)')->getQuery()->getSingleScalarResult(); + } + + + + + + private function applyFilters(QueryBuilder $qb, CountChannel|SearchChannel $search): void + { + + + if ($activeUserId = $search->getActiveUserId()) { + $qb + // ->leftJoin('chat_channel.participants', 'participant') + // ->join(ChatUserParticipant::class, 'user_participant', 'user_participant.id = participant.id') + // ->andWhere('user_participant.userId = :activeUserId') + ->andWhere( + $qb->expr()->exists( + $qb->getEntityManager()->createQueryBuilder() + ->select('user_participant') + ->from(ChatUserParticipant::class, 'user_participant') + ->where('user_participant.channel = chat_channel') + ->andWhere('user_participant.userId = :activeUserId') + // ->andWhere('p.publishedAt >= :oneWeekAgo') + ) + ) + ->setParameter('activeUserId', $activeUserId, UlidType::NAME) + ; + + } + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_channel'); + QueryBuilderUtil::enableQueryCache($qb); + } + + + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatMessageMutationHandler.php b/src/MessageHandler/Chat/ChatMessageMutationHandler.php new file mode 100644 index 0000000..c1a2b54 --- /dev/null +++ b/src/MessageHandler/Chat/ChatMessageMutationHandler.php @@ -0,0 +1,126 @@ +getUid()); + + $message + ->setBody($command->getBody()) + ; + + + $channel = $participant = $subject = null; + + if ($channelId = $command->getChannelId()) { + $channel = $this->queryBus->query(new FindChannelById($channelId)); + if (!($channel instanceof ChatChannel)) + throw new \InvalidArgumentException("Could not find channel with [id:{$channelId}]"); + $channel->addMessage($message); + } + + if ($participantId = $command->getParticipantId()) { + + $participant = $this->queryBus->query(new FindParticipantById($participantId)); + if (!($participant instanceof ChatParticipant)) + throw new \InvalidArgumentException("Could not find participant with [id:{$participantId}]"); + $message->setParticipant($participant); + } + + if ($subjectId = $command->getSubjectId()) { + $subject = $this->queryBus->query(new FindSubjectById($subjectId)); + if (!($subject instanceof ChatSubject)) + throw new \InvalidArgumentException("Could not find subject with [id:{$subjectId}]"); + $message->setSubject($subject); + $subject->addMessage($message); + } + + + if (null === $channel) + throw new UnrecoverableMessageHandlingException("Could not find Channel with [id:{$channelId}]"); + + + $this->chatChannelRepository->save($channel, true); + } + + + + // #[AsMessageHandler] + // public function updateChatMessage(UpdateChatMessage $command) + // { + + // $message = $this->repository->find($command->getUid()); + + // if (null === $message) { + + // throw new \LogicException('Cannot find the ChatMessage with the specified id'); + + // // return; + // } + + // $message + // ->setCode($command->getCode()) + // ->setName($command->getName()) + // ->setAddress($command->getAddress()) + // ->setEmailAddress($command->getEmailAddress()) + // ->setPhoneNumber($command->getPhoneNumber()) + // ->setNote($command->getNote()) + // ->setDescription($command->getDescription()) + // ; + + // if($userId = $command->getUserId()){ + + // $user = $this->queryBus->query(new FindUserById($userId)); + // if (!($user instanceof User)) + // throw new \InvalidArgumentException("Could not find user with [id:{$userId}]"); + + // $message + // ->setUser($user) + // ->setUserId($user->getId()); + // } + + // $this->repository->save($message, true); + // } + + + #[AsMessageHandler] + public function deleteChatMessage(DeleteChatMessage $command) + { + $message = $this->repository->find($command->getUid()); + if (null === $message) { + return; + } + $this->repository->remove($message, true); + + } + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatMessageQueryHandler.php b/src/MessageHandler/Chat/ChatMessageQueryHandler.php new file mode 100644 index 0000000..61ab69c --- /dev/null +++ b/src/MessageHandler/Chat/ChatMessageQueryHandler.php @@ -0,0 +1,87 @@ +repository->find($query->getId()); + } + + + #[AsMessageHandler] + public function search(SearchChatMessage $search): array{ + + $qb = $this->repository->createQueryBuilder('chat_message'); + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_message'); + QueryBuilderUtil::enableQueryCache($qb); + + if($channelId = $search->getChannelId()){ + $qb->andWhere('chat_message.channel = :channelId') + ->setParameter('channelId',$channelId,UlidType::NAME); + } + + if($subjectId = $search->getSubjectId()){ + $qb->andWhere('chat_message.subject = :subjectId') + ->setParameter('subjectId',$subjectId,UlidType::NAME); + } + + if($activeParticipantId = $search->getActiveParticipantId()){ + //TODO: ENSURE THAT ONLY MESSAGES READABLE BY THIS PARTICIPANT IS ALLOWED + } + + + + return $qb + ->setFirstResult($search->getOffset()) + ->setMaxResults($search->getLimit()) + ->getQuery() + ->getResult(); + } + + + #[AsMessageHandler] + public function count(CountChatMessage $search): int{ + + $qb = $this->repository->createQueryBuilder('chat_message'); + + if($channelId = $search->getChannelId()){ + $qb->andWhere('chat_message.channel = :channelId') + ->setParameter('channelId',$channelId,UlidType::NAME); + } + + + if($subjectId = $search->getSubjectId()){ + $qb->andWhere('chat_message.subject = :subjectId') + ->setParameter('subjectId',$subjectId,UlidType::NAME); + } + + if($activeParticipantId = $search->getActiveParticipantId()){ + //TODO: ENSURE THAT ONLY MESSAGES READABLE BY THIS PARTICIPANT IS ALLOWED + } + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_message'); + + return (int) $qb->select('COUNT(chat_message.id)')->getQuery()->getSingleScalarResult(); + } + + + + + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatParticipantMutationHandler.php b/src/MessageHandler/Chat/ChatParticipantMutationHandler.php new file mode 100644 index 0000000..85ac0b9 --- /dev/null +++ b/src/MessageHandler/Chat/ChatParticipantMutationHandler.php @@ -0,0 +1,50 @@ +getUid()); + + // $channel + // // ->setReference($command->get()) + // ; + + // $this->chatParticipantRepository->save($channel, true); + } + + + + + #[AsMessageHandler] + public function deleteChatParticipant(DeleteParticipant $command) + { + $message = $this->repository->find($command->getUid()); + if (null === $message) { + return; + } + $this->repository->remove($message, true); + + } + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatParticipantQueryHandler.php b/src/MessageHandler/Chat/ChatParticipantQueryHandler.php new file mode 100644 index 0000000..550d8e2 --- /dev/null +++ b/src/MessageHandler/Chat/ChatParticipantQueryHandler.php @@ -0,0 +1,67 @@ +repository->find($query->getId()); + } + + + #[AsMessageHandler] + public function search(SearchParticipant $search): array{ + + $qb = $this->repository->createQueryBuilder('chat_participant'); + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_participant'); + QueryBuilderUtil::enableQueryCache($qb); + + if($orderId = $search->getChannelId()){ + $qb->andWhere('chat_participant.channel = :channelId') + ->setParameter('channelId',$orderId,UlidType::NAME); + } + + + return $qb + ->setFirstResult($search->getOffset()) + ->setMaxResults($search->getLimit()) + ->getQuery() + ->getResult(); + } + + + #[AsMessageHandler] + public function count(CountParticipant $search): int{ + + $qb = $this->repository->createQueryBuilder('chat_participant'); + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_participant'); + + if($orderId = $search->getChannelId()){ + $qb->andWhere('chat_participant.channel = :channelId') + ->setParameter('channelId',$orderId,UlidType::NAME); + } + + return (int) $qb->select('COUNT(chat_participant.id)')->getQuery()->getSingleScalarResult(); + } + + + + + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatSubjectMutationHandler.php b/src/MessageHandler/Chat/ChatSubjectMutationHandler.php new file mode 100644 index 0000000..c387d6a --- /dev/null +++ b/src/MessageHandler/Chat/ChatSubjectMutationHandler.php @@ -0,0 +1,50 @@ +getUid()); + + $channel + // ->setReference($command->get()) + ; + + $this->chatSubjectRepository->save($channel, true); + } + + + + + #[AsMessageHandler] + public function deleteChatSubject(DeleteSubject $command) + { + $message = $this->repository->find($command->getUid()); + if (null === $message) { + return; + } + $this->repository->remove($message, true); + + } + +} \ No newline at end of file diff --git a/src/MessageHandler/Chat/ChatSubjectQueryHandler.php b/src/MessageHandler/Chat/ChatSubjectQueryHandler.php new file mode 100644 index 0000000..513f2ea --- /dev/null +++ b/src/MessageHandler/Chat/ChatSubjectQueryHandler.php @@ -0,0 +1,67 @@ +repository->find($query->getId()); + } + + + #[AsMessageHandler] + public function search(SearchSubject $search): array{ + + $qb = $this->repository->createQueryBuilder('chat_subject'); + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_subject'); + QueryBuilderUtil::enableQueryCache($qb); + + if($orderId = $search->getChannelId()){ + $qb->andWhere('chat_subject.channel = :channelId') + ->setParameter('channelId',$orderId,UlidType::NAME); + } + + + return $qb + ->setFirstResult($search->getOffset()) + ->setMaxResults($search->getLimit()) + ->getQuery() + ->getResult(); + } + + + #[AsMessageHandler] + public function count(CountSubject $search): int{ + + $qb = $this->repository->createQueryBuilder('chat_subject'); + + QueryBuilderUtil::applyCriteria($qb, $search->getFilter(), 'chat_subject'); + + if($orderId = $search->getChannelId()){ + $qb->andWhere('chat_subject.channel = :channelId') + ->setParameter('channelId',$orderId,UlidType::NAME); + } + + return (int) $qb->select('COUNT(chat_subject.id)')->getQuery()->getSingleScalarResult(); + } + + + + + +} \ No newline at end of file diff --git a/src/Repository/Chat/ChatBusinessParticipantRepository.php b/src/Repository/Chat/ChatBusinessParticipantRepository.php new file mode 100644 index 0000000..4d146de --- /dev/null +++ b/src/Repository/Chat/ChatBusinessParticipantRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatBusinessParticipant|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatBusinessParticipant|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatBusinessParticipant[] findAll() + * @method ChatBusinessParticipant[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatBusinessParticipantRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatBusinessParticipant::class); + } + + public function save(ChatBusinessParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatBusinessParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatBusinessParticipant[] Returns an array of ChatBusinessParticipant objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatBusinessParticipant +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatChannelRepository.php b/src/Repository/Chat/ChatChannelRepository.php new file mode 100644 index 0000000..950795a --- /dev/null +++ b/src/Repository/Chat/ChatChannelRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatChannel|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatChannel|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatChannel[] findAll() + * @method ChatChannel[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatChannelRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatChannel::class); + } + + public function save(ChatChannel $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatChannel $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatChannel[] Returns an array of ChatChannel objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatChannel +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatChannelRoleRepository.php b/src/Repository/Chat/ChatChannelRoleRepository.php new file mode 100644 index 0000000..dd0c059 --- /dev/null +++ b/src/Repository/Chat/ChatChannelRoleRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatChannelRole|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatChannelRole|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatChannelRole[] findAll() + * @method ChatChannelRole[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatChannelRoleRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatChannelRole::class); + } + + public function save(ChatChannelRole $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatChannelRole $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatChannelRole[] Returns an array of ChatChannelRole objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatChannelRole +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatMessageAttachmentRepository.php b/src/Repository/Chat/ChatMessageAttachmentRepository.php new file mode 100644 index 0000000..3162943 --- /dev/null +++ b/src/Repository/Chat/ChatMessageAttachmentRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatMessageAttachment|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatMessageAttachment|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatMessageAttachment[] findAll() + * @method ChatMessageAttachment[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatMessageAttachmentRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatMessageAttachment::class); + } + + public function save(ChatMessageAttachment $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatMessageAttachment $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatMessageAttachment[] Returns an array of ChatMessageAttachment objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatMessageAttachment +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatMessageRepository.php b/src/Repository/Chat/ChatMessageRepository.php new file mode 100644 index 0000000..1fb7ec3 --- /dev/null +++ b/src/Repository/Chat/ChatMessageRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatMessage|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatMessage|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatMessage[] findAll() + * @method ChatMessage[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatMessageRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatMessage::class); + } + + public function save(ChatMessage $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatMessage $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatMessage[] Returns an array of ChatMessage objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatMessage +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatMessageViewRepository.php b/src/Repository/Chat/ChatMessageViewRepository.php new file mode 100644 index 0000000..a6701f4 --- /dev/null +++ b/src/Repository/Chat/ChatMessageViewRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatMessageView|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatMessageView|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatMessageView[] findAll() + * @method ChatMessageView[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatMessageViewRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatMessageView::class); + } + + public function save(ChatMessageView $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatMessageView $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatMessageView[] Returns an array of ChatMessageView objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatMessageView +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatParticipantRepository.php b/src/Repository/Chat/ChatParticipantRepository.php new file mode 100644 index 0000000..a4fe483 --- /dev/null +++ b/src/Repository/Chat/ChatParticipantRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatParticipant|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatParticipant|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatParticipant[] findAll() + * @method ChatParticipant[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatParticipantRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatParticipant::class); + } + + public function save(ChatParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatParticipant[] Returns an array of ChatParticipant objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatParticipant +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatSubjectRepository.php b/src/Repository/Chat/ChatSubjectRepository.php new file mode 100644 index 0000000..c862077 --- /dev/null +++ b/src/Repository/Chat/ChatSubjectRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatSubject|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatSubject|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatSubject[] findAll() + * @method ChatSubject[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatSubjectRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatSubject::class); + } + + public function save(ChatSubject $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatSubject $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatSubject[] Returns an array of ChatSubject objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatSubject +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/Chat/ChatUserParticipantRepository.php b/src/Repository/Chat/ChatUserParticipantRepository.php new file mode 100644 index 0000000..0086ac4 --- /dev/null +++ b/src/Repository/Chat/ChatUserParticipantRepository.php @@ -0,0 +1,66 @@ + + * + * @method ChatUserParticipant|null find($id, $lockMode = null, $lockVersion = null) + * @method ChatUserParticipant|null findOneBy(array $criteria, array $orderBy = null) + * @method ChatUserParticipant[] findAll() + * @method ChatUserParticipant[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class ChatUserParticipantRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ChatUserParticipant::class); + } + + public function save(ChatUserParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(ChatUserParticipant $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return ChatUserParticipant[] Returns an array of ChatUserParticipant objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('c.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?ChatUserParticipant +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Service/Chat/ChainChatContextResolver.php b/src/Service/Chat/ChainChatContextResolver.php new file mode 100644 index 0000000..fb6575b --- /dev/null +++ b/src/Service/Chat/ChainChatContextResolver.php @@ -0,0 +1,58 @@ + + */ + private iterable $resolvers = []; + + public function __construct( + // the attribute must be applied directly to the argument to autowire + #[TaggedIterator('chat.context.resolver', exclude: [self::class])] + iterable $contextResolvers = [] + + ) { + // $_contextResolvers = new Collection(ChatContextResolverInterface::class,$contextResolvers); + // $this->resolvers = $_contextResolvers + // ->filter(fn(ChatContextResolverInterface $resolver) => $resolver !== $this) + // ->toArray(); + + $this->resolvers = $contextResolvers; + } + public function resolveCurrentChatParticipantForChannelId(Ulid $channelId): ChatParticipant + { + foreach($this->resolvers as $resolver){ + try{ + if($participant = $resolver->resolveCurrentChatParticipantForChannelId($channelId)) + return $participant; + } + catch(ChatChannelParticipanResolutionException $e){ + continue; + } + } + + throw new \BadFunctionCallException("Could not find a matching participant for the current reques"); +; } + + + public function resolveCurrentChatParticipantForChannel(ChatChannel $channel): ChatUserParticipant + { + return $this->resolveCurrentChatParticipantForChannelId($channel->getId()); + } +} \ No newline at end of file diff --git a/src/Service/Chat/ChatContextResolverInterface.php b/src/Service/Chat/ChatContextResolverInterface.php new file mode 100644 index 0000000..4f78f77 --- /dev/null +++ b/src/Service/Chat/ChatContextResolverInterface.php @@ -0,0 +1,15 @@ +getCode()}"; + } + + parent::__construct($message); + } +} \ No newline at end of file diff --git a/src/Service/File/Uploader.php b/src/Service/File/Uploader.php index 7dbe1cb..23325d7 100644 --- a/src/Service/File/Uploader.php +++ b/src/Service/File/Uploader.php @@ -27,8 +27,8 @@ class Uploader implements UploaderInterface public function __construct( ParameterBagInterface $parameters, - AssetExtension $assetsHelper, - HttpFoundationExtension $httpHelper, + // AssetExtension $assetsHelper, + // HttpFoundationExtension $httpHelper, SluggerInterface $slugger, // private Filesystem $filesystem, private FilesystemOperator $defaultStorage, @@ -37,8 +37,8 @@ public function __construct( ) { $this->parameters = $parameters; - $this->assetsHelper = $assetsHelper; - $this->httpHelper = $httpHelper; + // $this->assetsHelper = $assetsHelper; + // $this->httpHelper = $httpHelper; $this->slugger = $slugger;