Skip to content

Commit

Permalink
refactor: entity file names
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrunton committed Sep 21, 2024
1 parent 25ba0b7 commit 6cb336b
Show file tree
Hide file tree
Showing 48 changed files with 83 additions and 83 deletions.
2 changes: 1 addition & 1 deletion services/api/src/app/auth/casl.auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthorizeParams, AuthService } from '@usecases/auth.service';
import { MembershipsRepository } from '@entities/memberships.repository';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { ConsoleLogger, Injectable } from '@nestjs/common';
import { defineRolesForUser } from './permissions/roles';

Expand Down
4 changes: 2 additions & 2 deletions services/api/src/app/auth/permissions/roles.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Membership, MembershipStatus } from '@entities/membership.entity';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { Membership, MembershipStatus } from '@entities/memberships/membership';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { RoomFactory } from '@fixtures/messages/room.factory';
import { UserFactory } from '@fixtures/messages/user.factory';
import { defineRolesForUser } from './roles';
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/app/auth/permissions/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
Membership,
MembershipStatus,
getRoomsWithStatus,
} from '@entities/membership.entity';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
} from '@entities/memberships/membership';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { User } from '@entities/users/user';
import { Role } from '@usecases/auth.service';

Expand Down
2 changes: 1 addition & 1 deletion services/api/src/app/dispatcher/dispatcher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
isPrivate,
} from '@entities/messages/message';
import { MessagesRepository } from '@entities/messages/messages-repository';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { ConsoleLogger, Injectable } from '@nestjs/common';
import { AuthService, Role } from '@usecases/auth.service';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/app/messages/command.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command } from '@entities/command.entity';
import { Command } from '@entities/command';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';
import { HelpCommandUseCase } from '@usecases/commands/help';
Expand Down
8 changes: 4 additions & 4 deletions services/api/src/app/messages/messages.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { UsersRepository } from '@entities/users/users-repository';
import { MessagesRepository } from '@entities/messages/messages-repository';
import { TestUsersRepository } from '@data/repositories/test/test.users.repository';
import { TestMessagesRepository } from '@data/repositories/test/test.messages.repository';
import { Room } from '@entities/room.entity';
import { RoomsRepository } from '@entities/rooms.repository';
import { Room } from '@entities/rooms/room';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
import { RoomFactory } from '@fixtures/messages/room.factory';
import { CreateMessageDto } from './dto/messages';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { MembershipsRepository } from '@entities/memberships.repository';
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { MembershipStatus } from '@entities/memberships/membership';
import { MessagesModule } from './messages.module';
import { Auth0Client } from '@app/auth/auth0/auth0.client';
import { MockLoggerModule } from '@fixtures/MockLoggerModule';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/app/messages/messages.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { User } from '@entities/users/user';
import { mock, MockProxy } from 'jest-mock-extended';
import { SendMessageUseCase } from '@usecases/messages/send';
import { CommandService } from './command.service';
import { Command } from '@entities/command.entity';
import { Command } from '@entities/command';
import { UnauthorizedException } from '@nestjs/common';
import { systemUser } from '@entities/users/system-user';

Expand Down
8 changes: 4 additions & 4 deletions services/api/src/app/users/users.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getActiveRooms } from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships.repository';
import { Room } from '@entities/room.entity';
import { RoomsRepository } from '@entities/rooms.repository';
import { getActiveRooms } from '@entities/memberships/membership';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { Room } from '@entities/rooms/room';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { systemUser } from '@entities/users/system-user';
import { User } from '@entities/users/user';
import { UsersRepository } from '@entities/users/users-repository';
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/data/adapters/dynamodb/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MembershipStatus } from '@entities/membership.entity';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { MembershipStatus } from '@entities/memberships/membership';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { Entity } from 'dynamodb-onetable';

export const DbSchema = {
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/data/data.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Global, Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import databaseConfig from '@config/database.config';
import { DynamoDBMessagesRepository } from './repositories/dynamodb/dynamodb.messages.repository';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { DynamoDBUsersRepository } from './repositories/dynamodb/dynamodb.users.repository';
import { DynamoDBAdapter } from './adapters/dynamodb/dynamodb.adapter';
import { DynamoDBRoomsRepository } from './repositories/dynamodb/dynamodb.rooms.repository';
import { MembershipsRepository } from '@entities/memberships.repository';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { DynamoDBMembershipsRepository } from './repositories/dynamodb/dynamodb.memberships.repository';
import { MessagesRepository } from '@entities/messages/messages-repository';
import { UsersRepository } from '@entities/users/users-repository';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MembershipStatus } from '@entities/membership.entity';
import { CreateMembershipParams } from '@entities/memberships.repository';
import { MembershipStatus } from '@entities/memberships/membership';
import { CreateMembershipParams } from '@entities/memberships/memberships-repository';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { RoomFactory } from '@fixtures/messages/room.factory';
import { UserFactory } from '@fixtures/messages/user.factory';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DynamoDBRoomsRepository } from '@data/repositories/dynamodb/dynamodb.rooms.repository';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { CreateRoomParams } from '@entities/rooms.repository';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { CreateRoomParams } from '@entities/rooms/rooms-repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
import { Test } from '@nestjs/testing';
import { DataModule } from '../data.module';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Membership } from '@entities/membership.entity';
import { Membership } from '@entities/memberships/membership';
import {
CreateMembershipParams,
MembershipsRepository,
} from '@entities/memberships.repository';
} from '@entities/memberships/memberships-repository';
import { Injectable } from '@nestjs/common';
import { pick } from 'rambda';
import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { subject } from '@casl/ability';
import { Room } from '@entities/room.entity';
import { Room } from '@entities/rooms/room';
import {
CreateRoomParams,
RoomsRepository,
UpdateRoomParams,
} from '@entities/rooms.repository';
} from '@entities/rooms/rooms-repository';
import { Injectable, NotFoundException } from '@nestjs/common';
import { pick } from 'rambda';
import { DynamoDBAdapter } from '../../adapters/dynamodb/dynamodb.adapter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
CreateMembershipParams,
MembershipsRepository,
} from '@entities/memberships.repository';
import { Membership } from '@entities/membership.entity';
} from '@entities/memberships/memberships-repository';
import { Membership } from '@entities/memberships/membership';

export class TestMembershipsRepository extends MembershipsRepository {
private memberships: Membership[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
CreateRoomParams,
RoomsRepository,
UpdateRoomParams,
} from '@entities/rooms.repository';
import { Room } from '@entities/room.entity';
} from '@entities/rooms/rooms-repository';
import { Room } from '@entities/rooms/room';
import { faker } from '@faker-js/faker';
import { subject } from '@casl/ability';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Membership, MembershipStatus } from './membership.entity';
import { Membership, MembershipStatus } from './membership';

export type CreateMembershipParams = Pick<
Membership,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Room } from './room.entity';
import { Room } from './room';

export type CreateRoomParams = Omit<Room, 'id'>;
export type UpdateRoomParams = Partial<
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { User } from '@entities/users/user';
import { Logger } from './logger';
import { UnauthorizedException } from '@nestjs/common';
import { isNil, reject } from 'rambda';
import { Room } from '@entities/room.entity';
import { Room } from '@entities/rooms/room';

export enum Role {
Read = 'read',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command } from '@entities/command.entity';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { Command } from '@entities/command';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { BadRequestException } from '@nestjs/common';
import { equals } from 'rambda';
import { z, ZodIssue, ZodType } from 'zod';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/commands/parse/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command } from '@entities/command.entity';
import { Command } from '@entities/command';
import { BadRequestException, Injectable } from '@nestjs/common';
import { parsers } from './parsers';
import { ParsedCommand } from './command.parser';
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/domain/usecases/commands/parse/parse.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Command } from '@entities/command.entity';
import { Command } from '@entities/command';
import { BadRequestException } from '@nestjs/common';
import { ParseCommandUseCase } from '.';
import { ParsedCommand } from './command.parser';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';

describe('ParseCommandUseCase', () => {
let parse: ParseCommandUseCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { CommandParser, ParsedCommand } from '../command.parser';
import { ContentPolicy } from '@entities/room.entity';
import { ContentPolicy } from '@entities/rooms/room';

const schema = z
.tuple([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { CommandParser, ParsedCommand } from '../command.parser';
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';

const schema = z
.tuple([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';
import { TestAuthService } from '@fixtures/auth/test-auth-service';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
Expand All @@ -10,7 +10,7 @@ import { Role } from '@usecases/auth.service';
import mock, { MockProxy } from 'jest-mock-extended/lib/Mock';
import { Dispatcher } from '@entities/messages/message';
import { TestUsersRepository } from '@data/repositories/test/test.users.repository';
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipStatus } from '@entities/memberships/membership';
import { ApproveRequestUseCase } from './approve-request';

describe('ApproveRequestUseCase', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
MembershipStatus,
getMembershipStatus,
} from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships.repository';
} from '@entities/memberships/membership';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { Dispatcher, DraftMessage } from '@entities/messages/message';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { UsersRepository } from '@entities/users/users-repository';
import { Injectable } from '@nestjs/common';
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/domain/usecases/memberships/invite.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';
import { TestAuthService } from '@fixtures/auth/test-auth-service';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
Expand All @@ -11,7 +11,7 @@ import mock, { MockProxy } from 'jest-mock-extended/lib/Mock';
import { Dispatcher } from '@entities/messages/message';
import { InviteUseCase } from './invite';
import { TestUsersRepository } from '@data/repositories/test/test.users.repository';
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipStatus } from '@entities/memberships/membership';

describe('InviteUseCase', () => {
let invite: InviteUseCase;
Expand Down
6 changes: 3 additions & 3 deletions services/api/src/domain/usecases/memberships/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { AuthService, Role } from '@usecases/auth.service';
import {
MembershipStatus,
getMembershipStatus,
} from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships.repository';
import { RoomsRepository } from '@entities/rooms.repository';
} from '@entities/memberships/membership';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { Injectable } from '@nestjs/common';
import { Dispatcher, DraftMessage } from '@entities/messages/message';
import { User } from '@entities/users/user';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/memberships/join.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';
import { TestAuthService } from '@fixtures/auth/test-auth-service';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
Expand Down
8 changes: 4 additions & 4 deletions services/api/src/domain/usecases/memberships/join.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AuthService, Role } from '@usecases/auth.service';
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships.repository';
import { RoomsRepository } from '@entities/rooms.repository';
import { MembershipStatus } from '@entities/memberships/membership';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';
import { Dispatcher, DraftMessage } from '@entities/messages/message';
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';

@Injectable()
export class JoinRoomUseCase {
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/domain/usecases/memberships/leave.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JoinPolicy } from '@entities/room.entity';
import { JoinPolicy } from '@entities/rooms/room';
import { TestAuthService } from '@fixtures/auth/test-auth-service';
import { TestMembershipsRepository } from '@data/repositories/test/test.memberships.repository';
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
Expand All @@ -9,7 +9,7 @@ import { Role } from '@usecases/auth.service';
import mock, { MockProxy } from 'jest-mock-extended/lib/Mock';
import { Dispatcher, UpdatedEntity } from '@entities/messages/message';
import { LeaveRoomUseCase } from './leave';
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipStatus } from '@entities/memberships/membership';

describe('LeaveRoomUseCase', () => {
let leave: LeaveRoomUseCase;
Expand Down
6 changes: 3 additions & 3 deletions services/api/src/domain/usecases/memberships/leave.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MembershipStatus } from '@entities/membership.entity';
import { MembershipsRepository } from '@entities/memberships.repository';
import { MembershipStatus } from '@entities/memberships/membership';
import { MembershipsRepository } from '@entities/memberships/memberships-repository';
import {
Dispatcher,
DraftMessage,
UpdatedEntity,
} from '@entities/messages/message';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';

Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/messages/get-messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Role, AuthService } from '@usecases/auth.service';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';
import { pipe, reject } from 'rambda';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/messages/parse-message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command } from '@entities/command.entity';
import { Command } from '@entities/command';
import { DraftMessage } from '@entities/messages/message';

export type ParsedMessage = DraftMessage | Command;
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/messages/send.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dispatcher, DraftMessage } from '@entities/messages/message';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';
import { Role, AuthService } from '@usecases/auth.service';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/rooms/about-room.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dispatcher, DraftMessage } from '@entities/messages/message';
import { RoomsRepository } from '@entities/rooms.repository';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { UsersRepository } from '@entities/users/users-repository';
import { Injectable } from '@nestjs/common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Dispatcher } from '@entities/messages/message';
import { AppLogger } from '@app/app.logger';
import { Role } from '@usecases/auth.service';
import { ConfigureRoomUseCase } from './configure-room';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';

describe('ChangeRoomJoinPolicyUseCase', () => {
let changeRoomJoinPolicy: ConfigureRoomUseCase;
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/domain/usecases/rooms/configure-room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
DraftMessage,
UpdatedEntity,
} from '@entities/messages/message';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { RoomsRepository } from '@entities/rooms.repository';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';
import { RoomsRepository } from '@entities/rooms/rooms-repository';
import { User } from '@entities/users/user';
import { Injectable } from '@nestjs/common';
import { AuthService, Role } from '@usecases/auth.service';
Expand Down
2 changes: 1 addition & 1 deletion services/api/src/domain/usecases/rooms/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TestMembershipsRepository } from '@data/repositories/test/test.membersh
import { TestRoomsRepository } from '@data/repositories/test/test.rooms.repository';
import { UserFactory } from '@fixtures/messages/user.factory';
import { CreateRoomUseCase } from './create';
import { ContentPolicy, JoinPolicy } from '@entities/room.entity';
import { ContentPolicy, JoinPolicy } from '@entities/rooms/room';

describe('CreateRoomUseCase', () => {
let create: CreateRoomUseCase;
Expand Down
Loading

0 comments on commit 6cb336b

Please sign in to comment.