-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persisting created new campaignApplication to db #657
Conversation
update CampaignApplication model - organizerEmail now is not unique update create method testing now created campaig-application data is persisted to db
update CampaignApplication model - organizerEmail now is not unique update create method testing now created campaig-application data is persisted to db
✅ Tests will run for this PR. Once they succeed it can be merged. |
@@ -26,63 +42,61 @@ describe('CampaignApplicationController', () => { | |||
expect(controller).toBeDefined() | |||
}) | |||
|
|||
it('when create called it should delegate to the service create', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is deleted but the logic is still in use. Was this by design?
@@ -2,21 +2,37 @@ import { Test, TestingModule } from '@nestjs/testing' | |||
import { CampaignApplicationController } from './campaign-application.controller' | |||
import { CampaignApplicationService } from './campaign-application.service' | |||
import { SpyOf, autoSpy } from '@podkrepi-bg/testing' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some unuses stuff that github(or an action?) points out - SpyOf and CamapignTypeCategroy
controller.findOne('id') | ||
|
||
// assert | ||
// Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid such unnecessary changes - they make the code review that much harder
|
||
expect(prismaMock.campaignApplication.create).toHaveBeenCalledWith({ | ||
data: { | ||
campaignName: dto.campaignName.trim(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the logic itself and while it's technically correct I belive we'll get more value having hardcoded value here i.e. {
data :{
campaignName: 'my-campaign',
organizerName: 'test organizer',
...
apps/api/src/campaign-application/campaign-application.service.ts
Outdated
Show resolved
Hide resolved
}) | ||
} | ||
|
||
const sanitizedData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prisma sanitizes the input by default. Seems like it also trims unnecessary spaces from user input, thus sanitizedData
is not needed.
@Module({ | ||
imports: [PrismaModule], | ||
controllers: [CampaignApplicationController], | ||
providers: [CampaignApplicationService], | ||
providers: [CampaignApplicationService, PersonService, OrganizerService], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer importing modules instead of services(e.g. imports:[PrismaModule, PersonModule, OrganizersModule]
)
delete PersonService and OrganizerService and add PersonModule and OrganizersModule to campaign-application module
No description provided.