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

Add alertId to assignment #30

Merged

Conversation

correcthorsebatterystaple
Copy link
Collaborator

Changes

  • Add alertId to assignment models and inputs

Ticket

https://3sidedcube.atlassian.net/browse/GFW-1466

@correcthorsebatterystaple correcthorsebatterystaple deleted the feature/add-alert-id-toassignment-location branch November 18, 2022 08:00
edward3sc added a commit that referenced this pull request Jan 17, 2023
* Delete .env

* Delete .env

* tf

* routes

* tf

* tf

* healthcheck

* remove auth from healthcheck

* debug

* fix colours

* connect to db

* tests

* database names

* endpoint reordering

* debug

* debug

* correct schemas

* microservice token

* remove log

* protect .toString() methods

* return team details

* Fix check on child question type

* area report templates

* docs

* routes docs

* templates and answers docs

* area docs

* relations docs

* teams docs

* fix assignment docs

* assignment status enum

* add username to user on auth

* new assignment and answer endpoint

* assignment status checks

* fix yaml

* yaml

* test

* check area exists

* check area exists

* lint fixes

* assignment tests

* no update of assignment areaId

* assignments docs

* assignment location object

* fix POST area

* tidy up

* filter out unwanted areas

* Add volume to copy host dir to container (#5)

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* eslintrc

* Fix child image response path

* Update answers.module.ts

* Update answers.module.ts

* Update answers.controller.ts

* Update answers.module.ts

* areas

* Update answers.module.ts

* Update answers.module.ts

* Update configuration.ts

* Add S£_BUCKET env var to docker compose

* Change dev bucket to gfw-fw-data-dev

* Revert "Change dev bucket to gfw-fw-data-dev"

This reverts commit f2743a3.

* Change dev bucket to gfw-fw-data-dev

* Add S3 folder env var

* Add logginf to s3 service

* Fix logger on S3 service

* Remove s3 service logging

* Change dev s3 bucket to forest-watcher-files

* Update templates.controller.ts

* geostore

* cors

* docker

* docker

* move response builder to controller

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* delete tmp files

* fix answers tests

* fix watch

* Run linting

* Feature/add template versions (#6)

* Throw not found exception if no template is found with id

* Add editGroupId and isLatest to template schema

* Add /latest endpoint to templates

* Fix tests

* Add tests for template/latest

* Add teardown to test

* Add test for only current user latest templates

* Add endpoint to fetch all versions of a template by group id

* Update lint workflow

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* Make editGroupId and isLatest optional

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <101396989+edward3sc@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix/null type checks (#9)

* Add strict null checking

* Fix null values and null accesses

* Fix more null accesses

* More null access fixes

* Fix test container

* Fix tests

* Docker fix eslint

* auto commit: apply eslint fixes

* Remove null assertions

* Destructure user from request

* Update ObjectId types

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* routes changes

* team area route endpoint

* fix route sync

* Fix/route sync (#11)

* routes changes

* team area route endpoint

* fix route sync

* auto commit: apply eslint fixes

* fix tests

* remove test string

* remove test string

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Remove all unused imports and declarations (eslint)

* Feature/add sync assignments endpoint (#10)

* Refactor answer create

* Change assignment status if answer is submitted to an assignment

* Add enum for assignment status and fix module dependency issues

* Fix type issues on create answer dto

* auto commit: apply eslint fixes

* Add await to test teardown

* Check if asignment matches the template for answer

* Add tests

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* Fix/team layers (#12)

* routes changes

* team area route endpoint

* fix route sync

* add layers to team object

* docker

* Update routes.e2e.spec.ts

* Fix undefined error on geostore id access (#13)

* Feature/assignments multiple templates (#14)

* routes changes

* team area route endpoint

* fix route sync

* change assignments to handle multiple templates

* docs

* Update assignments.controller.ts

* Update assignments.service.ts

* Update assignments.service.ts

* Update assignments.e2e.spec.ts

* auto commit: apply eslint fixes

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* add team layers

* teams docs

* Fix/fetching geostore with undefined (#15)

* Add common Module and redis service

* Redo some imports in areas and assignments

* Refactor getNameByIdMICROSERVICE

* Fix fetching geostore with undefined

* Add tests for undefined geostore should yield bad request

* Upload file when question type is audio (#16)

* assignments docs

* geostore

* Sentry (#17)

* Sentry

* sample rate

* geostore

* geostore (#18)

* geostore

* geostore

* teams

* fix

* alertType not required

* remove geostore isDefined()

* teams docs

* Change docs yaml ref

* fix assignment location

* Make location optional in create assignment

* Only update assignment status if not already complete (#19)

* Handle completed assignment (#20)

* Only update assignment status if not already complete

* fix failing tests

* Check location/geostore (#22)

* Add check for location or geostore

* tests

* Feature/add edit templates endpoint (#21)

* Add base service

* Add user role enum

* Refactor template delete

* A little bit of refactor in my life

* Refactor template update

* Add object Id

* WIP

* Add update status endpoint

* Remove unused imoprts

* Update tests

* WIP

* Fix tests

* Add endpoints for latest version in a group

* Bring Sentry back again

* Add tests for group id latest endpoint

* Add docs for new endpoint

* More docs

* Add docs for status endpoint

* Add tests for status endpoint

* sentry

* Add editGroupId and isLatest to template response in docs

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* Feature/template areas (#24)

* sentry

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* module imports

* optional notes

* Add AuthUser decorator and replace all request.user instances (#23)

* Add AuthUser decorator and replace all request.user instances

* Change eslint run procedure

* Remove unused imports

* Remove stop containers from eslint.yml

* Add test github workflow

* Install dependencies before test workflow

* assignments docs

* Feature/add public templates endpoint (#25)

* Add public templates endpoint

* Add docs for public templates

* Run workflows on push or pr

* Restore docs

* Add docs for public templates endpoint

* Only run lint and tests on push

* Merge lint and test jobs

* Add tests for public templates endpoint

* Add Templates tag to template endpoints

* docs

* Feature/add template endpoint validation (#26)

* Remove unused helper method

* assignment images and monitor names and templates

* docs

* Fix docs endpoint

* assignment images and monitor names and templates (#27)

* assignment images and monitor names and templates

* patch image

* docker

* docs

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/assignments.controller.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/common/user.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* remove null

* auto commit: apply eslint fixes

* changes

* edit GET /assignments/user

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* throw error on wrong PATCH assignment fields

* tests

* tests

* Fix empty response in docs

* Move validation to assignment controller from service

* assignments fixes

* Add validation to create assignment endpoint

* Fix assignment image upload test

* Fix area delete returns 500

* Feature/add image gallery response (#28)

* Change image response to an array

* Remove console.log

* Add image maximum count field and validation

* Validate maxImageCount is an integer

* Fix tests so that image upload now gives an array response

* Fix repetitive method calls

* delete all assignments

* docs

* Fix docs for assignment response

* Fix docs: add json request to create assignment endpoint

* Fix area not found throws 500

* Fix area 404 thorows 500 error

* Fix assignment create fails when given geostore with form data

* Update docs

* Fix docs to show geostore as JSON string

* Add docs to assigment create endpoint

* Fix file upload extension is wrong

* Move objectIdValidator.pipe.ts

* Fix using .at is not supported

* Add maxImageCount to QuestionModel docs

* Fix docs

* Create pull_request_template.md

* Add alertId to assignment (#30)

* Feature/change template relations to bulk (#29)

* Change create team area relation to bulk

* Change template area relation to bulk

* Fix tests

* Add alertId to docs

* Update docs

* Add assignmentId to answer create docs

* Remove whitelist on input for template

* Fix template patch endpoint

* Fix latest endpoint only returns published versions

* Fix PATCH templates docs

* Fetch area relations on templates by id instead of editGroupId

* Fix GET template area relation using edit group id

* Fix legacy templ;ates without isLatest flag not returning

* Fix yarn docs

* Feature/add area relation on template crud (#31)

* WIP

* Fix test for adding areas on create

* Fix tests for mocking area service methods

* Return existing relation in case of duplicate

* Remove unused import

* Add area relations on update

* Clear all mocks after update template tests

* Persist old area relations on updated template if none given

* Update Docs

* Parse string input values

* Update docs

* Add validation to answer create endpoint

* Fix module imports for templates

* Fix missing assignmentId on answer response

* Change assignment module imports

* Fix userPosition validation on answer create

* Add areaIds to docs example

* Update docs

* Fix route sync is duplicating routes

Mobile sends either the uuid for the route or the mongo id for the created route.
For the mongoid the searchg should be done over _id where as for the
uuid thesearch should be donw over the routeId.

* Update docs

* Default maxImageCount to 5

* Add change status endpoint for assignments

Allow monitors to change from open to on hold and viceversa

* Update docs

* Remove array min size for areaIds on create template

* Update docs

* remove mongodb id restriction on route geostore

* Fix cannot view answers for templates created by monitors

* Delete route when deleted by creator

Delete the route if creator deletes
Set active to false if manager but not creator deletes it
Errors otherwise

* Revert "Delete route when deleted by creator"

This reverts commit 50be16e.

* Revert "Revert "Delete route when deleted by creator""

This reverts commit 5d25bde.

* Add query param to include inactive routes in response

* add username to route response

* docs

* trim string arrays for IsNumberString checks

* tidy up

* DELETE /templates/allAnswers returns all deleted ids

* only return confirmed teams

* only return confirmed teams

* linting

* teams

* delete teams

* fix delete area endpoint

* move endpoints

* small fix

* small fix

* Get only published public templates

* Fix public templates only fetching unpublished

* Fix answer for child question is replaced with parent question answer

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>
edward3sc added a commit that referenced this pull request Mar 14, 2023
* no update of assignment areaId

* assignments docs

* assignment location object

* fix POST area

* tidy up

* filter out unwanted areas

* Add volume to copy host dir to container (#5)

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* eslintrc

* Fix child image response path

* Update answers.module.ts

* Update answers.module.ts

* Update answers.controller.ts

* Update answers.module.ts

* areas

* Update answers.module.ts

* Update answers.module.ts

* Update configuration.ts

* Add S£_BUCKET env var to docker compose

* Change dev bucket to gfw-fw-data-dev

* Revert "Change dev bucket to gfw-fw-data-dev"

This reverts commit f2743a3.

* Change dev bucket to gfw-fw-data-dev

* Add S3 folder env var

* Add logginf to s3 service

* Fix logger on S3 service

* Remove s3 service logging

* Change dev s3 bucket to forest-watcher-files

* Update templates.controller.ts

* geostore

* cors

* docker

* docker

* move response builder to controller

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* delete tmp files

* fix answers tests

* fix watch

* Run linting

* Feature/add template versions (#6)

* Throw not found exception if no template is found with id

* Add editGroupId and isLatest to template schema

* Add /latest endpoint to templates

* Fix tests

* Add tests for template/latest

* Add teardown to test

* Add test for only current user latest templates

* Add endpoint to fetch all versions of a template by group id

* Update lint workflow

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* Make editGroupId and isLatest optional

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <101396989+edward3sc@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix/null type checks (#9)

* Add strict null checking

* Fix null values and null accesses

* Fix more null accesses

* More null access fixes

* Fix test container

* Fix tests

* Docker fix eslint

* auto commit: apply eslint fixes

* Remove null assertions

* Destructure user from request

* Update ObjectId types

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* routes changes

* team area route endpoint

* fix route sync

* Fix/route sync (#11)

* routes changes

* team area route endpoint

* fix route sync

* auto commit: apply eslint fixes

* fix tests

* remove test string

* remove test string

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Remove all unused imports and declarations (eslint)

* Feature/add sync assignments endpoint (#10)

* Refactor answer create

* Change assignment status if answer is submitted to an assignment

* Add enum for assignment status and fix module dependency issues

* Fix type issues on create answer dto

* auto commit: apply eslint fixes

* Add await to test teardown

* Check if asignment matches the template for answer

* Add tests

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* Fix/team layers (#12)

* routes changes

* team area route endpoint

* fix route sync

* add layers to team object

* docker

* Update routes.e2e.spec.ts

* Fix undefined error on geostore id access (#13)

* Feature/assignments multiple templates (#14)

* routes changes

* team area route endpoint

* fix route sync

* change assignments to handle multiple templates

* docs

* Update assignments.controller.ts

* Update assignments.service.ts

* Update assignments.service.ts

* Update assignments.e2e.spec.ts

* auto commit: apply eslint fixes

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* add team layers

* teams docs

* Fix/fetching geostore with undefined (#15)

* Add common Module and redis service

* Redo some imports in areas and assignments

* Refactor getNameByIdMICROSERVICE

* Fix fetching geostore with undefined

* Add tests for undefined geostore should yield bad request

* Upload file when question type is audio (#16)

* assignments docs

* geostore

* Sentry (#17)

* Sentry

* sample rate

* geostore

* geostore (#18)

* geostore

* geostore

* teams

* fix

* alertType not required

* remove geostore isDefined()

* teams docs

* Change docs yaml ref

* fix assignment location

* Make location optional in create assignment

* Only update assignment status if not already complete (#19)

* Handle completed assignment (#20)

* Only update assignment status if not already complete

* fix failing tests

* Check location/geostore (#22)

* Add check for location or geostore

* tests

* Feature/add edit templates endpoint (#21)

* Add base service

* Add user role enum

* Refactor template delete

* A little bit of refactor in my life

* Refactor template update

* Add object Id

* WIP

* Add update status endpoint

* Remove unused imoprts

* Update tests

* WIP

* Fix tests

* Add endpoints for latest version in a group

* Bring Sentry back again

* Add tests for group id latest endpoint

* Add docs for new endpoint

* More docs

* Add docs for status endpoint

* Add tests for status endpoint

* sentry

* Add editGroupId and isLatest to template response in docs

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* Feature/template areas (#24)

* sentry

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* module imports

* optional notes

* Add AuthUser decorator and replace all request.user instances (#23)

* Add AuthUser decorator and replace all request.user instances

* Change eslint run procedure

* Remove unused imports

* Remove stop containers from eslint.yml

* Add test github workflow

* Install dependencies before test workflow

* assignments docs

* Feature/add public templates endpoint (#25)

* Add public templates endpoint

* Add docs for public templates

* Run workflows on push or pr

* Restore docs

* Add docs for public templates endpoint

* Only run lint and tests on push

* Merge lint and test jobs

* Add tests for public templates endpoint

* Add Templates tag to template endpoints

* docs

* Feature/add template endpoint validation (#26)

* Remove unused helper method

* assignment images and monitor names and templates

* docs

* Fix docs endpoint

* assignment images and monitor names and templates (#27)

* assignment images and monitor names and templates

* patch image

* docker

* docs

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/assignments.controller.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/common/user.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* remove null

* auto commit: apply eslint fixes

* changes

* edit GET /assignments/user

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* throw error on wrong PATCH assignment fields

* tests

* tests

* Fix empty response in docs

* Move validation to assignment controller from service

* assignments fixes

* Add validation to create assignment endpoint

* Fix assignment image upload test

* Fix area delete returns 500

* Feature/add image gallery response (#28)

* Change image response to an array

* Remove console.log

* Add image maximum count field and validation

* Validate maxImageCount is an integer

* Fix tests so that image upload now gives an array response

* Fix repetitive method calls

* delete all assignments

* docs

* Fix docs for assignment response

* Fix docs: add json request to create assignment endpoint

* Fix area not found throws 500

* Fix area 404 thorows 500 error

* Fix assignment create fails when given geostore with form data

* Update docs

* Fix docs to show geostore as JSON string

* Add docs to assigment create endpoint

* Fix file upload extension is wrong

* Move objectIdValidator.pipe.ts

* Fix using .at is not supported

* Add maxImageCount to QuestionModel docs

* Fix docs

* Create pull_request_template.md

* Add alertId to assignment (#30)

* Feature/change template relations to bulk (#29)

* Change create team area relation to bulk

* Change template area relation to bulk

* Fix tests

* Add alertId to docs

* Update docs

* Add assignmentId to answer create docs

* Remove whitelist on input for template

* Fix template patch endpoint

* Fix latest endpoint only returns published versions

* Fix PATCH templates docs

* Fetch area relations on templates by id instead of editGroupId

* Fix GET template area relation using edit group id

* Fix legacy templ;ates without isLatest flag not returning

* Fix yarn docs

* Feature/add area relation on template crud (#31)

* WIP

* Fix test for adding areas on create

* Fix tests for mocking area service methods

* Return existing relation in case of duplicate

* Remove unused import

* Add area relations on update

* Clear all mocks after update template tests

* Persist old area relations on updated template if none given

* Update Docs

* Parse string input values

* Update docs

* Add validation to answer create endpoint

* Fix module imports for templates

* Fix missing assignmentId on answer response

* Change assignment module imports

* Fix userPosition validation on answer create

* Add areaIds to docs example

* Update docs

* Fix route sync is duplicating routes

Mobile sends either the uuid for the route or the mongo id for the created route.
For the mongoid the searchg should be done over _id where as for the
uuid thesearch should be donw over the routeId.

* Update docs

* Default maxImageCount to 5

* Add change status endpoint for assignments

Allow monitors to change from open to on hold and viceversa

* Update docs

* Remove array min size for areaIds on create template

* Update docs

* remove mongodb id restriction on route geostore

* Fix cannot view answers for templates created by monitors

* Delete route when deleted by creator

Delete the route if creator deletes
Set active to false if manager but not creator deletes it
Errors otherwise

* Revert "Delete route when deleted by creator"

This reverts commit 50be16e.

* Revert "Revert "Delete route when deleted by creator""

This reverts commit 5d25bde.

* Add query param to include inactive routes in response

* add username to route response

* docs

* trim string arrays for IsNumberString checks

* tidy up

* DELETE /templates/allAnswers returns all deleted ids

* only return confirmed teams

* only return confirmed teams

* linting

* teams

* delete teams

* fix delete area endpoint

* move endpoints

* small fix

* small fix

* Get only published public templates

* Fix public templates only fetching unpublished

* Fix answer for child question is replaced with parent question answer

* Dev (#32)

* Delete .env

* Delete .env

* tf

* routes

* tf

* tf

* healthcheck

* remove auth from healthcheck

* debug

* fix colours

* connect to db

* tests

* database names

* endpoint reordering

* debug

* debug

* correct schemas

* microservice token

* remove log

* protect .toString() methods

* return team details

* Fix check on child question type

* area report templates

* docs

* routes docs

* templates and answers docs

* area docs

* relations docs

* teams docs

* fix assignment docs

* assignment status enum

* add username to user on auth

* new assignment and answer endpoint

* assignment status checks

* fix yaml

* yaml

* test

* check area exists

* check area exists

* lint fixes

* assignment tests

* no update of assignment areaId

* assignments docs

* assignment location object

* fix POST area

* tidy up

* filter out unwanted areas

* Add volume to copy host dir to container (#5)

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* eslintrc

* Fix child image response path

* Update answers.module.ts

* Update answers.module.ts

* Update answers.controller.ts

* Update answers.module.ts

* areas

* Update answers.module.ts

* Update answers.module.ts

* Update configuration.ts

* Add S£_BUCKET env var to docker compose

* Change dev bucket to gfw-fw-data-dev

* Revert "Change dev bucket to gfw-fw-data-dev"

This reverts commit f2743a3.

* Change dev bucket to gfw-fw-data-dev

* Add S3 folder env var

* Add logginf to s3 service

* Fix logger on S3 service

* Remove s3 service logging

* Change dev s3 bucket to forest-watcher-files

* Update templates.controller.ts

* geostore

* cors

* docker

* docker

* move response builder to controller

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* delete tmp files

* fix answers tests

* fix watch

* Run linting

* Feature/add template versions (#6)

* Throw not found exception if no template is found with id

* Add editGroupId and isLatest to template schema

* Add /latest endpoint to templates

* Fix tests

* Add tests for template/latest

* Add teardown to test

* Add test for only current user latest templates

* Add endpoint to fetch all versions of a template by group id

* Update lint workflow

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* Make editGroupId and isLatest optional

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <101396989+edward3sc@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix/null type checks (#9)

* Add strict null checking

* Fix null values and null accesses

* Fix more null accesses

* More null access fixes

* Fix test container

* Fix tests

* Docker fix eslint

* auto commit: apply eslint fixes

* Remove null assertions

* Destructure user from request

* Update ObjectId types

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* routes changes

* team area route endpoint

* fix route sync

* Fix/route sync (#11)

* routes changes

* team area route endpoint

* fix route sync

* auto commit: apply eslint fixes

* fix tests

* remove test string

* remove test string

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Remove all unused imports and declarations (eslint)

* Feature/add sync assignments endpoint (#10)

* Refactor answer create

* Change assignment status if answer is submitted to an assignment

* Add enum for assignment status and fix module dependency issues

* Fix type issues on create answer dto

* auto commit: apply eslint fixes

* Add await to test teardown

* Check if asignment matches the template for answer

* Add tests

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* Fix/team layers (#12)

* routes changes

* team area route endpoint

* fix route sync

* add layers to team object

* docker

* Update routes.e2e.spec.ts

* Fix undefined error on geostore id access (#13)

* Feature/assignments multiple templates (#14)

* routes changes

* team area route endpoint

* fix route sync

* change assignments to handle multiple templates

* docs

* Update assignments.controller.ts

* Update assignments.service.ts

* Update assignments.service.ts

* Update assignments.e2e.spec.ts

* auto commit: apply eslint fixes

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* add team layers

* teams docs

* Fix/fetching geostore with undefined (#15)

* Add common Module and redis service

* Redo some imports in areas and assignments

* Refactor getNameByIdMICROSERVICE

* Fix fetching geostore with undefined

* Add tests for undefined geostore should yield bad request

* Upload file when question type is audio (#16)

* assignments docs

* geostore

* Sentry (#17)

* Sentry

* sample rate

* geostore

* geostore (#18)

* geostore

* geostore

* teams

* fix

* alertType not required

* remove geostore isDefined()

* teams docs

* Change docs yaml ref

* fix assignment location

* Make location optional in create assignment

* Only update assignment status if not already complete (#19)

* Handle completed assignment (#20)

* Only update assignment status if not already complete

* fix failing tests

* Check location/geostore (#22)

* Add check for location or geostore

* tests

* Feature/add edit templates endpoint (#21)

* Add base service

* Add user role enum

* Refactor template delete

* A little bit of refactor in my life

* Refactor template update

* Add object Id

* WIP

* Add update status endpoint

* Remove unused imoprts

* Update tests

* WIP

* Fix tests

* Add endpoints for latest version in a group

* Bring Sentry back again

* Add tests for group id latest endpoint

* Add docs for new endpoint

* More docs

* Add docs for status endpoint

* Add tests for status endpoint

* sentry

* Add editGroupId and isLatest to template response in docs

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* Feature/template areas (#24)

* sentry

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* module imports

* optional notes

* Add AuthUser decorator and replace all request.user instances (#23)

* Add AuthUser decorator and replace all request.user instances

* Change eslint run procedure

* Remove unused imports

* Remove stop containers from eslint.yml

* Add test github workflow

* Install dependencies before test workflow

* assignments docs

* Feature/add public templates endpoint (#25)

* Add public templates endpoint

* Add docs for public templates

* Run workflows on push or pr

* Restore docs

* Add docs for public templates endpoint

* Only run lint and tests on push

* Merge lint and test jobs

* Add tests for public templates endpoint

* Add Templates tag to template endpoints

* docs

* Feature/add template endpoint validation (#26)

* Remove unused helper method

* assignment images and monitor names and templates

* docs

* Fix docs endpoint

* assignment images and monitor names and templates (#27)

* assignment images and monitor names and templates

* patch image

* docker

* docs

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/assignments.controller.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/common/user.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* remove null

* auto commit: apply eslint fixes

* changes

* edit GET /assignments/user

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* throw error on wrong PATCH assignment fields

* tests

* tests

* Fix empty response in docs

* Move validation to assignment controller from service

* assignments fixes

* Add validation to create assignment endpoint

* Fix assignment image upload test

* Fix area delete returns 500

* Feature/add image gallery response (#28)

* Change image response to an array

* Remove console.log

* Add image maximum count field and validation

* Validate maxImageCount is an integer

* Fix tests so that image upload now gives an array response

* Fix repetitive method calls

* delete all assignments

* docs

* Fix docs for assignment response

* Fix docs: add json request to create assignment endpoint

* Fix area not found throws 500

* Fix area 404 thorows 500 error

* Fix assignment create fails when given geostore with form data

* Update docs

* Fix docs to show geostore as JSON string

* Add docs to assigment create endpoint

* Fix file upload extension is wrong

* Move objectIdValidator.pipe.ts

* Fix using .at is not supported

* Add maxImageCount to QuestionModel docs

* Fix docs

* Create pull_request_template.md

* Add alertId to assignment (#30)

* Feature/change template relations to bulk (#29)

* Change create team area relation to bulk

* Change template area relation to bulk

* Fix tests

* Add alertId to docs

* Update docs

* Add assignmentId to answer create docs

* Remove whitelist on input for template

* Fix template patch endpoint

* Fix latest endpoint only returns published versions

* Fix PATCH templates docs

* Fetch area relations on templates by id instead of editGroupId

* Fix GET template area relation using edit group id

* Fix legacy templ;ates without isLatest flag not returning

* Fix yarn docs

* Feature/add area relation on template crud (#31)

* WIP

* Fix test for adding areas on create

* Fix tests for mocking area service methods

* Return existing relation in case of duplicate

* Remove unused import

* Add area relations on update

* Clear all mocks after update template tests

* Persist old area relations on updated template if none given

* Update Docs

* Parse string input values

* Update docs

* Add validation to answer create endpoint

* Fix module imports for templates

* Fix missing assignmentId on answer response

* Change assignment module imports

* Fix userPosition validation on answer create

* Add areaIds to docs example

* Update docs

* Fix route sync is duplicating routes

Mobile sends either the uuid for the route or the mongo id for the created route.
For the mongoid the searchg should be done over _id where as for the
uuid thesearch should be donw over the routeId.

* Update docs

* Default maxImageCount to 5

* Add change status endpoint for assignments

Allow monitors to change from open to on hold and viceversa

* Update docs

* Remove array min size for areaIds on create template

* Update docs

* remove mongodb id restriction on route geostore

* Fix cannot view answers for templates created by monitors

* Delete route when deleted by creator

Delete the route if creator deletes
Set active to false if manager but not creator deletes it
Errors otherwise

* Revert "Delete route when deleted by creator"

This reverts commit 50be16e.

* Revert "Revert "Delete route when deleted by creator""

This reverts commit 5d25bde.

* Add query param to include inactive routes in response

* add username to route response

* docs

* trim string arrays for IsNumberString checks

* tidy up

* DELETE /templates/allAnswers returns all deleted ids

* only return confirmed teams

* only return confirmed teams

* linting

* teams

* delete teams

* fix delete area endpoint

* move endpoints

* small fix

* small fix

* Get only published public templates

* Fix public templates only fetching unpublished

* Fix answer for child question is replaced with parent question answer

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix 500 on undefined template id path param in answers route

* area fixes

* area fixes

* changes

* conflicts

* Fix mandatory validation for update areas

* Remove update area fields mandatory validation

* Update tests

* teams changes

* docs

* answers and assignment permissions

* cache control

* cache control

* debug

* debug

* debug

* debug

* debug

* debug

* tidy up

* team members

* assignment area filter

* fix

* fix

* assignments created by team members

* fix

* permissions

* tests

* permissions

* tests

* auto commit: apply eslint fixes

* change template id

* change template id

* refresh

* force delete

* user areas for assignments

* app assignment permissions

* fix

* remove tests

* auto commit: apply eslint fixes

* delete templates

* tidy up

* comments

* Update answers.module.ts

---------

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>
Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>
edward3sc added a commit that referenced this pull request Mar 16, 2023
* fix POST area

* tidy up

* filter out unwanted areas

* Add volume to copy host dir to container (#5)

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* eslintrc

* Fix child image response path

* Update answers.module.ts

* Update answers.module.ts

* Update answers.controller.ts

* Update answers.module.ts

* areas

* Update answers.module.ts

* Update answers.module.ts

* Update configuration.ts

* Add S£_BUCKET env var to docker compose

* Change dev bucket to gfw-fw-data-dev

* Revert "Change dev bucket to gfw-fw-data-dev"

This reverts commit f2743a3.

* Change dev bucket to gfw-fw-data-dev

* Add S3 folder env var

* Add logginf to s3 service

* Fix logger on S3 service

* Remove s3 service logging

* Change dev s3 bucket to forest-watcher-files

* Update templates.controller.ts

* geostore

* cors

* docker

* docker

* move response builder to controller

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* delete tmp files

* fix answers tests

* fix watch

* Run linting

* Feature/add template versions (#6)

* Throw not found exception if no template is found with id

* Add editGroupId and isLatest to template schema

* Add /latest endpoint to templates

* Fix tests

* Add tests for template/latest

* Add teardown to test

* Add test for only current user latest templates

* Add endpoint to fetch all versions of a template by group id

* Update lint workflow

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* Make editGroupId and isLatest optional

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <101396989+edward3sc@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix/null type checks (#9)

* Add strict null checking

* Fix null values and null accesses

* Fix more null accesses

* More null access fixes

* Fix test container

* Fix tests

* Docker fix eslint

* auto commit: apply eslint fixes

* Remove null assertions

* Destructure user from request

* Update ObjectId types

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* routes changes

* team area route endpoint

* fix route sync

* Fix/route sync (#11)

* routes changes

* team area route endpoint

* fix route sync

* auto commit: apply eslint fixes

* fix tests

* remove test string

* remove test string

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Remove all unused imports and declarations (eslint)

* Feature/add sync assignments endpoint (#10)

* Refactor answer create

* Change assignment status if answer is submitted to an assignment

* Add enum for assignment status and fix module dependency issues

* Fix type issues on create answer dto

* auto commit: apply eslint fixes

* Add await to test teardown

* Check if asignment matches the template for answer

* Add tests

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* Fix/team layers (#12)

* routes changes

* team area route endpoint

* fix route sync

* add layers to team object

* docker

* Update routes.e2e.spec.ts

* Fix undefined error on geostore id access (#13)

* Feature/assignments multiple templates (#14)

* routes changes

* team area route endpoint

* fix route sync

* change assignments to handle multiple templates

* docs

* Update assignments.controller.ts

* Update assignments.service.ts

* Update assignments.service.ts

* Update assignments.e2e.spec.ts

* auto commit: apply eslint fixes

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* add team layers

* teams docs

* Fix/fetching geostore with undefined (#15)

* Add common Module and redis service

* Redo some imports in areas and assignments

* Refactor getNameByIdMICROSERVICE

* Fix fetching geostore with undefined

* Add tests for undefined geostore should yield bad request

* Upload file when question type is audio (#16)

* assignments docs

* geostore

* Sentry (#17)

* Sentry

* sample rate

* geostore

* geostore (#18)

* geostore

* geostore

* teams

* fix

* alertType not required

* remove geostore isDefined()

* teams docs

* Change docs yaml ref

* fix assignment location

* Make location optional in create assignment

* Only update assignment status if not already complete (#19)

* Handle completed assignment (#20)

* Only update assignment status if not already complete

* fix failing tests

* Check location/geostore (#22)

* Add check for location or geostore

* tests

* Feature/add edit templates endpoint (#21)

* Add base service

* Add user role enum

* Refactor template delete

* A little bit of refactor in my life

* Refactor template update

* Add object Id

* WIP

* Add update status endpoint

* Remove unused imoprts

* Update tests

* WIP

* Fix tests

* Add endpoints for latest version in a group

* Bring Sentry back again

* Add tests for group id latest endpoint

* Add docs for new endpoint

* More docs

* Add docs for status endpoint

* Add tests for status endpoint

* sentry

* Add editGroupId and isLatest to template response in docs

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* Feature/template areas (#24)

* sentry

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* module imports

* optional notes

* Add AuthUser decorator and replace all request.user instances (#23)

* Add AuthUser decorator and replace all request.user instances

* Change eslint run procedure

* Remove unused imports

* Remove stop containers from eslint.yml

* Add test github workflow

* Install dependencies before test workflow

* assignments docs

* Feature/add public templates endpoint (#25)

* Add public templates endpoint

* Add docs for public templates

* Run workflows on push or pr

* Restore docs

* Add docs for public templates endpoint

* Only run lint and tests on push

* Merge lint and test jobs

* Add tests for public templates endpoint

* Add Templates tag to template endpoints

* docs

* Feature/add template endpoint validation (#26)

* Remove unused helper method

* assignment images and monitor names and templates

* docs

* Fix docs endpoint

* assignment images and monitor names and templates (#27)

* assignment images and monitor names and templates

* patch image

* docker

* docs

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/assignments.controller.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/common/user.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* remove null

* auto commit: apply eslint fixes

* changes

* edit GET /assignments/user

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* throw error on wrong PATCH assignment fields

* tests

* tests

* Fix empty response in docs

* Move validation to assignment controller from service

* assignments fixes

* Add validation to create assignment endpoint

* Fix assignment image upload test

* Fix area delete returns 500

* Feature/add image gallery response (#28)

* Change image response to an array

* Remove console.log

* Add image maximum count field and validation

* Validate maxImageCount is an integer

* Fix tests so that image upload now gives an array response

* Fix repetitive method calls

* delete all assignments

* docs

* Fix docs for assignment response

* Fix docs: add json request to create assignment endpoint

* Fix area not found throws 500

* Fix area 404 thorows 500 error

* Fix assignment create fails when given geostore with form data

* Update docs

* Fix docs to show geostore as JSON string

* Add docs to assigment create endpoint

* Fix file upload extension is wrong

* Move objectIdValidator.pipe.ts

* Fix using .at is not supported

* Add maxImageCount to QuestionModel docs

* Fix docs

* Create pull_request_template.md

* Add alertId to assignment (#30)

* Feature/change template relations to bulk (#29)

* Change create team area relation to bulk

* Change template area relation to bulk

* Fix tests

* Add alertId to docs

* Update docs

* Add assignmentId to answer create docs

* Remove whitelist on input for template

* Fix template patch endpoint

* Fix latest endpoint only returns published versions

* Fix PATCH templates docs

* Fetch area relations on templates by id instead of editGroupId

* Fix GET template area relation using edit group id

* Fix legacy templ;ates without isLatest flag not returning

* Fix yarn docs

* Feature/add area relation on template crud (#31)

* WIP

* Fix test for adding areas on create

* Fix tests for mocking area service methods

* Return existing relation in case of duplicate

* Remove unused import

* Add area relations on update

* Clear all mocks after update template tests

* Persist old area relations on updated template if none given

* Update Docs

* Parse string input values

* Update docs

* Add validation to answer create endpoint

* Fix module imports for templates

* Fix missing assignmentId on answer response

* Change assignment module imports

* Fix userPosition validation on answer create

* Add areaIds to docs example

* Update docs

* Fix route sync is duplicating routes

Mobile sends either the uuid for the route or the mongo id for the created route.
For the mongoid the searchg should be done over _id where as for the
uuid thesearch should be donw over the routeId.

* Update docs

* Default maxImageCount to 5

* Add change status endpoint for assignments

Allow monitors to change from open to on hold and viceversa

* Update docs

* Remove array min size for areaIds on create template

* Update docs

* remove mongodb id restriction on route geostore

* Fix cannot view answers for templates created by monitors

* Delete route when deleted by creator

Delete the route if creator deletes
Set active to false if manager but not creator deletes it
Errors otherwise

* Revert "Delete route when deleted by creator"

This reverts commit 50be16e.

* Revert "Revert "Delete route when deleted by creator""

This reverts commit 5d25bde.

* Add query param to include inactive routes in response

* add username to route response

* docs

* trim string arrays for IsNumberString checks

* tidy up

* DELETE /templates/allAnswers returns all deleted ids

* only return confirmed teams

* only return confirmed teams

* linting

* teams

* delete teams

* fix delete area endpoint

* move endpoints

* small fix

* small fix

* Get only published public templates

* Fix public templates only fetching unpublished

* Fix answer for child question is replaced with parent question answer

* Dev (#32)

* Delete .env

* Delete .env

* tf

* routes

* tf

* tf

* healthcheck

* remove auth from healthcheck

* debug

* fix colours

* connect to db

* tests

* database names

* endpoint reordering

* debug

* debug

* correct schemas

* microservice token

* remove log

* protect .toString() methods

* return team details

* Fix check on child question type

* area report templates

* docs

* routes docs

* templates and answers docs

* area docs

* relations docs

* teams docs

* fix assignment docs

* assignment status enum

* add username to user on auth

* new assignment and answer endpoint

* assignment status checks

* fix yaml

* yaml

* test

* check area exists

* check area exists

* lint fixes

* assignment tests

* no update of assignment areaId

* assignments docs

* assignment location object

* fix POST area

* tidy up

* filter out unwanted areas

* Add volume to copy host dir to container (#5)

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* eslintrc

* Fix child image response path

* Update answers.module.ts

* Update answers.module.ts

* Update answers.controller.ts

* Update answers.module.ts

* areas

* Update answers.module.ts

* Update answers.module.ts

* Update configuration.ts

* Add S£_BUCKET env var to docker compose

* Change dev bucket to gfw-fw-data-dev

* Revert "Change dev bucket to gfw-fw-data-dev"

This reverts commit f2743a3.

* Change dev bucket to gfw-fw-data-dev

* Add S3 folder env var

* Add logginf to s3 service

* Fix logger on S3 service

* Remove s3 service logging

* Change dev s3 bucket to forest-watcher-files

* Update templates.controller.ts

* geostore

* cors

* docker

* docker

* move response builder to controller

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>

* delete tmp files

* fix answers tests

* fix watch

* Run linting

* Feature/add template versions (#6)

* Throw not found exception if no template is found with id

* Add editGroupId and isLatest to template schema

* Add /latest endpoint to templates

* Fix tests

* Add tests for template/latest

* Add teardown to test

* Add test for only current user latest templates

* Add endpoint to fetch all versions of a template by group id

* Update lint workflow

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* auto commit: apply eslint fixes

* Make editGroupId and isLatest optional

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <101396989+edward3sc@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix/null type checks (#9)

* Add strict null checking

* Fix null values and null accesses

* Fix more null accesses

* More null access fixes

* Fix test container

* Fix tests

* Docker fix eslint

* auto commit: apply eslint fixes

* Remove null assertions

* Destructure user from request

* Update ObjectId types

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* routes changes

* team area route endpoint

* fix route sync

* Fix/route sync (#11)

* routes changes

* team area route endpoint

* fix route sync

* auto commit: apply eslint fixes

* fix tests

* remove test string

* remove test string

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Remove all unused imports and declarations (eslint)

* Feature/add sync assignments endpoint (#10)

* Refactor answer create

* Change assignment status if answer is submitted to an assignment

* Add enum for assignment status and fix module dependency issues

* Fix type issues on create answer dto

* auto commit: apply eslint fixes

* Add await to test teardown

* Check if asignment matches the template for answer

* Add tests

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>

* Fix/team layers (#12)

* routes changes

* team area route endpoint

* fix route sync

* add layers to team object

* docker

* Update routes.e2e.spec.ts

* Fix undefined error on geostore id access (#13)

* Feature/assignments multiple templates (#14)

* routes changes

* team area route endpoint

* fix route sync

* change assignments to handle multiple templates

* docs

* Update assignments.controller.ts

* Update assignments.service.ts

* Update assignments.service.ts

* Update assignments.e2e.spec.ts

* auto commit: apply eslint fixes

Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* add team layers

* teams docs

* Fix/fetching geostore with undefined (#15)

* Add common Module and redis service

* Redo some imports in areas and assignments

* Refactor getNameByIdMICROSERVICE

* Fix fetching geostore with undefined

* Add tests for undefined geostore should yield bad request

* Upload file when question type is audio (#16)

* assignments docs

* geostore

* Sentry (#17)

* Sentry

* sample rate

* geostore

* geostore (#18)

* geostore

* geostore

* teams

* fix

* alertType not required

* remove geostore isDefined()

* teams docs

* Change docs yaml ref

* fix assignment location

* Make location optional in create assignment

* Only update assignment status if not already complete (#19)

* Handle completed assignment (#20)

* Only update assignment status if not already complete

* fix failing tests

* Check location/geostore (#22)

* Add check for location or geostore

* tests

* Feature/add edit templates endpoint (#21)

* Add base service

* Add user role enum

* Refactor template delete

* A little bit of refactor in my life

* Refactor template update

* Add object Id

* WIP

* Add update status endpoint

* Remove unused imoprts

* Update tests

* WIP

* Fix tests

* Add endpoints for latest version in a group

* Bring Sentry back again

* Add tests for group id latest endpoint

* Add docs for new endpoint

* More docs

* Add docs for status endpoint

* Add tests for status endpoint

* sentry

* Add editGroupId and isLatest to template response in docs

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* Feature/template areas (#24)

* sentry

* tests

* docs

* docs

* validator pipe

* error message

* module imports

* module imports

* optional notes

* Add AuthUser decorator and replace all request.user instances (#23)

* Add AuthUser decorator and replace all request.user instances

* Change eslint run procedure

* Remove unused imports

* Remove stop containers from eslint.yml

* Add test github workflow

* Install dependencies before test workflow

* assignments docs

* Feature/add public templates endpoint (#25)

* Add public templates endpoint

* Add docs for public templates

* Run workflows on push or pr

* Restore docs

* Add docs for public templates endpoint

* Only run lint and tests on push

* Merge lint and test jobs

* Add tests for public templates endpoint

* Add Templates tag to template endpoints

* docs

* Feature/add template endpoint validation (#26)

* Remove unused helper method

* assignment images and monitor names and templates

* docs

* Fix docs endpoint

* assignment images and monitor names and templates (#27)

* assignment images and monitor names and templates

* patch image

* docker

* docs

* Update src/assignments/assignments.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/assignments.controller.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/common/user.service.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/models/assignment.schema.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* Update src/assignments/tests/assignments.e2e.spec.ts

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>

* remove null

* auto commit: apply eslint fixes

* changes

* edit GET /assignments/user

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* throw error on wrong PATCH assignment fields

* tests

* tests

* Fix empty response in docs

* Move validation to assignment controller from service

* assignments fixes

* Add validation to create assignment endpoint

* Fix assignment image upload test

* Fix area delete returns 500

* Feature/add image gallery response (#28)

* Change image response to an array

* Remove console.log

* Add image maximum count field and validation

* Validate maxImageCount is an integer

* Fix tests so that image upload now gives an array response

* Fix repetitive method calls

* delete all assignments

* docs

* Fix docs for assignment response

* Fix docs: add json request to create assignment endpoint

* Fix area not found throws 500

* Fix area 404 thorows 500 error

* Fix assignment create fails when given geostore with form data

* Update docs

* Fix docs to show geostore as JSON string

* Add docs to assigment create endpoint

* Fix file upload extension is wrong

* Move objectIdValidator.pipe.ts

* Fix using .at is not supported

* Add maxImageCount to QuestionModel docs

* Fix docs

* Create pull_request_template.md

* Add alertId to assignment (#30)

* Feature/change template relations to bulk (#29)

* Change create team area relation to bulk

* Change template area relation to bulk

* Fix tests

* Add alertId to docs

* Update docs

* Add assignmentId to answer create docs

* Remove whitelist on input for template

* Fix template patch endpoint

* Fix latest endpoint only returns published versions

* Fix PATCH templates docs

* Fetch area relations on templates by id instead of editGroupId

* Fix GET template area relation using edit group id

* Fix legacy templ;ates without isLatest flag not returning

* Fix yarn docs

* Feature/add area relation on template crud (#31)

* WIP

* Fix test for adding areas on create

* Fix tests for mocking area service methods

* Return existing relation in case of duplicate

* Remove unused import

* Add area relations on update

* Clear all mocks after update template tests

* Persist old area relations on updated template if none given

* Update Docs

* Parse string input values

* Update docs

* Add validation to answer create endpoint

* Fix module imports for templates

* Fix missing assignmentId on answer response

* Change assignment module imports

* Fix userPosition validation on answer create

* Add areaIds to docs example

* Update docs

* Fix route sync is duplicating routes

Mobile sends either the uuid for the route or the mongo id for the created route.
For the mongoid the searchg should be done over _id where as for the
uuid thesearch should be donw over the routeId.

* Update docs

* Default maxImageCount to 5

* Add change status endpoint for assignments

Allow monitors to change from open to on hold and viceversa

* Update docs

* Remove array min size for areaIds on create template

* Update docs

* remove mongodb id restriction on route geostore

* Fix cannot view answers for templates created by monitors

* Delete route when deleted by creator

Delete the route if creator deletes
Set active to false if manager but not creator deletes it
Errors otherwise

* Revert "Delete route when deleted by creator"

This reverts commit 50be16e.

* Revert "Revert "Delete route when deleted by creator""

This reverts commit 5d25bde.

* Add query param to include inactive routes in response

* add username to route response

* docs

* trim string arrays for IsNumberString checks

* tidy up

* DELETE /templates/allAnswers returns all deleted ids

* only return confirmed teams

* only return confirmed teams

* linting

* teams

* delete teams

* fix delete area endpoint

* move endpoints

* small fix

* small fix

* Get only published public templates

* Fix public templates only fetching unpublished

* Fix answer for child question is replaced with parent question answer

Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>

* Fix 500 on undefined template id path param in answers route

* area fixes

* area fixes

* changes

* conflicts

* Fix mandatory validation for update areas

* Remove update area fields mandatory validation

* Update tests

* teams changes

* docs

* answers and assignment permissions

* cache control

* cache control

* debug

* debug

* debug

* debug

* debug

* debug

* tidy up

* team members

* assignment area filter

* fix

* fix

* assignments created by team members

* fix

* permissions

* tests

* permissions

* tests

* auto commit: apply eslint fixes

* change template id

* change template id

* refresh

* force delete

* user areas for assignments

* app assignment permissions

* fix

* remove tests

* auto commit: apply eslint fixes

* delete templates

* tidy up

* comments

* Update answers.module.ts

* reports date string

---------

Co-authored-by: Burhanuddin Salim <burhan.salman@gmail.com>
Co-authored-by: Burhanuddin Salim <salim@3sidedcube.com>
Co-authored-by: correcthorsebatterystaple <correcthorsebatterystaple@users.noreply.github.com>
Co-authored-by: edward3sc <edward3sc@users.noreply.github.com>
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