Skip to content

Commit

Permalink
feat(api): final sdk e2e changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Dec 19, 2024
1 parent 72c992c commit b30d84c
Show file tree
Hide file tree
Showing 65 changed files with 1,529 additions and 1,285 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-api/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: build
projects: '@novu/api'
projects: '@novu/api-service'

- name: Start API
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion apps/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</a>
</div>

# @novu/api
# @novu/api-service

A RESTful API for accessing the Novu platform, built using [NestJS](https://nestjs.com/).

Expand Down
4 changes: 2 additions & 2 deletions apps/api/jarvis-api-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Hi, I'm Jarvis 🤖
I'm a bot built to help you with your contribution to Novu.
I will add instructions and guides on how to run the subset of the Novu platform associated to this issue and make your first contribution.

This issue was tagged as related to `@novu/api` and the related code is located at the `apps/api` folder, here is how I can help you:
This issue was tagged as related to `@novu/api-service` and the related code is located at the `apps/api` folder, here is how I can help you:

<details>
<summary>First time contributing to Novu?</summary>
Expand All @@ -17,7 +17,7 @@ If that's the first time you want to contribute to Novu here are a few simple st
</details>

<details>
<summary>Run and test `@novu/api` locally</summary>
<summary>Run and test `@novu/api-service` locally</summary>

### Run API in watch mode

Expand Down
4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@novu/api",
"name": "@novu/api-service",
"version": "2.1.1",
"description": "description",
"author": "",
Expand Down Expand Up @@ -42,7 +42,7 @@
"@nestjs/swagger": "7.4.0",
"@nestjs/terminus": "10.2.3",
"@nestjs/throttler": "6.2.1",
"@novu/api": "0.0.1-alpha.109",
"@novu/api": "0.0.1-alpha.128",
"@novu/application-generic": "workspace:*",
"@novu/dal": "workspace:*",
"@novu/framework": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ChannelTypeEnum } from '@novu/shared';
import { SubscribersService, UserSession } from '@novu/testing';
import { expect } from 'chai';
import { Novu } from '@novu/api';
import { initNovuClassSdk } from '../../shared/helpers/e2e/sdk/e2e-sdk.helper';
import { expectSdkExceptionGeneric, initNovuClassSdk } from '../../shared/helpers/e2e/sdk/e2e-sdk.helper';

describe('Delete Messages By TransactionId - /messages/?transactionId= (DELETE)', function () {
let session: UserSession;
Expand All @@ -23,10 +23,9 @@ describe('Delete Messages By TransactionId - /messages/?transactionId= (DELETE)'
});

it('should fail to delete non existing message', async function () {
const response = await session.testAgent.delete(`/v1/messages/transaction/abc-1234`);

expect(response.statusCode).to.equal(404);
expect(response.body.error).to.equal('Not Found');
const { error } = await expectSdkExceptionGeneric(() => novuClient.messages.deleteByTransactionId('abc-1234'));
expect(error?.statusCode).to.equal(404);
expect(error?.name, JSON.stringify(error)).to.equal('Not Found');
});

it('should delete messages by transactionId', async function () {
Expand Down
26 changes: 20 additions & 6 deletions apps/api/src/app/notifications/dtos/activities-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,71 @@ import { IsOptional } from 'class-validator';

export class ActivitiesRequestDto {
@ApiPropertyOptional({
enum: ChannelTypeEnum,
enum: [...Object.values(ChannelTypeEnum)],
enumName: 'ChannelTypeEnum',
isArray: true,
description: 'Array of channel types',
})
@IsOptional()
channels?: ChannelTypeEnum[] | ChannelTypeEnum;

@ApiPropertyOptional({
type: String,
isArray: true,
description: 'Array of template IDs or a single template ID',
})
@IsOptional()
templates?: string[] | string;

@ApiPropertyOptional({
type: String,
isArray: true,
description: 'Array of email addresses or a single email address',
})
@IsOptional()
emails?: string | string[];

@ApiPropertyOptional({
type: String,
deprecated: true,
description: 'Search term (deprecated)',
})
@IsOptional()
search?: string;

@ApiPropertyOptional({
type: String,
isArray: true,
description: 'Array of subscriber IDs or a single subscriber ID',
})
@IsOptional()
subscriberIds?: string | string[];

@ApiPropertyOptional({
type: Number,
required: false,
default: 0,
description: 'Page number for pagination',
})
page?: number = 0;
@IsOptional()
page?: number;

@ApiPropertyOptional({
type: String,
required: false,
description: 'Transaction ID for filtering',
})
@IsOptional()
transactionId?: string;

@ApiPropertyOptional({
type: String,
required: false,
description: 'Date filter for records after this timestamp',
})
@IsOptional()
after?: string;

@ApiPropertyOptional({
type: String,
required: false,
description: 'Date filter for records before this timestamp',
})
@IsOptional()
before?: string;
Expand Down
Loading

0 comments on commit b30d84c

Please sign in to comment.