Skip to content

Commit

Permalink
refactor: organize modules
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoCamargo31 committed Nov 1, 2023
1 parent d13e576 commit 386e783
Show file tree
Hide file tree
Showing 36 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SendEmailWhenProductIsCreatedHandler } from '../product/handler/send-email-when-product-Is-created-handler'
import { ProductCreatedEvent } from '../product/product-created-event'
import { SendEmailWhenProductIsCreatedHandler } from '../../product/event/handler/send-email-when-product-Is-created-handler'
import { ProductCreatedEvent } from '../../product/event/product-created-event'
import { EventDispatcher } from './event-dispatcher'

describe('Domain events tests', () => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Customer } from './customer'
import { Order } from './order'
import { OrderItem } from './order-item'

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RepositoryInterface } from '../../@shared/repository/repository-interface'
import { Order } from '../entity/order'
import { RepositoryInterface } from './repository-interface'

export interface OrderRepositoryInterface extends RepositoryInterface<Order> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Customer } from '../entity/customer'
import { Customer } from '../../customer/entity/customer'
import { Order } from '../entity/order'
import { OrderItem } from '../entity/order-item'
import { OrderService } from './order-service'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Customer } from '../entity/customer'

import { Customer } from '../../customer/entity/customer'
import { Order } from '../entity/order'
import { OrderItem } from '../entity/order-item'
import { v4 as uuid } from 'uuid'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from './address'
import { Address } from '../value-object/address'
import { Customer } from './customer'

describe('Customer unit tests', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address } from './address'
import { Address } from '../value-object/address'

export class Customer {
private readonly _id: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventDispatcher } from '../@shared/event-dispatcher'
import { EventDispatcher } from '../../@shared/event/event-dispatcher'
import { CustomerChangeAddressEvent } from './customer-change-address-event'
import { SendConsoleLogHandler } from './handlers/send-console-log-handler'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventInterface } from '../@shared/event-interface'
import { EventInterface } from '../../@shared/event/event-interface'

export class CustomerChangeAddressEvent implements EventInterface {
readonly dataTimeOccurred: Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventDispatcher } from '../@shared/event-dispatcher'
import { EventDispatcher } from '../../@shared/event/event-dispatcher'
import { CustomerCreatedEvent } from './customer-created-event'
import { SendConsoleLog1Handler } from './handlers/send-console-log1-handler'
import { SendConsoleLog2Handler } from './handlers/send-console-log2-handler'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventInterface } from '../@shared/event-interface'
import { EventInterface } from '../../@shared/event/event-interface'

export class CustomerCreatedEvent implements EventInterface {
readonly dataTimeOccurred: Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventHandlerInterface } from '../../@shared/event-handler-interface'
import { EventInterface } from '../../@shared/event-interface'
import { EventHandlerInterface } from '../../../@shared/event/event-handler-interface'
import { EventInterface } from '../../../@shared/event/event-interface'
import { CustomerChangeAddressEvent } from '../customer-change-address-event'

export class SendConsoleLogHandler implements EventHandlerInterface<CustomerChangeAddressEvent> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventHandlerInterface } from '../../@shared/event-handler-interface'
import { EventInterface } from '../../@shared/event-interface'
import { EventHandlerInterface } from '../../../@shared/event/event-handler-interface'
import { EventInterface } from '../../../@shared/event/event-interface'
import { CustomerCreatedEvent } from '../customer-created-event'

export class SendConsoleLog1Handler implements EventHandlerInterface<CustomerCreatedEvent> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventHandlerInterface } from '../../@shared/event-handler-interface'
import { EventInterface } from '../../@shared/event-interface'
import { EventHandlerInterface } from '../../../@shared/event/event-handler-interface'
import { EventInterface } from '../../../@shared/event/event-interface'
import { CustomerCreatedEvent } from '../customer-created-event'

export class SendConsoleLog2Handler implements EventHandlerInterface<CustomerCreatedEvent> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RepositoryInterface } from '../../@shared/repository/repository-interface'
import { Customer } from '../entity/customer'
import { RepositoryInterface } from './repository-interface'

export interface CustomerRepositoryInterface extends RepositoryInterface<Customer> {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Address } from './address'
import { Customer } from './customer'
import { Product } from './product'

describe('Product unit tests', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventHandlerInterface } from '../../@shared/event-handler-interface'
import { EventInterface } from '../../@shared/event-interface'
import { EventHandlerInterface } from '../../../@shared/event/event-handler-interface'
import { EventInterface } from '../../../@shared/event/event-interface'
import { ProductCreatedEvent } from '../product-created-event'

export class SendEmailWhenProductIsCreatedHandler implements EventHandlerInterface<ProductCreatedEvent> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventInterface } from '../@shared/event-interface'
import { EventInterface } from '../../@shared/event/event-interface'

export class ProductCreatedEvent implements EventInterface {
readonly dataTimeOccurred: Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RepositoryInterface } from '../../@shared/repository/repository-interface'
import { Product } from '../entity/product'
import { RepositoryInterface } from './repository-interface'

export interface ProductRepositoryInterface extends RepositoryInterface<Product> {

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/infrastructure/repository/customer-repository.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Sequelize } from 'sequelize-typescript'
import { CustomerModel } from '../database/sequelize/model/customer-model'
import CustomerRepository from './customer-repository'
import { Customer } from '../../domain/entity/customer'
import { Address } from '../../domain/entity/address'
import { Customer } from '../../domain/customer/entity/customer'
import { Address } from '../../domain/customer/value-object/address'

describe('Customer repository test', () => {
let sequelize: Sequelize
Expand Down
6 changes: 3 additions & 3 deletions src/infrastructure/repository/customer-repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address } from '../../domain/entity/address'
import { Customer } from '../../domain/entity/customer'
import { CustomerRepositoryInterface } from '../../domain/repository/customer-repository.interface'
import { Customer } from '../../domain/customer/entity/customer'
import { CustomerRepositoryInterface } from '../../domain/customer/repository/customer-repository.interface'
import { Address } from '../../domain/customer/value-object/address'
import { CustomerModel } from '../database/sequelize/model/customer-model'

export default class CustomerRepository implements CustomerRepositoryInterface {
Expand Down
10 changes: 5 additions & 5 deletions src/infrastructure/repository/order-repository.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Sequelize } from 'sequelize-typescript'
import { CustomerModel } from '../database/sequelize/model/customer-model'
import CustomerRepository from './customer-repository'
import { Customer } from '../../domain/entity/customer'
import { Address } from '../../domain/entity/address'
import { Customer } from '../../domain/customer/entity/customer'
import { OrderModel } from '../database/sequelize/model/order-model'
import { OrderItemModel } from '../database/sequelize/model/order-item-model'
import { ProductModel } from '../database/sequelize/model/product-model'
import { ProductRepository } from './product-repository'
import { Product } from '../../domain/entity/product'
import { OrderItem } from '../../domain/entity/order-item'
import { Order } from '../../domain/entity/order'
import { OrderItem } from '../../domain/checkout/entity/order-item'
import { Order } from '../../domain/checkout/entity/order'
import OrderRepository from './order-repository'
import { Address } from '../../domain/customer/value-object/address'
import { Product } from '../../domain/product/entity/product'

const makeCustomer = (id: string, name: string): Customer => {
const customer = new Customer(id, name)
Expand Down
6 changes: 3 additions & 3 deletions src/infrastructure/repository/order-repository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Order } from '../../domain/entity/order'
import { OrderItem } from '../../domain/entity/order-item'
import { OrderRepositoryInterface } from '../../domain/repository/order-repository.interface'
import { Order } from '../../domain/checkout/entity/order'
import { OrderItem } from '../../domain/checkout/entity/order-item'
import { OrderRepositoryInterface } from '../../domain/checkout/repository/order-repository.interface'
import { OrderItemModel } from '../database/sequelize/model/order-item-model'
import { OrderModel } from '../database/sequelize/model/order-model'

Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/repository/product-repository.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Sequelize } from 'sequelize-typescript'
import { ProductModel } from '../database/sequelize/model/product-model'
import { Product } from '../../domain/entity/product'
import { ProductRepository } from './product-repository'
import { Product } from '../../domain/product/entity/product'

describe('Product repository test', () => {
let sequelize: Sequelize
Expand Down
4 changes: 2 additions & 2 deletions src/infrastructure/repository/product-repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Product } from '../../domain/entity/product'
import { ProductRepositoryInterface } from '../../domain/repository/product-repository.interface'
import { Product } from '../../domain/product/entity/product'
import { ProductRepositoryInterface } from '../../domain/product/repository/product-repository.interface'
import { ProductModel } from '../database/sequelize/model/product-model'

export class ProductRepository implements ProductRepositoryInterface {
Expand Down

0 comments on commit 386e783

Please sign in to comment.