From 36638fbf74cd17477369bc57f421d1851cfabe9a Mon Sep 17 00:00:00 2001 From: Simon Giesel Date: Mon, 17 Jul 2023 20:21:59 +0200 Subject: [PATCH] feat(webapp): add banker login --- server/pb_schema.json | 237 ++++++++++-------- .../components/atoms/AtomCurrencyInput.vue | 15 ++ webapp/src/components/atoms/AtomInput.vue | 7 + .../molecules/MoleculeBankerAuthDialog.vue | 63 +++++ .../molecules/MoleculeInputModal.vue | 8 +- .../molecules/MoleculeNavigationDrawer.vue | 20 +- webapp/src/components/views/ViewBank.vue | 33 ++- webapp/src/services/auth.service.ts | 18 ++ webapp/src/services/company.service.ts | 2 +- webapp/src/types/pocketbase.types.ts | 6 + 10 files changed, 291 insertions(+), 118 deletions(-) create mode 100644 webapp/src/components/molecules/MoleculeBankerAuthDialog.vue diff --git a/server/pb_schema.json b/server/pb_schema.json index b76175b..73aa877 100644 --- a/server/pb_schema.json +++ b/server/pb_schema.json @@ -1,111 +1,4 @@ [ - { - "id": "w85pgrtrmovf916", - "name": "transactions", - "type": "base", - "system": false, - "schema": [ - { - "id": "5aeh5giq", - "name": "account", - "type": "relation", - "system": false, - "required": true, - "options": { - "collectionId": "74ftooxenpeq14b", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [ - "firstName", - "lastName" - ] - } - }, - { - "id": "2bzqyeuk", - "name": "label", - "type": "text", - "system": false, - "required": true, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "id": "zsx9i8w7", - "name": "amount", - "type": "number", - "system": false, - "required": false, - "options": { - "min": null, - "max": null - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "", - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "5msnfxat1sc2c1r", - "name": "companyTransactions", - "type": "base", - "system": false, - "schema": [ - { - "id": "7rnyupog", - "name": "account", - "type": "relation", - "system": false, - "required": true, - "options": { - "collectionId": "s854d2w72fvyl54", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": [] - } - }, - { - "id": "ruby9fp9", - "name": "label", - "type": "text", - "system": false, - "required": true, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "id": "4hiu46ib", - "name": "amount", - "type": "number", - "system": false, - "required": false, - "options": { - "min": null, - "max": null - } - } - ], - "indexes": [], - "listRule": "", - "viewRule": "", - "createRule": "", - "updateRule": null, - "deleteRule": null, - "options": {} - }, { "id": "s854d2w72fvyl54", "name": "companies", @@ -431,5 +324,135 @@ "updateRule": "(@request.data.id = null && @request.data.accountNumber = null && @request.data.firstName = null && @request.data.lastName = null && @request.data.grade = null && @request.data.created = null && @request.data.updated = null && @request.data.company = null && @request.data.shift = null && @request.data.wage = null) || (@request.data.id = null && @request.data.accountNumber = null && @request.data.firstName = null && @request.data.lastName = null && @request.data.created = null && @request.data.updated = null && @request.data.company = null && @request.auth.id = company.id)", "deleteRule": null, "options": {} + }, + { + "id": "w1au07idupp27qv", + "name": "bankers", + "type": "auth", + "system": false, + "schema": [], + "indexes": [], + "listRule": null, + "viewRule": null, + "createRule": null, + "updateRule": null, + "deleteRule": null, + "options": { + "allowEmailAuth": true, + "allowOAuth2Auth": true, + "allowUsernameAuth": true, + "exceptEmailDomains": null, + "manageRule": null, + "minPasswordLength": 8, + "onlyEmailDomains": null, + "requireEmail": false + } + }, + { + "id": "w85pgrtrmovf916", + "name": "transactions", + "type": "base", + "system": false, + "schema": [ + { + "id": "5aeh5giq", + "name": "account", + "type": "relation", + "system": false, + "required": true, + "options": { + "collectionId": "74ftooxenpeq14b", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": [ + "firstName", + "lastName" + ] + } + }, + { + "id": "2bzqyeuk", + "name": "label", + "type": "text", + "system": false, + "required": true, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "id": "zsx9i8w7", + "name": "amount", + "type": "number", + "system": false, + "required": false, + "options": { + "min": null, + "max": null + } + } + ], + "indexes": [], + "listRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "viewRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "createRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "updateRule": null, + "deleteRule": null, + "options": {} + }, + { + "id": "5msnfxat1sc2c1r", + "name": "companyTransactions", + "type": "base", + "system": false, + "schema": [ + { + "id": "7rnyupog", + "name": "account", + "type": "relation", + "system": false, + "required": true, + "options": { + "collectionId": "s854d2w72fvyl54", + "cascadeDelete": false, + "minSelect": null, + "maxSelect": 1, + "displayFields": [] + } + }, + { + "id": "ruby9fp9", + "name": "label", + "type": "text", + "system": false, + "required": true, + "options": { + "min": null, + "max": null, + "pattern": "" + } + }, + { + "id": "4hiu46ib", + "name": "amount", + "type": "number", + "system": false, + "required": false, + "options": { + "min": null, + "max": null + } + } + ], + "indexes": [], + "listRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "viewRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "createRule": "@request.auth.id != \"\" && @collection.bankers.id ?= @request.auth.id", + "updateRule": null, + "deleteRule": null, + "options": {} } ] \ No newline at end of file diff --git a/webapp/src/components/atoms/AtomCurrencyInput.vue b/webapp/src/components/atoms/AtomCurrencyInput.vue index b5ab8df..ceb2ed6 100644 --- a/webapp/src/components/atoms/AtomCurrencyInput.vue +++ b/webapp/src/components/atoms/AtomCurrencyInput.vue @@ -1,6 +1,7 @@ @@ -22,6 +25,10 @@ defineProps({ type: String, default: '', }, + error: { + type: Boolean, + default: false, + }, }); /* global defineModel */ diff --git a/webapp/src/components/molecules/MoleculeBankerAuthDialog.vue b/webapp/src/components/molecules/MoleculeBankerAuthDialog.vue new file mode 100644 index 0000000..a2da834 --- /dev/null +++ b/webapp/src/components/molecules/MoleculeBankerAuthDialog.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/webapp/src/components/molecules/MoleculeInputModal.vue b/webapp/src/components/molecules/MoleculeInputModal.vue index a36913e..caef746 100644 --- a/webapp/src/components/molecules/MoleculeInputModal.vue +++ b/webapp/src/components/molecules/MoleculeInputModal.vue @@ -8,8 +8,9 @@
{{ inputLabel }}
@@ -40,6 +41,7 @@ import AtomCurrencyInput from '../atoms/AtomCurrencyInput.vue'; import AtomModal from '../atoms/AtomModal.vue'; const modal = ref>(); +const input= ref>(); const amount = ref(); defineProps({ @@ -64,7 +66,9 @@ defineProps({ const emit = defineEmits(['submit']); function handleClose() { - amount.value = ''; + if(input.value) { + input.value.reset(); + } } function handleSubmit() { diff --git a/webapp/src/components/molecules/MoleculeNavigationDrawer.vue b/webapp/src/components/molecules/MoleculeNavigationDrawer.vue index 6517d5b..ce84a55 100644 --- a/webapp/src/components/molecules/MoleculeNavigationDrawer.vue +++ b/webapp/src/components/molecules/MoleculeNavigationDrawer.vue @@ -61,6 +61,21 @@
  • ('isAdmin').on(state => (isAdmin.value = state)); +useEventBus('isBanker').on(state => (isBanker.value = state)); useEventBus('hideNavigation').on(state => (hideNavigation.value = state)); onMounted(() => { isAdmin.value = AuthService.isAdmin(); + isBanker.value = AuthService.isBanker(); }); router.afterEach(() => { diff --git a/webapp/src/components/views/ViewBank.vue b/webapp/src/components/views/ViewBank.vue index 3af324f..f059821 100644 --- a/webapp/src/components/views/ViewBank.vue +++ b/webapp/src/components/views/ViewBank.vue @@ -1,5 +1,8 @@