Skip to content
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

ref: migrate create new form api flow to TypeScript #806

Merged
merged 15 commits into from
Dec 8, 2020

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Dec 7, 2020

Problem

This PR migrates the domain layers pertaining to POST /adminform endpoint.

Additionally, a new utility function transformMongoError is written, to transform errors thrown by mongo into ApplicationErrors understood by our application.

Solution

Features:

  • feat: add Joi validation to POST /adminform
  • feat(AdminFormSvc): add createForm service function
  • feat(AdminFormCtl): add handleCreateForm handler function
  • feat: add transformMongoError utility function to transform errors thrown by mongo into ApplicationErrors understood by our application
  • router now uses the new handleCreateForm controller function

Tests

Add tests for all new methods. Note that there are still no integration tests as the router has not been migrated to TypeScript.

# Conflicts:
#	src/app/routes/admin-forms.server.routes.js
# Conflicts:
#	src/app/modules/form/admin-form/__tests__/admin-form.controller.spec.ts
#	src/app/modules/form/admin-form/__tests__/admin-form.service.spec.ts
#	src/app/modules/form/admin-form/admin-form.controller.ts
#	src/app/modules/form/admin-form/admin-form.service.ts
#	src/app/routes/admin-forms.server.routes.js
#	src/types/form.ts
@karrui karrui requested a review from mantariksh December 8, 2020 01:59
@karrui
Copy link
Contributor Author

karrui commented Dec 8, 2020

Please rereview since I've merged develop in!

@karrui karrui merged commit 3b66f77 into develop Dec 8, 2020
@karrui karrui deleted the ref/create-new-form-ts branch December 8, 2020 02:49
@mantariksh mantariksh mentioned this pull request Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants