Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const TABLE_NAME = 'mail_accounts';
const COLUMN_NAME = 'network_bucket_id';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.removeColumn(TABLE_NAME, COLUMN_NAME);
},

async down(queryInterface, Sequelize) {
await queryInterface.addColumn(TABLE_NAME, COLUMN_NAME, {
type: Sequelize.STRING(24),
allowNull: true,
defaultValue: null,
});
},
};
2 changes: 0 additions & 2 deletions src/modules/account/domain/mail-account.domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export interface MailAccountAttributes {
userId: string;
status: MailAccountState;
suspendedAt: Date | null;
networkBucketId: string | null;
addresses: MailAddressAttributes[];
createdAt: Date;
updatedAt: Date;
Expand All @@ -25,7 +24,6 @@ export class MailAccount {
readonly userId!: string;
readonly status!: MailAccountState;
readonly suspendedAt!: Date | null;
readonly networkBucketId!: string | null;
readonly addresses!: MailAddress[];
readonly createdAt!: Date;
readonly updatedAt!: Date;
Expand Down
4 changes: 0 additions & 4 deletions src/modules/account/models/mail-account.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export class MailAccountModel extends Model {
@Column(DataType.DATE)
declare suspendedAt: Date | null;

@AllowNull(true)
@Column({ field: 'network_bucket_id', type: DataType.UUID })
declare networkBucketId: string | null;

@Column(DataType.DATE)
declare deletedAt: Date | null;

Expand Down
12 changes: 0 additions & 12 deletions src/modules/account/repositories/account.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe('AccountRepository', () => {
userId: 'user-1',
status: 'active',
suspendedAt: null,
networkBucketId: null,
createdAt: new Date('2026-01-01T00:00:00.000Z'),
updatedAt: new Date('2026-01-02T00:00:00.000Z'),
addresses: [],
Expand Down Expand Up @@ -135,17 +134,6 @@ describe('AccountRepository', () => {
});
});

describe('setNetworkBucketId', () => {
it('when given an id and bucket id, then updates the account row', async () => {
await repository.setNetworkBucketId('acc-1', 'bucket-1');

expect(accountModel.update).toHaveBeenCalledWith(
{ networkBucketId: 'bucket-1' },
{ where: { id: 'acc-1' } },
);
});
});

describe('suspend', () => {
it('when given an id, then sets status suspended and suspendedAt', async () => {
await repository.suspend('acc-1');
Expand Down
5 changes: 0 additions & 5 deletions src/modules/account/repositories/account.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ export class AccountRepository {
await this.accountModel.destroy({ where: { id }, force: options?.force });
}

async setNetworkBucketId(id: string, networkBucketId: string): Promise<void> {
await this.accountModel.update({ networkBucketId }, { where: { id } });
}

async suspend(id: string): Promise<void> {
await this.accountModel.update(
{ status: MailAccountState.Suspended, suspendedAt: new Date() },
Expand Down Expand Up @@ -149,7 +145,6 @@ export class AccountRepository {
userId: model.userId,
status: model.status as MailAccountState,
suspendedAt: model.suspendedAt,
networkBucketId: model.networkBucketId,
createdAt: model.createdAt as Date,
updatedAt: model.updatedAt as Date,
addresses: (model.addresses ?? []).map(toAddressAttributes),
Expand Down
1 change: 0 additions & 1 deletion test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ export function newMailAccountAttributes(
userId: randomUuid(),
status: MailAccountState.Active,
suspendedAt: null,
networkBucketId: null,
addresses: [address],
createdAt: new Date(),
updatedAt: new Date(),
Expand Down
Loading