@hed-hog/contact 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contact.module.d.ts +3 -0
- package/dist/contact.module.d.ts.map +1 -0
- package/dist/contact.module.js +61 -0
- package/dist/contact.module.js.map +1 -0
- package/dist/contact.service.d.ts +28 -0
- package/dist/contact.service.d.ts.map +1 -0
- package/dist/contact.service.js +212 -0
- package/dist/contact.service.js.map +1 -0
- package/dist/emails/index.d.ts +3 -0
- package/dist/emails/index.d.ts.map +1 -0
- package/dist/emails/index.js +19 -0
- package/dist/emails/index.js.map +1 -0
- package/dist/emails/lib.d.ts +3 -0
- package/dist/emails/lib.d.ts.map +1 -0
- package/dist/emails/lib.js +18 -0
- package/dist/emails/lib.js.map +1 -0
- package/dist/emails/templates.d.ts +13 -0
- package/dist/emails/templates.d.ts.map +1 -0
- package/dist/emails/templates.js +37 -0
- package/dist/emails/templates.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/person/dto/create.dto.d.ts +7 -0
- package/dist/person/dto/create.dto.d.ts.map +1 -0
- package/dist/person/dto/create.dto.js +35 -0
- package/dist/person/dto/create.dto.js.map +1 -0
- package/dist/person/dto/update.dto.d.ts +6 -0
- package/dist/person/dto/update.dto.d.ts.map +1 -0
- package/dist/person/dto/update.dto.js +9 -0
- package/dist/person/dto/update.dto.js.map +1 -0
- package/dist/person/person-address/dto/create.dto.d.ts +14 -0
- package/dist/person/person-address/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-address/dto/create.dto.js +65 -0
- package/dist/person/person-address/dto/create.dto.js.map +1 -0
- package/dist/person/person-address/dto/update.dto.d.ts +6 -0
- package/dist/person/person-address/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-address/dto/update.dto.js +9 -0
- package/dist/person/person-address/dto/update.dto.js.map +1 -0
- package/dist/person/person-address/person-address.controller.d.ts +14 -0
- package/dist/person/person-address/person-address.controller.d.ts.map +1 -0
- package/dist/person/person-address/person-address.controller.js +92 -0
- package/dist/person/person-address/person-address.controller.js.map +1 -0
- package/dist/person/person-address/person-address.service.d.ts +16 -0
- package/dist/person/person-address/person-address.service.d.ts.map +1 -0
- package/dist/person/person-address/person-address.service.js +71 -0
- package/dist/person/person-address/person-address.service.js.map +1 -0
- package/dist/person/person-contact/dto/create.dto.d.ts +6 -0
- package/dist/person/person-contact/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-contact/dto/create.dto.js +30 -0
- package/dist/person/person-contact/dto/create.dto.js.map +1 -0
- package/dist/person/person-contact/dto/update.dto.d.ts +6 -0
- package/dist/person/person-contact/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-contact/dto/update.dto.js +9 -0
- package/dist/person/person-contact/dto/update.dto.js.map +1 -0
- package/dist/person/person-contact/person-contact.controller.d.ts +14 -0
- package/dist/person/person-contact/person-contact.controller.d.ts.map +1 -0
- package/dist/person/person-contact/person-contact.controller.js +92 -0
- package/dist/person/person-contact/person-contact.controller.js.map +1 -0
- package/dist/person/person-contact/person-contact.service.d.ts +16 -0
- package/dist/person/person-contact/person-contact.service.d.ts.map +1 -0
- package/dist/person/person-contact/person-contact.service.js +71 -0
- package/dist/person/person-contact/person-contact.service.js.map +1 -0
- package/dist/person/person-custom/dto/create.dto.d.ts +6 -0
- package/dist/person/person-custom/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-custom/dto/create.dto.js +27 -0
- package/dist/person/person-custom/dto/create.dto.js.map +1 -0
- package/dist/person/person-custom/dto/update.dto.d.ts +6 -0
- package/dist/person/person-custom/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-custom/dto/update.dto.js +9 -0
- package/dist/person/person-custom/dto/update.dto.js.map +1 -0
- package/dist/person/person-custom/person-custom.controller.d.ts +13 -0
- package/dist/person/person-custom/person-custom.controller.d.ts.map +1 -0
- package/dist/person/person-custom/person-custom.controller.js +83 -0
- package/dist/person/person-custom/person-custom.controller.js.map +1 -0
- package/dist/person/person-custom/person-custom.service.d.ts +20 -0
- package/dist/person/person-custom/person-custom.service.d.ts.map +1 -0
- package/dist/person/person-custom/person-custom.service.js +71 -0
- package/dist/person/person-custom/person-custom.service.js.map +1 -0
- package/dist/person/person-document/dto/create.dto.d.ts +9 -0
- package/dist/person/person-document/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-document/dto/create.dto.js +44 -0
- package/dist/person/person-document/dto/create.dto.js.map +1 -0
- package/dist/person/person-document/dto/update.dto.d.ts +6 -0
- package/dist/person/person-document/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-document/dto/update.dto.js +9 -0
- package/dist/person/person-document/dto/update.dto.js.map +1 -0
- package/dist/person/person-document/person-document.controller.d.ts +14 -0
- package/dist/person/person-document/person-document.controller.d.ts.map +1 -0
- package/dist/person/person-document/person-document.controller.js +92 -0
- package/dist/person/person-document/person-document.controller.js.map +1 -0
- package/dist/person/person-document/person-document.service.d.ts +16 -0
- package/dist/person/person-document/person-document.service.d.ts.map +1 -0
- package/dist/person/person-document/person-document.service.js +71 -0
- package/dist/person/person-document/person-document.service.js.map +1 -0
- package/dist/person/person-user/dto/create.dto.d.ts +4 -0
- package/dist/person/person-user/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-user/dto/create.dto.js +21 -0
- package/dist/person/person-user/dto/create.dto.js.map +1 -0
- package/dist/person/person-user/dto/update.dto.d.ts +6 -0
- package/dist/person/person-user/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-user/dto/update.dto.js +9 -0
- package/dist/person/person-user/dto/update.dto.js.map +1 -0
- package/dist/person/person-user/person-user.controller.d.ts +14 -0
- package/dist/person/person-user/person-user.controller.d.ts.map +1 -0
- package/dist/person/person-user/person-user.controller.js +92 -0
- package/dist/person/person-user/person-user.controller.js.map +1 -0
- package/dist/person/person-user/person-user.service.d.ts +16 -0
- package/dist/person/person-user/person-user.service.d.ts.map +1 -0
- package/dist/person/person-user/person-user.service.js +71 -0
- package/dist/person/person-user/person-user.service.js.map +1 -0
- package/dist/person/person-value/dto/create.dto.d.ts +4 -0
- package/dist/person/person-value/dto/create.dto.d.ts.map +1 -0
- package/dist/person/person-value/dto/create.dto.js +21 -0
- package/dist/person/person-value/dto/create.dto.js.map +1 -0
- package/dist/person/person-value/dto/update.dto.d.ts +6 -0
- package/dist/person/person-value/dto/update.dto.d.ts.map +1 -0
- package/dist/person/person-value/dto/update.dto.js +9 -0
- package/dist/person/person-value/dto/update.dto.js.map +1 -0
- package/dist/person/person-value/person-value.controller.d.ts +14 -0
- package/dist/person/person-value/person-value.controller.d.ts.map +1 -0
- package/dist/person/person-value/person-value.controller.js +92 -0
- package/dist/person/person-value/person-value.controller.js.map +1 -0
- package/dist/person/person-value/person-value.service.d.ts +16 -0
- package/dist/person/person-value/person-value.service.d.ts.map +1 -0
- package/dist/person/person-value/person-value.service.js +71 -0
- package/dist/person/person-value/person-value.service.js.map +1 -0
- package/dist/person/person.controller.d.ts +14 -0
- package/dist/person/person.controller.d.ts.map +1 -0
- package/dist/person/person.controller.js +89 -0
- package/dist/person/person.controller.js.map +1 -0
- package/dist/person/person.module.d.ts +3 -0
- package/dist/person/person.module.d.ts.map +1 -0
- package/dist/person/person.module.js +59 -0
- package/dist/person/person.module.js.map +1 -0
- package/dist/person/person.service.d.ts +19 -0
- package/dist/person/person.service.d.ts.map +1 -0
- package/dist/person/person.service.js +78 -0
- package/dist/person/person.service.js.map +1 -0
- package/dist/person-address-type/dto/create.dto.d.ts +5 -0
- package/dist/person-address-type/dto/create.dto.d.ts.map +1 -0
- package/dist/person-address-type/dto/create.dto.js +22 -0
- package/dist/person-address-type/dto/create.dto.js.map +1 -0
- package/dist/person-address-type/dto/update.dto.d.ts +6 -0
- package/dist/person-address-type/dto/update.dto.d.ts.map +1 -0
- package/dist/person-address-type/dto/update.dto.js +9 -0
- package/dist/person-address-type/dto/update.dto.js.map +1 -0
- package/dist/person-address-type/person-address-type.controller.d.ts +14 -0
- package/dist/person-address-type/person-address-type.controller.d.ts.map +1 -0
- package/dist/person-address-type/person-address-type.controller.js +91 -0
- package/dist/person-address-type/person-address-type.controller.js.map +1 -0
- package/dist/person-address-type/person-address-type.enum.d.ts +10 -0
- package/dist/person-address-type/person-address-type.enum.d.ts.map +1 -0
- package/dist/person-address-type/person-address-type.enum.js +14 -0
- package/dist/person-address-type/person-address-type.enum.js.map +1 -0
- package/dist/person-address-type/person-address-type.module.d.ts +3 -0
- package/dist/person-address-type/person-address-type.module.d.ts.map +1 -0
- package/dist/person-address-type/person-address-type.module.js +31 -0
- package/dist/person-address-type/person-address-type.module.js.map +1 -0
- package/dist/person-address-type/person-address-type.service.d.ts +23 -0
- package/dist/person-address-type/person-address-type.service.d.ts.map +1 -0
- package/dist/person-address-type/person-address-type.service.js +62 -0
- package/dist/person-address-type/person-address-type.service.js.map +1 -0
- package/dist/person-contact-type/dto/create.dto.d.ts +5 -0
- package/dist/person-contact-type/dto/create.dto.d.ts.map +1 -0
- package/dist/person-contact-type/dto/create.dto.js +22 -0
- package/dist/person-contact-type/dto/create.dto.js.map +1 -0
- package/dist/person-contact-type/dto/update.dto.d.ts +6 -0
- package/dist/person-contact-type/dto/update.dto.d.ts.map +1 -0
- package/dist/person-contact-type/dto/update.dto.js +9 -0
- package/dist/person-contact-type/dto/update.dto.js.map +1 -0
- package/dist/person-contact-type/person-contact-type.controller.d.ts +14 -0
- package/dist/person-contact-type/person-contact-type.controller.d.ts.map +1 -0
- package/dist/person-contact-type/person-contact-type.controller.js +91 -0
- package/dist/person-contact-type/person-contact-type.controller.js.map +1 -0
- package/dist/person-contact-type/person-contact-type.enum.d.ts +8 -0
- package/dist/person-contact-type/person-contact-type.enum.d.ts.map +1 -0
- package/dist/person-contact-type/person-contact-type.enum.js +12 -0
- package/dist/person-contact-type/person-contact-type.enum.js.map +1 -0
- package/dist/person-contact-type/person-contact-type.module.d.ts +3 -0
- package/dist/person-contact-type/person-contact-type.module.d.ts.map +1 -0
- package/dist/person-contact-type/person-contact-type.module.js +31 -0
- package/dist/person-contact-type/person-contact-type.module.js.map +1 -0
- package/dist/person-contact-type/person-contact-type.service.d.ts +23 -0
- package/dist/person-contact-type/person-contact-type.service.d.ts.map +1 -0
- package/dist/person-contact-type/person-contact-type.service.js +62 -0
- package/dist/person-contact-type/person-contact-type.service.js.map +1 -0
- package/dist/person-custom-type/dto/create.dto.d.ts +5 -0
- package/dist/person-custom-type/dto/create.dto.d.ts.map +1 -0
- package/dist/person-custom-type/dto/create.dto.js +22 -0
- package/dist/person-custom-type/dto/create.dto.js.map +1 -0
- package/dist/person-custom-type/dto/update.dto.d.ts +6 -0
- package/dist/person-custom-type/dto/update.dto.d.ts.map +1 -0
- package/dist/person-custom-type/dto/update.dto.js +9 -0
- package/dist/person-custom-type/dto/update.dto.js.map +1 -0
- package/dist/person-custom-type/person-custom-type.controller.d.ts +14 -0
- package/dist/person-custom-type/person-custom-type.controller.d.ts.map +1 -0
- package/dist/person-custom-type/person-custom-type.controller.js +91 -0
- package/dist/person-custom-type/person-custom-type.controller.js.map +1 -0
- package/dist/person-custom-type/person-custom-type.module.d.ts +3 -0
- package/dist/person-custom-type/person-custom-type.module.d.ts.map +1 -0
- package/dist/person-custom-type/person-custom-type.module.js +31 -0
- package/dist/person-custom-type/person-custom-type.module.js.map +1 -0
- package/dist/person-custom-type/person-custom-type.service.d.ts +23 -0
- package/dist/person-custom-type/person-custom-type.service.d.ts.map +1 -0
- package/dist/person-custom-type/person-custom-type.service.js +62 -0
- package/dist/person-custom-type/person-custom-type.service.js.map +1 -0
- package/dist/person-document-type/dto/create.dto.d.ts +6 -0
- package/dist/person-document-type/dto/create.dto.d.ts.map +1 -0
- package/dist/person-document-type/dto/create.dto.js +26 -0
- package/dist/person-document-type/dto/create.dto.js.map +1 -0
- package/dist/person-document-type/dto/update.dto.d.ts +6 -0
- package/dist/person-document-type/dto/update.dto.d.ts.map +1 -0
- package/dist/person-document-type/dto/update.dto.js +9 -0
- package/dist/person-document-type/dto/update.dto.js.map +1 -0
- package/dist/person-document-type/person-document-type.controller.d.ts +14 -0
- package/dist/person-document-type/person-document-type.controller.d.ts.map +1 -0
- package/dist/person-document-type/person-document-type.controller.js +91 -0
- package/dist/person-document-type/person-document-type.controller.js.map +1 -0
- package/dist/person-document-type/person-document-type.enum.d.ts +8 -0
- package/dist/person-document-type/person-document-type.enum.d.ts.map +1 -0
- package/dist/person-document-type/person-document-type.enum.js +12 -0
- package/dist/person-document-type/person-document-type.enum.js.map +1 -0
- package/dist/person-document-type/person-document-type.module.d.ts +3 -0
- package/dist/person-document-type/person-document-type.module.d.ts.map +1 -0
- package/dist/person-document-type/person-document-type.module.js +31 -0
- package/dist/person-document-type/person-document-type.module.js.map +1 -0
- package/dist/person-document-type/person-document-type.service.d.ts +23 -0
- package/dist/person-document-type/person-document-type.service.d.ts.map +1 -0
- package/dist/person-document-type/person-document-type.service.js +62 -0
- package/dist/person-document-type/person-document-type.service.js.map +1 -0
- package/dist/person-type/dto/create.dto.d.ts +5 -0
- package/dist/person-type/dto/create.dto.d.ts.map +1 -0
- package/dist/person-type/dto/create.dto.js +22 -0
- package/dist/person-type/dto/create.dto.js.map +1 -0
- package/dist/person-type/dto/update.dto.d.ts +6 -0
- package/dist/person-type/dto/update.dto.d.ts.map +1 -0
- package/dist/person-type/dto/update.dto.js +9 -0
- package/dist/person-type/dto/update.dto.js.map +1 -0
- package/dist/person-type/person-type.controller.d.ts +14 -0
- package/dist/person-type/person-type.controller.d.ts.map +1 -0
- package/dist/person-type/person-type.controller.js +91 -0
- package/dist/person-type/person-type.controller.js.map +1 -0
- package/dist/person-type/person-type.enum.d.ts +6 -0
- package/dist/person-type/person-type.enum.d.ts.map +1 -0
- package/dist/person-type/person-type.enum.js +10 -0
- package/dist/person-type/person-type.enum.js.map +1 -0
- package/dist/person-type/person-type.module.d.ts +3 -0
- package/dist/person-type/person-type.module.d.ts.map +1 -0
- package/dist/person-type/person-type.module.js +31 -0
- package/dist/person-type/person-type.module.js.map +1 -0
- package/dist/person-type/person-type.service.d.ts +23 -0
- package/dist/person-type/person-type.service.d.ts.map +1 -0
- package/dist/person-type/person-type.service.js +62 -0
- package/dist/person-type/person-type.service.js.map +1 -0
- package/hedhog/data/menu.yaml +87 -0
- package/hedhog/data/person_address_type.yaml +28 -0
- package/hedhog/data/person_contact_type.yaml +20 -0
- package/hedhog/data/person_document_type.yaml +35 -0
- package/hedhog/data/person_type.yaml +12 -0
- package/hedhog/data/route.yaml +213 -0
- package/hedhog/data/screen.yaml +96 -0
- package/hedhog/table/person.yaml +38 -0
- package/hedhog/table/person_address.yaml +85 -0
- package/hedhog/table/person_address_type.yaml +14 -0
- package/hedhog/table/person_contact.yaml +34 -0
- package/hedhog/table/person_contact_type.yaml +14 -0
- package/hedhog/table/person_custom.yaml +30 -0
- package/hedhog/table/person_custom_type.yaml +14 -0
- package/hedhog/table/person_document.yaml +55 -0
- package/hedhog/table/person_document_type.yaml +23 -0
- package/hedhog/table/person_type.yaml +15 -0
- package/hedhog/table/person_user.yaml +18 -0
- package/hedhog/table/person_value.yaml +16 -0
- package/package.json +40 -0
- package/src/contact.module.ts +50 -0
- package/src/contact.service.ts +228 -0
- package/src/emails/index.ts +2 -0
- package/src/emails/lib.ts +17 -0
- package/src/emails/templates.ts +41 -0
- package/src/index.ts +18 -0
- package/src/person/dto/create.dto.ts +17 -0
- package/src/person/dto/update.dto.ts +4 -0
- package/src/person/person-address/dto/create.dto.ts +40 -0
- package/src/person/person-address/dto/update.dto.ts +4 -0
- package/src/person/person-address/person-address.controller.ts +68 -0
- package/src/person/person-address/person-address.service.ts +80 -0
- package/src/person/person-contact/dto/create.dto.ts +13 -0
- package/src/person/person-contact/dto/update.dto.ts +4 -0
- package/src/person/person-contact/person-contact.controller.ts +68 -0
- package/src/person/person-contact/person-contact.service.ts +79 -0
- package/src/person/person-custom/dto/create.dto.ts +11 -0
- package/src/person/person-custom/dto/update.dto.ts +4 -0
- package/src/person/person-custom/person-custom.controller.ts +62 -0
- package/src/person/person-custom/person-custom.service.ts +88 -0
- package/src/person/person-document/dto/create.dto.ts +24 -0
- package/src/person/person-document/dto/update.dto.ts +4 -0
- package/src/person/person-document/person-document.controller.ts +68 -0
- package/src/person/person-document/person-document.service.ts +79 -0
- package/src/person/person-user/dto/create.dto.ts +6 -0
- package/src/person/person-user/dto/update.dto.ts +4 -0
- package/src/person/person-user/person-user.controller.ts +68 -0
- package/src/person/person-user/person-user.service.ts +79 -0
- package/src/person/person-value/dto/create.dto.ts +6 -0
- package/src/person/person-value/dto/update.dto.ts +4 -0
- package/src/person/person-value/person-value.controller.ts +68 -0
- package/src/person/person-value/person-value.service.ts +79 -0
- package/src/person/person.controller.ts +55 -0
- package/src/person/person.module.ts +45 -0
- package/src/person/person.service.ts +83 -0
- package/src/person-address-type/dto/create.dto.ts +7 -0
- package/src/person-address-type/dto/update.dto.ts +4 -0
- package/src/person-address-type/person-address-type.controller.ts +55 -0
- package/src/person-address-type/person-address-type.enum.ts +15 -0
- package/src/person-address-type/person-address-type.module.ts +18 -0
- package/src/person-address-type/person-address-type.service.ts +72 -0
- package/src/person-contact-type/dto/create.dto.ts +7 -0
- package/src/person-contact-type/dto/update.dto.ts +4 -0
- package/src/person-contact-type/person-contact-type.controller.ts +55 -0
- package/src/person-contact-type/person-contact-type.enum.ts +11 -0
- package/src/person-contact-type/person-contact-type.module.ts +18 -0
- package/src/person-contact-type/person-contact-type.service.ts +72 -0
- package/src/person-custom-type/dto/create.dto.ts +7 -0
- package/src/person-custom-type/dto/update.dto.ts +4 -0
- package/src/person-custom-type/person-custom-type.controller.ts +55 -0
- package/src/person-custom-type/person-custom-type.module.ts +18 -0
- package/src/person-custom-type/person-custom-type.service.ts +72 -0
- package/src/person-document-type/dto/create.dto.ts +10 -0
- package/src/person-document-type/dto/update.dto.ts +4 -0
- package/src/person-document-type/person-document-type.controller.ts +55 -0
- package/src/person-document-type/person-document-type.enum.ts +11 -0
- package/src/person-document-type/person-document-type.module.ts +18 -0
- package/src/person-document-type/person-document-type.service.ts +72 -0
- package/src/person-type/dto/create.dto.ts +7 -0
- package/src/person-type/dto/update.dto.ts +4 -0
- package/src/person-type/person-type.controller.ts +55 -0
- package/src/person-type/person-type.enum.ts +7 -0
- package/src/person-type/person-type.module.ts +18 -0
- package/src/person-type/person-type.service.ts +72 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
2
|
+
import { Role } from '@hed-hog/api';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
Inject,
|
|
13
|
+
forwardRef
|
|
14
|
+
} from '@nestjs/common';
|
|
15
|
+
import { PersonDocumentService } from './person-document.service';
|
|
16
|
+
import { CreateDTO } from './dto/create.dto';
|
|
17
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
18
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
19
|
+
|
|
20
|
+
@Role()
|
|
21
|
+
@Controller('person/:personId/person-document')
|
|
22
|
+
export class PersonDocumentController {
|
|
23
|
+
constructor(
|
|
24
|
+
@Inject(forwardRef(() => PersonDocumentService))
|
|
25
|
+
private readonly personDocumentService: PersonDocumentService
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
@Post()
|
|
29
|
+
create(
|
|
30
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
31
|
+
@Body() data: CreateDTO
|
|
32
|
+
) {
|
|
33
|
+
return this.personDocumentService.create(personId, data);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Get()
|
|
37
|
+
list(
|
|
38
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
39
|
+
@Pagination() paginationParams
|
|
40
|
+
) {
|
|
41
|
+
return this.personDocumentService.list(paginationParams, personId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Get(':id')
|
|
45
|
+
get(
|
|
46
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
47
|
+
@Param('id', ParseIntPipe) id: number
|
|
48
|
+
) {
|
|
49
|
+
return this.personDocumentService.get(personId, id);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Patch(':id')
|
|
53
|
+
update(
|
|
54
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
55
|
+
@Param('id', ParseIntPipe) id: number,
|
|
56
|
+
@Body() data: UpdateDTO
|
|
57
|
+
) {
|
|
58
|
+
return this.personDocumentService.update(personId, id, data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Delete()
|
|
62
|
+
delete(
|
|
63
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
64
|
+
@Body() { ids }: DeleteDTO
|
|
65
|
+
) {
|
|
66
|
+
return this.personDocumentService.delete(personId, { ids });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PaginationService, PaginationDTO } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import {
|
|
4
|
+
Injectable,
|
|
5
|
+
NotFoundException,
|
|
6
|
+
BadRequestException
|
|
7
|
+
} from '@nestjs/common';
|
|
8
|
+
import { CreateDTO } from './dto/create.dto';
|
|
9
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
10
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class PersonDocumentService {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly prismaService: PrismaService,
|
|
16
|
+
private readonly paginationService: PaginationService
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
async create(personId: number, data: CreateDTO) {
|
|
20
|
+
return this.prismaService.person_document.create({
|
|
21
|
+
data: {
|
|
22
|
+
person_id: personId,
|
|
23
|
+
...data
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(personId: number, id: number) {
|
|
29
|
+
return this.prismaService.person_document.findFirst({
|
|
30
|
+
where: {
|
|
31
|
+
person_id: personId,
|
|
32
|
+
id: id
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async list(paginationParams: PaginationDTO, personId?: number) {
|
|
38
|
+
const where: any = {};
|
|
39
|
+
if (personId !== undefined) where.person_id = personId;
|
|
40
|
+
|
|
41
|
+
return this.paginationService.paginate(
|
|
42
|
+
this.prismaService.person_document,
|
|
43
|
+
{
|
|
44
|
+
fields: 'primary,value,issued_at,expiry_at',
|
|
45
|
+
...paginationParams
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
where
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async update(personId: number, id: number, data: UpdateDTO) {
|
|
54
|
+
return this.prismaService.person_document.updateMany({
|
|
55
|
+
where: {
|
|
56
|
+
person_id: personId,
|
|
57
|
+
id: id
|
|
58
|
+
},
|
|
59
|
+
data
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async delete(personId: number, { ids }: DeleteDTO) {
|
|
64
|
+
if (ids == undefined || ids == null) {
|
|
65
|
+
throw new BadRequestException(
|
|
66
|
+
'You must select at least one item to delete.'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return this.prismaService.person_document.deleteMany({
|
|
71
|
+
where: {
|
|
72
|
+
person_id: personId,
|
|
73
|
+
id: {
|
|
74
|
+
in: ids
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
2
|
+
import { Role } from '@hed-hog/api';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
Inject,
|
|
13
|
+
forwardRef
|
|
14
|
+
} from '@nestjs/common';
|
|
15
|
+
import { PersonUserService } from './person-user.service';
|
|
16
|
+
import { CreateDTO } from './dto/create.dto';
|
|
17
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
18
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
19
|
+
|
|
20
|
+
@Role()
|
|
21
|
+
@Controller('person/:personId/person-user')
|
|
22
|
+
export class PersonUserController {
|
|
23
|
+
constructor(
|
|
24
|
+
@Inject(forwardRef(() => PersonUserService))
|
|
25
|
+
private readonly personUserService: PersonUserService
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
@Post()
|
|
29
|
+
create(
|
|
30
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
31
|
+
@Body() data: CreateDTO
|
|
32
|
+
) {
|
|
33
|
+
return this.personUserService.create(personId, data);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Get()
|
|
37
|
+
list(
|
|
38
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
39
|
+
@Pagination() paginationParams
|
|
40
|
+
) {
|
|
41
|
+
return this.personUserService.list(paginationParams, personId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Get(':id')
|
|
45
|
+
get(
|
|
46
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
47
|
+
@Param('id', ParseIntPipe) id: number
|
|
48
|
+
) {
|
|
49
|
+
return this.personUserService.get(personId, id);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Patch(':id')
|
|
53
|
+
update(
|
|
54
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
55
|
+
@Param('id', ParseIntPipe) id: number,
|
|
56
|
+
@Body() data: UpdateDTO
|
|
57
|
+
) {
|
|
58
|
+
return this.personUserService.update(personId, id, data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Delete()
|
|
62
|
+
delete(
|
|
63
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
64
|
+
@Body() { ids }: DeleteDTO
|
|
65
|
+
) {
|
|
66
|
+
return this.personUserService.delete(personId, { ids });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PaginationService, PaginationDTO } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import {
|
|
4
|
+
Injectable,
|
|
5
|
+
NotFoundException,
|
|
6
|
+
BadRequestException
|
|
7
|
+
} from '@nestjs/common';
|
|
8
|
+
import { CreateDTO } from './dto/create.dto';
|
|
9
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
10
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class PersonUserService {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly prismaService: PrismaService,
|
|
16
|
+
private readonly paginationService: PaginationService
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
async create(personId: number, data: CreateDTO) {
|
|
20
|
+
return this.prismaService.person_user.create({
|
|
21
|
+
data: {
|
|
22
|
+
person_id: personId,
|
|
23
|
+
...data
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(personId: number, id: number) {
|
|
29
|
+
return this.prismaService.person_user.findFirst({
|
|
30
|
+
where: {
|
|
31
|
+
person_id: personId,
|
|
32
|
+
id: id
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async list(paginationParams: PaginationDTO, personId?: number) {
|
|
38
|
+
const where: any = {};
|
|
39
|
+
if (personId !== undefined) where.person_id = personId;
|
|
40
|
+
|
|
41
|
+
return this.paginationService.paginate(
|
|
42
|
+
this.prismaService.person_user,
|
|
43
|
+
{
|
|
44
|
+
fields: '',
|
|
45
|
+
...paginationParams
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
where
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async update(personId: number, id: number, data: UpdateDTO) {
|
|
54
|
+
return this.prismaService.person_user.updateMany({
|
|
55
|
+
where: {
|
|
56
|
+
person_id: personId,
|
|
57
|
+
id: id
|
|
58
|
+
},
|
|
59
|
+
data
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async delete(personId: number, { ids }: DeleteDTO) {
|
|
64
|
+
if (ids == undefined || ids == null) {
|
|
65
|
+
throw new BadRequestException(
|
|
66
|
+
'You must select at least one item to delete.'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return this.prismaService.person_user.deleteMany({
|
|
71
|
+
where: {
|
|
72
|
+
person_id: personId,
|
|
73
|
+
id: {
|
|
74
|
+
in: ids
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
2
|
+
import { Role } from '@hed-hog/api';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
Inject,
|
|
13
|
+
forwardRef
|
|
14
|
+
} from '@nestjs/common';
|
|
15
|
+
import { PersonValueService } from './person-value.service';
|
|
16
|
+
import { CreateDTO } from './dto/create.dto';
|
|
17
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
18
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
19
|
+
|
|
20
|
+
@Role()
|
|
21
|
+
@Controller('person/:personId/person-value')
|
|
22
|
+
export class PersonValueController {
|
|
23
|
+
constructor(
|
|
24
|
+
@Inject(forwardRef(() => PersonValueService))
|
|
25
|
+
private readonly personValueService: PersonValueService
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
@Post()
|
|
29
|
+
create(
|
|
30
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
31
|
+
@Body() data: CreateDTO
|
|
32
|
+
) {
|
|
33
|
+
return this.personValueService.create(personId, data);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Get()
|
|
37
|
+
list(
|
|
38
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
39
|
+
@Pagination() paginationParams
|
|
40
|
+
) {
|
|
41
|
+
return this.personValueService.list(paginationParams, personId);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Get(':id')
|
|
45
|
+
get(
|
|
46
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
47
|
+
@Param('id', ParseIntPipe) id: number
|
|
48
|
+
) {
|
|
49
|
+
return this.personValueService.get(personId, id);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Patch(':id')
|
|
53
|
+
update(
|
|
54
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
55
|
+
@Param('id', ParseIntPipe) id: number,
|
|
56
|
+
@Body() data: UpdateDTO
|
|
57
|
+
) {
|
|
58
|
+
return this.personValueService.update(personId, id, data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Delete()
|
|
62
|
+
delete(
|
|
63
|
+
@Param('personId', ParseIntPipe) personId: number,
|
|
64
|
+
@Body() { ids }: DeleteDTO
|
|
65
|
+
) {
|
|
66
|
+
return this.personValueService.delete(personId, { ids });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PaginationService, PaginationDTO } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import {
|
|
4
|
+
Injectable,
|
|
5
|
+
NotFoundException,
|
|
6
|
+
BadRequestException
|
|
7
|
+
} from '@nestjs/common';
|
|
8
|
+
import { CreateDTO } from './dto/create.dto';
|
|
9
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
10
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class PersonValueService {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly prismaService: PrismaService,
|
|
16
|
+
private readonly paginationService: PaginationService
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
async create(personId: number, data: CreateDTO) {
|
|
20
|
+
return this.prismaService.person_value.create({
|
|
21
|
+
data: {
|
|
22
|
+
person_id: personId,
|
|
23
|
+
...data
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(personId: number, id: number) {
|
|
29
|
+
return this.prismaService.person_value.findFirst({
|
|
30
|
+
where: {
|
|
31
|
+
person_id: personId,
|
|
32
|
+
id: id
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async list(paginationParams: PaginationDTO, personId?: number) {
|
|
38
|
+
const where: any = {};
|
|
39
|
+
if (personId !== undefined) where.person_id = personId;
|
|
40
|
+
|
|
41
|
+
return this.paginationService.paginate(
|
|
42
|
+
this.prismaService.person_value,
|
|
43
|
+
{
|
|
44
|
+
fields: 'value',
|
|
45
|
+
...paginationParams
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
where
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async update(personId: number, id: number, data: UpdateDTO) {
|
|
54
|
+
return this.prismaService.person_value.updateMany({
|
|
55
|
+
where: {
|
|
56
|
+
person_id: personId,
|
|
57
|
+
id: id
|
|
58
|
+
},
|
|
59
|
+
data
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async delete(personId: number, { ids }: DeleteDTO) {
|
|
64
|
+
if (ids == undefined || ids == null) {
|
|
65
|
+
throw new BadRequestException(
|
|
66
|
+
'You must select at least one item to delete.'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return this.prismaService.person_value.deleteMany({
|
|
71
|
+
where: {
|
|
72
|
+
person_id: personId,
|
|
73
|
+
id: {
|
|
74
|
+
in: ids
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Pagination } from '@hed-hog/api-pagination';
|
|
2
|
+
import { Locale } from '@hed-hog/api-locale';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Inject,
|
|
9
|
+
Param,
|
|
10
|
+
ParseIntPipe,
|
|
11
|
+
Patch,
|
|
12
|
+
Post,
|
|
13
|
+
forwardRef
|
|
14
|
+
} from '@nestjs/common';
|
|
15
|
+
import { CreateDTO } from './dto/create.dto';
|
|
16
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
17
|
+
import { PersonService } from './person.service';
|
|
18
|
+
import { Role, DeleteDTO } from '@hed-hog/api';
|
|
19
|
+
|
|
20
|
+
@Role()
|
|
21
|
+
@Controller('person')
|
|
22
|
+
export class PersonController {
|
|
23
|
+
constructor(
|
|
24
|
+
@Inject(forwardRef(() => PersonService))
|
|
25
|
+
private readonly personService: PersonService
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
@Get()
|
|
29
|
+
async list(@Pagination() paginationParams) {
|
|
30
|
+
return this.personService.list(paginationParams);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Get(':id')
|
|
34
|
+
async get(@Param('id', ParseIntPipe) id: number) {
|
|
35
|
+
return this.personService.get(id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Post()
|
|
39
|
+
async create(@Body() data: CreateDTO) {
|
|
40
|
+
return this.personService.create(data);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Patch(':id')
|
|
44
|
+
async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
|
|
45
|
+
return this.personService.update({
|
|
46
|
+
id,
|
|
47
|
+
data
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Delete()
|
|
52
|
+
async delete(@Body() data: DeleteDTO) {
|
|
53
|
+
return this.personService.delete(data);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AdminModule } from "@hed-hog/admin";
|
|
2
|
+
import { PaginationModule } from "@hed-hog/api-pagination";
|
|
3
|
+
import { PrismaModule } from "@hed-hog/api-prisma";
|
|
4
|
+
import { forwardRef, Module } from "@nestjs/common";
|
|
5
|
+
import { PersonValueController } from "./person-value/person-value.controller";
|
|
6
|
+
import { PersonValueService } from "./person-value/person-value.service";
|
|
7
|
+
import { PersonAddressController } from "./person-address/person-address.controller";
|
|
8
|
+
import { PersonAddressService } from "./person-address/person-address.service";
|
|
9
|
+
import { PersonContactController } from "./person-contact/person-contact.controller";
|
|
10
|
+
import { PersonContactService } from "./person-contact/person-contact.service";
|
|
11
|
+
import { PersonDocumentController } from "./person-document/person-document.controller";
|
|
12
|
+
import { PersonDocumentService } from "./person-document/person-document.service";
|
|
13
|
+
import { PersonCustomController } from "./person-custom/person-custom.controller";
|
|
14
|
+
import { PersonCustomService } from "./person-custom/person-custom.service";
|
|
15
|
+
import { PersonUserController } from "./person-user/person-user.controller";
|
|
16
|
+
import { PersonUserService } from "./person-user/person-user.service";
|
|
17
|
+
import { PersonController } from "./person.controller";
|
|
18
|
+
import { PersonService } from "./person.service";
|
|
19
|
+
@Module({
|
|
20
|
+
imports: [
|
|
21
|
+
forwardRef(() => AdminModule),
|
|
22
|
+
forwardRef(() => PrismaModule),
|
|
23
|
+
forwardRef(() => PaginationModule),
|
|
24
|
+
],
|
|
25
|
+
controllers: [
|
|
26
|
+
PersonValueController,
|
|
27
|
+
PersonAddressController,
|
|
28
|
+
PersonContactController,
|
|
29
|
+
PersonDocumentController,
|
|
30
|
+
PersonCustomController,
|
|
31
|
+
PersonUserController,
|
|
32
|
+
PersonController,
|
|
33
|
+
],
|
|
34
|
+
providers: [
|
|
35
|
+
PersonValueService,
|
|
36
|
+
PersonAddressService,
|
|
37
|
+
PersonContactService,
|
|
38
|
+
PersonDocumentService,
|
|
39
|
+
PersonCustomService,
|
|
40
|
+
PersonUserService,
|
|
41
|
+
PersonService,
|
|
42
|
+
],
|
|
43
|
+
exports: [forwardRef(() => PersonService)],
|
|
44
|
+
})
|
|
45
|
+
export class PersonModule {}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { DeleteDTO } from '@hed-hog/api';
|
|
2
|
+
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
3
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
|
+
import {
|
|
5
|
+
BadRequestException,
|
|
6
|
+
Inject,
|
|
7
|
+
Injectable,
|
|
8
|
+
forwardRef,
|
|
9
|
+
} from '@nestjs/common';
|
|
10
|
+
import { CreateDTO } from './dto/create.dto';
|
|
11
|
+
import { UpdateDTO } from './dto/update.dto';
|
|
12
|
+
|
|
13
|
+
@Injectable()
|
|
14
|
+
export class PersonService {
|
|
15
|
+
constructor(
|
|
16
|
+
@Inject(forwardRef(() => PrismaService))
|
|
17
|
+
private readonly prismaService: PrismaService,
|
|
18
|
+
@Inject(forwardRef(() => PaginationService))
|
|
19
|
+
private readonly paginationService: PaginationService,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
async list(paginationParams: PaginationDTO) {
|
|
23
|
+
const fields = ['name'];
|
|
24
|
+
const OR: any[] = this.prismaService.createInsensitiveSearch(
|
|
25
|
+
fields,
|
|
26
|
+
paginationParams,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (paginationParams.search && !isNaN(+paginationParams.search)) {
|
|
30
|
+
OR.push({ id: { equals: +paginationParams.search } });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.paginationService.paginate(
|
|
34
|
+
this.prismaService.person,
|
|
35
|
+
paginationParams,
|
|
36
|
+
{
|
|
37
|
+
where: {
|
|
38
|
+
OR,
|
|
39
|
+
},
|
|
40
|
+
include: {
|
|
41
|
+
person_address: true,
|
|
42
|
+
person_contact: true,
|
|
43
|
+
person_document: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async get(id: number) {
|
|
50
|
+
return this.prismaService.person.findUnique({
|
|
51
|
+
where: { id: id },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async create(data: CreateDTO) {
|
|
56
|
+
return this.prismaService.person.create({
|
|
57
|
+
data,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async update({ id, data }: { id: number; data: UpdateDTO }) {
|
|
62
|
+
return this.prismaService.person.update({
|
|
63
|
+
where: { id: id },
|
|
64
|
+
data,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async delete({ ids }: DeleteDTO) {
|
|
69
|
+
if (ids == undefined || ids == null) {
|
|
70
|
+
throw new BadRequestException(
|
|
71
|
+
'You must select at least one item to delete.',
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return this.prismaService.person.deleteMany({
|
|
76
|
+
where: {
|
|
77
|
+
id: {
|
|
78
|
+
in: ids,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|