Skip to content

Commit

Permalink
feat: merge main into to release 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
djabarovgeorge committed Aug 9, 2022
2 parents 2d40c31 + 9295943 commit cbf5f84
Show file tree
Hide file tree
Showing 90 changed files with 142 additions and 480 deletions.
7 changes: 1 addition & 6 deletions _templates/usecase/new/command.ejs.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
---
to: apps/api/src/app/<%= module %>/usecases/<%= name %>/<%= name %>.command.ts
---
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class <%= h.changeCase.pascal(name) %>Command extends EnvironmentWithUserCommand {
static create(data: <%= h.changeCase.pascal(name) %>Command) {
return CommandHelper.create<<%= h.changeCase.pascal(name) %>Command>(<%= h.changeCase.pascal(name) %>Command, data);
}
}
export class <%= h.changeCase.pascal(name) %>Command extends EnvironmentWithUserCommand {}


Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsNumber, IsOptional } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetActivityGraphStatsCommand extends EnvironmentWithUserCommand {
static create(data: GetActivityGraphStatsCommand) {
return CommandHelper.create<GetActivityGraphStatsCommand>(GetActivityGraphStatsCommand, data);
}

@IsNumber()
@IsOptional()
days: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { IsArray, IsEnum, IsMongoId, IsNumber, IsOptional, IsPositive, IsString } from 'class-validator';
import { IsArray, IsEnum, IsMongoId, IsNumber, IsOptional, IsString } from 'class-validator';
import { ChannelTypeEnum } from '@novu/shared';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetActivityFeedCommand extends EnvironmentWithUserCommand {
static create(data: GetActivityFeedCommand) {
return CommandHelper.create<GetActivityFeedCommand>(GetActivityFeedCommand, data);
}

@IsNumber()
@IsOptional()
page: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetActivityStatsCommand extends EnvironmentWithUserCommand {
static create(data: GetActivityStatsCommand) {
return CommandHelper.create<GetActivityStatsCommand>(GetActivityStatsCommand, data);
}
}
export class GetActivityStatsCommand extends EnvironmentWithUserCommand {}
8 changes: 2 additions & 6 deletions apps/api/src/app/auth/usecases/login/login.command.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { IsDefined, IsEmail, IsNotEmpty } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';

export class LoginCommand {
static create(data: LoginCommand) {
return CommandHelper.create(LoginCommand, data);
}
import { BaseCommand } from '../../../shared/commands/base.command';

export class LoginCommand extends BaseCommand {
@IsDefined()
@IsNotEmpty()
@IsEmail()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsEmail } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class PasswordResetRequestCommand {
static create(data: PasswordResetRequestCommand) {
return CommandHelper.create<PasswordResetRequestCommand>(PasswordResetRequestCommand, data);
}
import { BaseCommand } from '../../../shared/commands/base.command';

export class PasswordResetRequestCommand extends BaseCommand {
@IsEmail()
@IsDefined()
email: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsString, IsUUID, MinLength } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class PasswordResetCommand {
static create(data: PasswordResetCommand) {
return CommandHelper.create<PasswordResetCommand>(PasswordResetCommand, data);
}
import { BaseCommand } from '../../../shared/commands/base.command';

export class PasswordResetCommand extends BaseCommand {
@IsString()
@IsDefined()
@MinLength(8)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { IsDefined, IsEmail, IsNotEmpty, IsOptional, MinLength } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';

export class UserRegisterCommand {
static create(data: UserRegisterCommand) {
return CommandHelper.create(UserRegisterCommand, data);
}
import { BaseCommand } from '../../../shared/commands/base.command';

export class UserRegisterCommand extends BaseCommand {
@IsDefined()
@IsNotEmpty()
@IsEmail()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsNotEmpty } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { OrganizationCommand } from '../../../shared/commands/organization.command';

export class SwitchEnvironmentCommand extends OrganizationCommand {
static create(data: SwitchEnvironmentCommand) {
return CommandHelper.create(SwitchEnvironmentCommand, data);
}

@IsNotEmpty()
newEnvironmentId: string;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsNotEmpty } from 'class-validator';
import { AuthenticatedCommand } from '../../../shared/commands/authenticated.command';
import { CommandHelper } from '../../../shared/commands/command.helper';

export class SwitchOrganizationCommand extends AuthenticatedCommand {
static create(data: SwitchOrganizationCommand) {
return CommandHelper.create(SwitchOrganizationCommand, data);
}

@IsNotEmpty()
newOrganizationId: string;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsMongoId } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class ApplyChangeCommand extends EnvironmentWithUserCommand {
static create(data: ApplyChangeCommand) {
return CommandHelper.create(ApplyChangeCommand, data);
}

@IsDefined()
@IsMongoId()
changeId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsArray } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class BulkApplyChangeCommand extends EnvironmentWithUserCommand {
static create(data: BulkApplyChangeCommand) {
return CommandHelper.create(BulkApplyChangeCommand, data);
}

@IsDefined()
@IsArray()
changeIds: string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class CountChangesCommand extends EnvironmentWithUserCommand {
static create(data: CountChangesCommand) {
return CommandHelper.create(CountChangesCommand, data);
}
}
export class CountChangesCommand extends EnvironmentWithUserCommand {}
7 changes: 1 addition & 6 deletions apps/api/src/app/change/usecases/create-change.command.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { ChangeEntityTypeEnum } from '@novu/shared';
import { IsDefined, IsMongoId, IsOptional, IsString } from 'class-validator';
import { Document } from 'mongoose';
import { CommandHelper } from '../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../shared/commands/project.command';

export interface IItem extends Pick<Document, '_id'> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
[key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}

export class CreateChangeCommand extends EnvironmentWithUserCommand {
static create(data: CreateChangeCommand) {
return CommandHelper.create(CreateChangeCommand, data);
}

@IsDefined()
item: IItem;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsBoolean, IsDefined } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetChangesCommand extends EnvironmentWithUserCommand {
static create(data: GetChangesCommand) {
return CommandHelper.create(GetChangesCommand, data);
}

@IsDefined()
@IsBoolean()
promoted: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { ChangeEntityTypeEnum } from '@novu/shared';
import { IsDefined, IsMongoId, IsString } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class PromoteChangeToEnvironmentCommand extends EnvironmentWithUserCommand {
static create(data: PromoteChangeToEnvironmentCommand) {
return CommandHelper.create(PromoteChangeToEnvironmentCommand, data);
}

@IsDefined()
@IsMongoId()
itemId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { IsDefined } from 'class-validator';
import { CommandHelper } from '../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../shared/commands/project.command';
import { IItem } from './create-change.command';

export class PromoteTypeChangeCommand extends EnvironmentWithUserCommand {
static create(data: PromoteTypeChangeCommand) {
return CommandHelper.create(PromoteTypeChangeCommand, data);
}

@IsDefined()
item: IItem;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { ChangeEntityTypeEnum } from '@novu/shared';
import { IsDefined, IsMongoId, IsString } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class UpdateChangeCommand extends EnvironmentWithUserCommand {
static create(data: UpdateChangeCommand) {
return CommandHelper.create(UpdateChangeCommand, data);
}

@IsMongoId()
_entityId: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsEmail } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class UpdateMailSettingsCommand extends EnvironmentWithUserCommand {
static create(data: UpdateMailSettingsCommand) {
return CommandHelper.create<UpdateMailSettingsCommand>(UpdateMailSettingsCommand, data);
}

@IsDefined()
@IsEmail()
senderEmail: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { IsDefined, ValidateNested } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

class TwillioSettings {
Expand All @@ -14,10 +13,6 @@ class TwillioSettings {
}

export class UpdateSmsSettingsCommand extends EnvironmentWithUserCommand {
static create(data: UpdateSmsSettingsCommand) {
return CommandHelper.create<UpdateSmsSettingsCommand>(UpdateSmsSettingsCommand, data);
}

@IsDefined()
@ValidateNested()
twillio: TwillioSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { IsDefined, IsObject, IsOptional } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';

export class CompileTemplateCommand {
static create(data: CompileTemplateCommand) {
return CommandHelper.create<CompileTemplateCommand>(CompileTemplateCommand, data);
}
import { BaseCommand } from '../../../shared/commands/base.command';

export class CompileTemplateCommand extends BaseCommand {
@IsDefined()
templateId: 'basic' | 'custom';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsMongoId, IsOptional } from 'class-validator';
import { OrganizationCommand } from '../../../shared/commands/organization.command';
import { CommandHelper } from '../../../shared/commands/command.helper';

export class CreateEnvironmentCommand extends OrganizationCommand {
static create(data: CreateEnvironmentCommand) {
return CommandHelper.create(CreateEnvironmentCommand, data);
}

@IsDefined()
name: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetApiKeysCommand extends EnvironmentWithUserCommand {
static create(data: GetApiKeysCommand) {
return CommandHelper.create(GetApiKeysCommand, data);
}
}
export class GetApiKeysCommand extends EnvironmentWithUserCommand {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class GetEnvironmentCommand extends EnvironmentWithUserCommand {
static create(data: GetEnvironmentCommand) {
return CommandHelper.create(GetEnvironmentCommand, data);
}
}
export class GetEnvironmentCommand extends EnvironmentWithUserCommand {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { OrganizationCommand } from '../../../shared/commands/organization.command';

export class GetMyEnvironmentsCommand extends OrganizationCommand {
static create(data: GetMyEnvironmentsCommand) {
return CommandHelper.create(GetMyEnvironmentsCommand, data);
}
}
export class GetMyEnvironmentsCommand extends OrganizationCommand {}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentCommand } from '../../../shared/commands/project.command';
import { IsDefined } from 'class-validator';
import { EnvironmentCommand } from '../../../shared/commands/project.command';

export class UpdateWidgetSettingsCommand extends EnvironmentCommand {
static create(data: UpdateWidgetSettingsCommand) {
return CommandHelper.create(UpdateWidgetSettingsCommand, data);
}
@IsDefined()
notificationCenterEncryption: boolean;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { IsDefined, IsString } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class CancelDigestCommand extends EnvironmentWithUserCommand {
static create(data: CancelDigestCommand) {
return CommandHelper.create(CancelDigestCommand, data);
}

@IsString()
@IsDefined()
transactionId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { IsDefined, IsMongoId } from 'class-validator';
import { CommandHelper } from '../../../shared/commands/command.helper';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';
import { NotificationStepEntity } from '@novu/dal';
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command';

export class FilterStepsCommand extends EnvironmentWithUserCommand {
static create(data: FilterStepsCommand) {
return CommandHelper.create(FilterStepsCommand, data);
}

@IsMongoId()
subscriberId: string;

Expand Down
Loading

0 comments on commit cbf5f84

Please sign in to comment.