mirror of
https://gitlab.com/mobicoop/v3/service/configuration.git
synced 2026-03-15 19:05:50 +00:00
switch to redis
This commit is contained in:
@@ -1,4 +1 @@
|
||||
export const CONFIGURATION_MESSAGE_PUBLISHER = Symbol(
|
||||
'CONFIGURATION_MESSAGE_PUBLISHER',
|
||||
);
|
||||
export const CONFIGURATION_REPOSITORY = Symbol('CONFIGURATION_REPOSITORY');
|
||||
|
||||
@@ -5,11 +5,7 @@ import { SetConfigurationGrpcController } from './interface/grpc-controllers/set
|
||||
import { SetConfigurationService } from './core/application/commands/set-configuration/set-configuration.service';
|
||||
import { GetConfigurationQueryHandler } from './core/application/queries/get-configuration/get-configuration.query-handler';
|
||||
import { ConfigurationMapper } from './configuration.mapper';
|
||||
import {
|
||||
CONFIGURATION_MESSAGE_PUBLISHER,
|
||||
CONFIGURATION_REPOSITORY,
|
||||
} from './configuration.di-tokens';
|
||||
import { MessageBrokerPublisher } from '@mobicoop/message-broker-module';
|
||||
import { CONFIGURATION_REPOSITORY } from './configuration.di-tokens';
|
||||
import { PopulateService } from './core/application/services/populate.service';
|
||||
import { ConfigurationRepository } from './infrastructure/configuration.repository';
|
||||
|
||||
@@ -33,13 +29,6 @@ const repositories: Provider[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const messagePublishers: Provider[] = [
|
||||
{
|
||||
provide: CONFIGURATION_MESSAGE_PUBLISHER,
|
||||
useExisting: MessageBrokerPublisher,
|
||||
},
|
||||
];
|
||||
|
||||
@Module({
|
||||
imports: [CqrsModule],
|
||||
controllers: [...grpcControllers],
|
||||
@@ -49,7 +38,6 @@ const messagePublishers: Provider[] = [
|
||||
...mappers,
|
||||
...providers,
|
||||
...repositories,
|
||||
...messagePublishers,
|
||||
],
|
||||
exports: [ConfigurationMapper, CONFIGURATION_REPOSITORY],
|
||||
})
|
||||
|
||||
@@ -3,7 +3,6 @@ import { v4 } from 'uuid';
|
||||
import {
|
||||
ConfigurationProps,
|
||||
CreateConfigurationProps,
|
||||
UpdateConfigurationProps,
|
||||
} from './configuration.types';
|
||||
|
||||
export class ConfigurationEntity extends AggregateRoot<ConfigurationProps> {
|
||||
@@ -16,10 +15,6 @@ export class ConfigurationEntity extends AggregateRoot<ConfigurationProps> {
|
||||
return configuration;
|
||||
};
|
||||
|
||||
update(props: UpdateConfigurationProps): void {
|
||||
this.props.value = props.value;
|
||||
}
|
||||
|
||||
validate(): void {
|
||||
// entity business rules validation to protect it's invariant before saving entity to a database
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@ export interface CreateConfigurationProps {
|
||||
value: ConfigurationValue;
|
||||
}
|
||||
|
||||
export interface UpdateConfigurationProps {
|
||||
value: ConfigurationValue;
|
||||
}
|
||||
|
||||
export enum ConfigurationDomain {
|
||||
CARPOOL = 'CARPOOL',
|
||||
PAGINATION = 'PAGINATION',
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ConfigurationEntity } from '@modules/configuration/core/domain/configur
|
||||
import {
|
||||
CreateConfigurationProps,
|
||||
ConfigurationDomain,
|
||||
UpdateConfigurationProps,
|
||||
} from '@modules/configuration/core/domain/configuration.types';
|
||||
|
||||
const createConfigurationProps: CreateConfigurationProps = {
|
||||
@@ -13,10 +12,6 @@ const createConfigurationProps: CreateConfigurationProps = {
|
||||
value: '3',
|
||||
};
|
||||
|
||||
const updateConfigurationProps: UpdateConfigurationProps = {
|
||||
value: '2',
|
||||
};
|
||||
|
||||
describe('Configuration entity create', () => {
|
||||
it('should create a new configuration entity', async () => {
|
||||
const configurationEntity: ConfigurationEntity = ConfigurationEntity.create(
|
||||
@@ -26,13 +21,3 @@ describe('Configuration entity create', () => {
|
||||
expect(configurationEntity.getProps().value).toBe('3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Configuration entity update', () => {
|
||||
it('should update a configuration entity', async () => {
|
||||
const configurationEntity: ConfigurationEntity = ConfigurationEntity.create(
|
||||
createConfigurationProps,
|
||||
);
|
||||
configurationEntity.update(updateConfigurationProps);
|
||||
expect(configurationEntity.getProps().value).toBe('2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ const mockConfigurationMapper = {
|
||||
toDomain: jest.fn().mockImplementation(
|
||||
() =>
|
||||
new ConfigurationEntity({
|
||||
id: ' 001199d4-7187-4e83-a044-12159cba2e33',
|
||||
id: '001199d4-7187-4e83-a044-12159cba2e33',
|
||||
props: {
|
||||
identifier: {
|
||||
domain: ConfigurationDomain.CARPOOL,
|
||||
|
||||
Reference in New Issue
Block a user