Compare commits
100 commits
Author | SHA1 | Date | |
---|---|---|---|
0080728610 | |||
a0cb25106d | |||
49cb4e4d23 | |||
da78c17235 | |||
7904a98d5f | |||
1ee94b48ba | |||
12bf239085 | |||
c35a549100 | |||
357c27861b | |||
a09c75a998 | |||
a332e4d779 | |||
c984d1ef2f | |||
6263b410c6 | |||
c787761335 | |||
eb9139dbd0 | |||
08a893aa0e | |||
a5bd9ec114 | |||
b196f684e7 | |||
e4f6b095df | |||
0539ae9f9a | |||
34a0a35d40 | |||
c02cc81ad6 | |||
80b083f1aa | |||
f4747e3d53 | |||
2f5c59b598 | |||
1006a2b1c1 | |||
ad2232969f | |||
2e69f87578 | |||
8b08dda934 | |||
465663a7e9 | |||
4d454f24da | |||
311a34f4b9 | |||
db1d830a2e | |||
3f3ad9ca58 | |||
2ce56a49bb | |||
872e6ef9fe | |||
e8a10091af | |||
b39e2233e8 | |||
c3e8b6b53b | |||
b336329966 | |||
a24ee9fc4a | |||
d7275ac9eb | |||
0d6103170a | |||
542a77fbef | |||
6330ebd01d | |||
fc01263c4e | |||
a73c712626 | |||
2cee8b5119 | |||
ee60f497fa | |||
0f621ac46d | |||
0468a4f331 | |||
1d9970fc56 | |||
29be563942 | |||
fc694aa976 | |||
0994274c0c | |||
9a1f4a2985 | |||
e17eb30aed | |||
668d8448da | |||
0b7de992c8 | |||
b7b6694407 | |||
a91b723f04 | |||
5701313228 | |||
f78097b616 | |||
6ae463a784 | |||
f245ff74a8 | |||
f89483f878 | |||
07f8e2dbcb | |||
4378c02d17 | |||
7c08251ff6 | |||
7a3a8a9d87 | |||
3165eb789f | |||
ebe587756a | |||
684c24e4fd | |||
46ad96c470 | |||
b678067874 | |||
eb78934959 | |||
1ab4d93d2b | |||
b55d0554e4 | |||
21cf811a56 | |||
ff651b7d8f | |||
d9132e472b | |||
c661a588c5 | |||
3beeec38f9 | |||
3d8f1da059 | |||
bbfdc69049 | |||
a165231c47 | |||
313785b4ac | |||
0b40b9d92c | |||
d3870b4c8d | |||
ba2155d7c3 | |||
07d31bfe7d | |||
4568bef10e | |||
36ecccd0dc | |||
3f0549bd44 | |||
ca6dbafaf1 | |||
26d2f288e9 | |||
3e256dc2f7 | |||
bf5aec351c | |||
0bbe22e9ae | |||
9734149848 |
287 changed files with 7008 additions and 3232 deletions
45
.env.example
45
.env.example
|
@ -1,22 +1,47 @@
|
|||
DB_TYPE = (mysql|sqlite|...)
|
||||
DB_PORT = number
|
||||
DB_TYPE = (mysql|sqlite|postgres) # default ist mysql
|
||||
|
||||
## BSP für mysql
|
||||
DB_PORT = 3306
|
||||
DB_HOST = database_host
|
||||
DB_NAME = database_name
|
||||
DB_USERNAME = database_username
|
||||
DB_PASSWORD = database_password
|
||||
|
||||
## BSP für postgres
|
||||
DB_PORT = 5432
|
||||
DB_HOST = database_host
|
||||
DB_NAME = database_name
|
||||
DB_USERNAME = database_username
|
||||
DB_PASSWORD = database_password
|
||||
|
||||
## BSP für sqlite
|
||||
DB_HOST = filename.db
|
||||
|
||||
SERVER_PORT = portnumber
|
||||
|
||||
JWT_SECRET = ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
|
||||
JWT_EXPIRATION = [0-9]*(y|d|h|m|s)
|
||||
REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s)
|
||||
PWA_REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s)
|
||||
JWT_SECRET = ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 # besitzt default
|
||||
JWT_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 15m
|
||||
REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 1d
|
||||
PWA_REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 5d
|
||||
|
||||
MAIL_USERNAME = mail_username
|
||||
MAIL_PASSWORD = mail_password
|
||||
MAIL_HOST = mail_hoststring
|
||||
MAIL_PORT = mail_portnumber
|
||||
MAIL_SECURE (true|false) // true for port 465, fals for other ports
|
||||
MAIL_PORT = mail_portnumber # default ist 587
|
||||
MAIL_SECURE = (true|false) # true für port 465, false für anders gewählten port
|
||||
|
||||
CLUB_NAME = clubname
|
||||
CLUB_WEBSITE = https://my-club-website-url
|
||||
CLUB_NAME = clubname #default FF Admin
|
||||
CLUB_WEBSITE = https://my-club-website-url #optional, muss aber mit http:// oder https:// beginnen
|
||||
|
||||
BACKUP_INTERVAL = number of days (min 1) # default 1
|
||||
BACKUP_COPIES = number of parallel copies # default 7
|
||||
BACKUP_AUTO_RESTORE = (true|false) # default ist true
|
||||
|
||||
USE_SECURITY_STRICT_LIMIT = (true|false) # default ist true
|
||||
SECURITY_STRICT_LIMIT_WINDOW = [0-9]*(y|d|h|m|s) # default ist 15m
|
||||
SECURITY_STRICT_LIMIT_REQUEST_COUNT = strict_request_count # default ist 15
|
||||
USE_SECURITY_LIMIT = (true|false) # default ist true
|
||||
SECURITY_LIMIT_WINDOW = [0-9]*(y|d|h|m|s) # default ist 1m
|
||||
SECURITY_LIMIT_REQUEST_COUNT = request_count # default ist 500
|
||||
|
||||
TRUST_PROXY = <boolean|number|ip|ip1,ip2,...> # wenn leer, wird dieser Wert nicht angewendet.
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -133,3 +133,4 @@ dist
|
|||
files
|
||||
|
||||
.idea
|
||||
*.db
|
|
@ -32,7 +32,7 @@ RUN apk add --no-cache \
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir -p /app/export
|
||||
RUN mkdir -p /app/files
|
||||
|
||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||
|
||||
|
|
123
LICENSE
123
LICENSE
|
@ -1,29 +1,25 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
|
@ -31,30 +27,31 @@ TERMS AND CONDITIONS
|
|||
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
|
@ -82,13 +79,13 @@ You may convey a work based on the Program, or the modifications to produce it f
|
|||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
@ -105,9 +102,9 @@ You may convey a covered work in object code form under the terms of sections 4
|
|||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
|
@ -116,7 +113,7 @@ The requirement to provide Installation Information does not include a requireme
|
|||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
|
@ -134,13 +131,14 @@ Notwithstanding any other provision of this License, for material you add to a c
|
|||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
@ -150,54 +148,67 @@ Moreover, your license from a particular copyright holder is reinstated permanen
|
|||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
@ -206,27 +217,19 @@ How to Apply These Terms to Your New Programs
|
|||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
member-administration-server
|
||||
Copyright (C) 2024 Ehrenamt
|
||||
ff-admin-server
|
||||
Copyright (C) 2025 FF Admin by JK Effects
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
member-administration-server Copyright (C) 2024 Ehrenamt
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
|
|
36
README.md
36
README.md
|
@ -20,13 +20,13 @@ Um den Container hochzufahren, erstellen Sie eine `docker-compose.yml` Datei mit
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
ff-ff-admin-server:
|
||||
ff-admin-server:
|
||||
image: docker.registry.jk-effects.cloud/ehrenamt/ff-admin/server:latest
|
||||
container_name: ff_member_administration_server
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- DB_TYPE=<mysql|sqlite> # default ist auf mysql gesetzt
|
||||
- DB_HOST=ffm-db
|
||||
- DB_TYPE=<mysql|sqlite|postgres> # default ist auf mysql gesetzt
|
||||
- DB_HOST=ff-db
|
||||
- DB_PORT=<number> # default ist auf 3306 gesetzt
|
||||
- DB_NAME=ffadmin
|
||||
- DB_USERNAME=administration_backend
|
||||
|
@ -38,10 +38,20 @@ services:
|
|||
- MAIL_USERNAME=<mailadress|username>
|
||||
- MAIL_PASSWORD=<password>
|
||||
- MAIL_HOST=<url>
|
||||
- MAIL_PORT=<port> # default ist auf 578 gesetzt
|
||||
- MAIL_PORT=<port> # default ist auf 587 gesetzt
|
||||
- MAIL_SECURE=<boolean> # default ist auf false gesetzt
|
||||
- CLUB_NAME=<tobemodified>
|
||||
- CLUB_NAME=<tobemodified> # default ist auf FF Admin gesetzt
|
||||
- CLUB_WEBSITE=<tobemodified>
|
||||
- BACKUP_INTERVAL=<number of days (min. 1)> # alle x Tage, sonst keine
|
||||
- BACKUP_COPIES=<number of parallel copies> # Anzahl parallel bestehender Backups
|
||||
- BACKUP_AUTO_RESTORE=<boolean> # default ist auf true gesetzt
|
||||
- USE_SECURITY_STRICT_LIMIT = (true|false) # default ist true
|
||||
- SECURITY_STRICT_LIMIT_WINDOW = [0-9]*(y|d|h|m|s) # default ist 15
|
||||
- SECURITY_STRICT_LIMIT_REQUEST_COUNT = strict_request_count # default ist 15
|
||||
- USE_SECURITY_LIMIT = (true|false) # default ist true
|
||||
- SECURITY_LIMIT_WINDOW = [0-9]*(y|d|h|m|s) # default ist 1m
|
||||
- SECURITY_LIMIT_REQUEST_COUNT = request_count # default ist 500
|
||||
- TRUST_PROXY = <boolean|number|ip|ip1,ip2,...> # wenn leer, wird dieser Wert nicht angewendet.
|
||||
volumes:
|
||||
- <volume|local path>:/app/files
|
||||
networks:
|
||||
|
@ -62,11 +72,27 @@ services:
|
|||
- <volume|local path>:/var/lib/mysql
|
||||
networks:
|
||||
- ff_internal
|
||||
# OR
|
||||
image: postgres:16
|
||||
container_name: ff_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_DB=ffadmin
|
||||
- POSTGRES_USER=administration_backend
|
||||
- POSTGRES_PASSWORD=<dbuserpasswd>
|
||||
volumes:
|
||||
- <volume|local path>:/var/lib/postgresql/data
|
||||
networks:
|
||||
- ff_internal
|
||||
|
||||
networks:
|
||||
ff_internal:
|
||||
```
|
||||
|
||||
Die Verwendung von postgres wird aufgrund des Verhaltens bei Datenbank-Update-Fehlern empfohlen.
|
||||
|
||||
Die Verwendung von SQLite wird nur für die Entwicklung oder lokale Tests empfohlen.
|
||||
|
||||
Führen Sie dann den folgenden Befehl im Verzeichnis der compose-Datei aus, um den Container zu starten:
|
||||
|
||||
```sh
|
||||
|
|
1630
package-lock.json
generated
1630
package-lock.json
generated
File diff suppressed because it is too large
Load diff
18
package.json
18
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ff-admin-server",
|
||||
"version": "1.1.0",
|
||||
"version": "1.3.5",
|
||||
"description": "Feuerwehr/Verein Mitgliederverwaltung Server",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
@ -22,33 +22,47 @@
|
|||
"Feuerwehr"
|
||||
],
|
||||
"author": "JK Effects",
|
||||
"license": "GPL-3.0-only",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^5.0.0-beta.3",
|
||||
"express-rate-limit": "^7.5.0",
|
||||
"express-validator": "^7.2.1",
|
||||
"handlebars": "^4.7.8",
|
||||
"helmet": "^8.0.0",
|
||||
"ics": "^3.8.1",
|
||||
"ip": "^2.0.1",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lodash.uniqby": "^4.7.0",
|
||||
"moment": "^2.30.1",
|
||||
"morgan": "^1.10.0",
|
||||
"ms": "^2.1.3",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql": "^2.18.1",
|
||||
"node-schedule": "^2.1.1",
|
||||
"nodemailer": "^6.9.14",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pg": "^8.13.1",
|
||||
"puppeteer": "^23.11.1",
|
||||
"qrcode": "^1.5.4",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rss-parser": "^3.13.0",
|
||||
"socket.io": "^4.7.5",
|
||||
"speakeasy": "^2.0.0",
|
||||
"sqlite3": "^5.1.7",
|
||||
"typeorm": "^0.3.20",
|
||||
"uuid": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.14",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/ip": "^1.1.3",
|
||||
"@types/jsonwebtoken": "^9.0.6",
|
||||
"@types/lodash.uniqby": "^4.7.9",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"@types/ms": "^0.7.34",
|
||||
"@types/multer": "^1.4.12",
|
||||
"@types/mysql": "^2.15.21",
|
||||
"@types/node": "^16.18.41",
|
||||
"@types/node-schedule": "^2.1.6",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { calendar } from "../../../entity/club/calendar";
|
||||
import { calendarType } from "../../../entity/settings/calendarType";
|
||||
import { calendarType } from "../../../entity/configuration/calendarType";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand";
|
||||
|
||||
|
@ -33,7 +34,7 @@ export default abstract class CalendarCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating calendar", err);
|
||||
throw new DatabaseActionException("CREATE", "calendar", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ export default abstract class CalendarCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating award", err);
|
||||
throw new DatabaseActionException("UPDATE", "calendar", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -90,7 +91,7 @@ export default abstract class CalendarCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting calendar", err);
|
||||
throw new DatabaseActionException("DELETE", "calendar", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export interface CreateCommunicationCommand {
|
||||
preferred: boolean;
|
||||
isSMSAlarming: boolean;
|
||||
isSendNewsletter: boolean;
|
||||
mobile: string;
|
||||
email: string;
|
||||
postalCode: string;
|
||||
|
@ -8,7 +9,7 @@ export interface CreateCommunicationCommand {
|
|||
street: string;
|
||||
streetNumber: number;
|
||||
streetNumberAddition: string;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
typeId: number;
|
||||
}
|
||||
|
||||
|
@ -16,6 +17,7 @@ export interface UpdateCommunicationCommand {
|
|||
id: number;
|
||||
preferred: boolean;
|
||||
isSMSAlarming: boolean;
|
||||
isSendNewsletter: boolean;
|
||||
mobile: string;
|
||||
email: string;
|
||||
postalCode: string;
|
||||
|
@ -23,10 +25,10 @@ export interface UpdateCommunicationCommand {
|
|||
street: string;
|
||||
streetNumber: number;
|
||||
streetNumberAddition: string;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
||||
export interface DeleteCommunicationCommand {
|
||||
id: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { communication } from "../../../entity/club/member/communication";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateCommunicationCommand,
|
||||
|
@ -14,13 +15,17 @@ export default abstract class CommunicationCommandHandler {
|
|||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createCommunication: CreateCommunicationCommand): Promise<number> {
|
||||
let insertId = -1;
|
||||
return await dataSource
|
||||
.transaction(async (manager) => {
|
||||
await manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(communication)
|
||||
.values({
|
||||
preferred: createCommunication.preferred,
|
||||
isSMSAlarming: createCommunication.isSMSAlarming,
|
||||
isSendNewsletter: createCommunication.isSendNewsletter,
|
||||
mobile: createCommunication.mobile,
|
||||
email: createCommunication.email,
|
||||
postalCode: createCommunication.postalCode,
|
||||
|
@ -33,10 +38,24 @@ export default abstract class CommunicationCommandHandler {
|
|||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
insertId = result.identifiers[0].id;
|
||||
});
|
||||
|
||||
await manager
|
||||
.createQueryBuilder()
|
||||
.update(communication)
|
||||
.set({
|
||||
isSendNewsletter: false,
|
||||
})
|
||||
.where("memberId = :memberId", { memberId: createCommunication.memberId })
|
||||
.andWhere("id <> :id", { id: insertId })
|
||||
.execute();
|
||||
})
|
||||
.then(() => {
|
||||
return insertId;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating communication", err);
|
||||
throw new DatabaseActionException("CREATE", "communication", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,11 +66,14 @@ export default abstract class CommunicationCommandHandler {
|
|||
*/
|
||||
static async update(updateCommunication: UpdateCommunicationCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.transaction(async (manager) => {
|
||||
await manager
|
||||
.createQueryBuilder()
|
||||
.update(communication)
|
||||
.set({
|
||||
preferred: updateCommunication.preferred,
|
||||
isSMSAlarming: updateCommunication.isSMSAlarming,
|
||||
isSendNewsletter: updateCommunication.isSendNewsletter,
|
||||
mobile: updateCommunication.mobile,
|
||||
email: updateCommunication.email,
|
||||
postalCode: updateCommunication.postalCode,
|
||||
|
@ -62,10 +84,21 @@ export default abstract class CommunicationCommandHandler {
|
|||
})
|
||||
.where("id = :id", { id: updateCommunication.id })
|
||||
.andWhere("memberId = :memberId", { memberId: updateCommunication.memberId })
|
||||
.execute()
|
||||
.execute();
|
||||
|
||||
await manager
|
||||
.createQueryBuilder()
|
||||
.update(communication)
|
||||
.set({
|
||||
isSendNewsletter: false,
|
||||
})
|
||||
.where("memberId = :memberId", { memberId: updateCommunication.memberId })
|
||||
.andWhere("id <> :id", { id: updateCommunication.id })
|
||||
.execute();
|
||||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating communication", err);
|
||||
throw new DatabaseActionException("UPDATE", "communication", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -84,7 +117,7 @@ export default abstract class CommunicationCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting communication", err);
|
||||
throw new DatabaseActionException("DELETE", "communication", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ export interface CreateMemberAwardCommand {
|
|||
given: boolean;
|
||||
note?: string;
|
||||
date: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
awardId: number;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ export interface UpdateMemberAwardCommand {
|
|||
given: boolean;
|
||||
note?: string;
|
||||
date: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
awardId: number;
|
||||
}
|
||||
|
||||
export interface DeleteMemberAwardCommand {
|
||||
id: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { memberAwards } from "../../../entity/club/member/memberAwards";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand";
|
||||
|
||||
|
@ -26,7 +27,7 @@ export default abstract class MemberAwardCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating memberAward", err);
|
||||
throw new DatabaseActionException("CREATE", "memberAward", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -50,7 +51,7 @@ export default abstract class MemberAwardCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating memberAward", err);
|
||||
throw new DatabaseActionException("UPDATE", "memberAward", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -69,7 +70,7 @@ export default abstract class MemberAwardCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting memberAward", err);
|
||||
throw new DatabaseActionException("DELETE", "memberAward", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { Salutation } from "../../../enums/salutation";
|
||||
|
||||
export interface CreateMemberCommand {
|
||||
salutation: Salutation;
|
||||
salutationId: number;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
nameaffix: string;
|
||||
|
@ -10,8 +8,8 @@ export interface CreateMemberCommand {
|
|||
}
|
||||
|
||||
export interface UpdateMemberCommand {
|
||||
id: number;
|
||||
salutation: Salutation;
|
||||
id: string;
|
||||
salutationId: number;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
nameaffix: string;
|
||||
|
@ -19,11 +17,6 @@ export interface UpdateMemberCommand {
|
|||
internalId?: string;
|
||||
}
|
||||
|
||||
export interface UpdateMemberNewsletterCommand {
|
||||
id: number;
|
||||
communicationId: number;
|
||||
}
|
||||
|
||||
export interface DeleteMemberCommand {
|
||||
id: number;
|
||||
id: string;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { communication } from "../../../entity/club/member/communication";
|
||||
import { member } from "../../../entity/club/member/member";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateMemberCommand,
|
||||
DeleteMemberCommand,
|
||||
UpdateMemberCommand,
|
||||
UpdateMemberNewsletterCommand,
|
||||
} from "./memberCommand";
|
||||
import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand";
|
||||
|
||||
export default abstract class MemberCommandHandler {
|
||||
/**
|
||||
|
@ -21,7 +17,7 @@ export default abstract class MemberCommandHandler {
|
|||
.insert()
|
||||
.into(member)
|
||||
.values({
|
||||
salutation: createMember.salutation,
|
||||
salutationId: createMember.salutationId,
|
||||
firstname: createMember.firstname,
|
||||
lastname: createMember.lastname,
|
||||
nameaffix: createMember.nameaffix,
|
||||
|
@ -33,7 +29,7 @@ export default abstract class MemberCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating member", err);
|
||||
throw new DatabaseActionException("CREATE", "member", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,7 +43,7 @@ export default abstract class MemberCommandHandler {
|
|||
.createQueryBuilder()
|
||||
.update(member)
|
||||
.set({
|
||||
salutation: updateMember.salutation,
|
||||
salutationId: updateMember.salutationId,
|
||||
firstname: updateMember.firstname,
|
||||
lastname: updateMember.lastname,
|
||||
nameaffix: updateMember.nameaffix,
|
||||
|
@ -58,52 +54,7 @@ export default abstract class MemberCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating member", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update member newsletter
|
||||
* @param {UpdateMemberCommand} updateMember
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async updateNewsletter(updateMember: UpdateMemberNewsletterCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(member)
|
||||
.set({
|
||||
sendNewsletter: await dataSource
|
||||
.getRepository(communication)
|
||||
.createQueryBuilder("communication")
|
||||
.where("id = :id", { id: updateMember.communicationId })
|
||||
.andWhere("memberId = :memberId", { memberId: updateMember.id })
|
||||
.getOneOrFail(),
|
||||
})
|
||||
.where("id = :id", { id: updateMember.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating member", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update member newsletter to unset
|
||||
* @param {number} memberId
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async unsetNewsletter(memberId: number): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(member)
|
||||
.set({
|
||||
sendNewsletter: null,
|
||||
})
|
||||
.where("id = :id", { id: memberId })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating member", err);
|
||||
throw new DatabaseActionException("UPDATE", "member", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -121,7 +72,7 @@ export default abstract class MemberCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting member", err);
|
||||
throw new DatabaseActionException("DELETE", "member", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ export interface CreateMemberExecutivePositionCommand {
|
|||
note?: string;
|
||||
start: Date;
|
||||
end?: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
executivePositionId: number;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ export interface UpdateMemberExecutivePositionCommand {
|
|||
note?: string;
|
||||
start: Date;
|
||||
end?: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
executivePositionId: number;
|
||||
}
|
||||
|
||||
export interface DeleteMemberExecutivePositionCommand {
|
||||
id: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateMemberExecutivePositionCommand,
|
||||
|
@ -30,7 +31,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating memberExecutivePosition", err);
|
||||
throw new DatabaseActionException("CREATE", "memberExecutivePosition", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,7 +55,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating memberExecutivePosition", err);
|
||||
throw new DatabaseActionException("UPDATE", "memberExecutivePosition", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -73,7 +74,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting memberExecutivePosition", err);
|
||||
throw new DatabaseActionException("DELETE", "memberExecutivePosition", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export interface CreateMemberQualificationCommand {
|
||||
note?: string;
|
||||
start: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
qualificationId: number;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ export interface UpdateMemberQualificationCommand {
|
|||
start: Date;
|
||||
end?: Date;
|
||||
terminationReason?: string;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
qualificationId: number;
|
||||
}
|
||||
|
||||
export interface DeleteMemberQualificationCommand {
|
||||
id: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { memberQualifications } from "../../../entity/club/member/memberQualifications";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateMemberQualificationCommand,
|
||||
|
@ -29,7 +30,7 @@ export default abstract class MemberQualificationCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating memberQualification", err);
|
||||
throw new DatabaseActionException("CREATE", "memberQualification", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,7 +55,7 @@ export default abstract class MemberQualificationCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating memberQualification", err);
|
||||
throw new DatabaseActionException("UPDATE", "memberQualification", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -73,7 +74,7 @@ export default abstract class MemberQualificationCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting memberQualification", err);
|
||||
throw new DatabaseActionException("DELETE", "memberQualification", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export interface CreateMembershipCommand {
|
||||
start: Date;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
statusId: number;
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,11 @@ export interface UpdateMembershipCommand {
|
|||
start: Date;
|
||||
end?: Date;
|
||||
terminationReason?: string;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
statusId: number;
|
||||
}
|
||||
|
||||
export interface DeleteMembershipCommand {
|
||||
id: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { membership } from "../../../entity/club/member/membership";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand";
|
||||
|
||||
|
@ -43,7 +44,7 @@ export default abstract class MembershipCommandHandler {
|
|||
return insertId;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating membership", err);
|
||||
throw new DatabaseActionException("CREATE", "membership", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -67,7 +68,7 @@ export default abstract class MembershipCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating membership", err);
|
||||
throw new DatabaseActionException("UPDATE", "membership", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -86,7 +87,7 @@ export default abstract class MembershipCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting membership", err);
|
||||
throw new DatabaseActionException("DELETE", "membership", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { newsletter } from "../../../entity/club/newsletter/newsletter";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand";
|
||||
|
||||
|
@ -22,7 +23,7 @@ export default abstract class NewsletterCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating newsletter", err);
|
||||
throw new DatabaseActionException("CREATE", "newsletter", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,7 +48,7 @@ export default abstract class NewsletterCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed synching newsletter", err);
|
||||
throw new DatabaseActionException("SYNC", "newsletter", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -67,7 +68,7 @@ export default abstract class NewsletterCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed setting newsletter send state", err);
|
||||
throw new DatabaseActionException("SET SEND STATE", "newsletter", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
|
|||
import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService";
|
||||
import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand";
|
||||
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class NewsletterDatesCommandHandler {
|
||||
/**
|
||||
|
@ -42,7 +43,7 @@ export default abstract class NewsletterDatesCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed syncing newsletter dates", err);
|
||||
throw new DatabaseActionException("SYNC", "newsletterDates", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export interface SynchronizeNewsletterRecipientsCommand {
|
||||
newsletterId: number;
|
||||
recipients: Array<number>;
|
||||
recipients: Array<string>;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
|
|||
import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService";
|
||||
import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand";
|
||||
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class NewsletterRecipientsCommandHandler {
|
||||
/**
|
||||
|
@ -35,14 +36,14 @@ export default abstract class NewsletterRecipientsCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed syncing newsletter recipients", err);
|
||||
throw new DatabaseActionException("SYNC", "newsletterRecipients", err);
|
||||
});
|
||||
}
|
||||
|
||||
private static async syncPresenceAdd(
|
||||
manager: EntityManager,
|
||||
newsletterId: number,
|
||||
recipients: Array<number>
|
||||
recipients: Array<string>
|
||||
): Promise<InsertResult> {
|
||||
return await manager
|
||||
.createQueryBuilder()
|
||||
|
@ -60,7 +61,7 @@ export default abstract class NewsletterRecipientsCommandHandler {
|
|||
private static async syncPresenceRemove(
|
||||
manager: EntityManager,
|
||||
newsletterId: number,
|
||||
recipients: Array<number>
|
||||
recipients: Array<string>
|
||||
): Promise<DeleteResult> {
|
||||
return await manager
|
||||
.createQueryBuilder()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("CREATE", "protocolAgenda", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,7 @@ export default abstract class ProtocolAgendaCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("SYNC", "protocolAgenda", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { protocol } from "../../../entity/club/protocol/protocol";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand";
|
||||
|
||||
|
@ -23,7 +24,7 @@ export default abstract class ProtocolCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("CREATE", "protocol", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,7 +48,7 @@ export default abstract class ProtocolCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("SYNC", "protocol", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("CREATE", "protocolDecision", err);
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolDecisionCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("SYNC", "protocolDecision", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export interface SynchronizeProtocolPresenceCommand {
|
|||
}
|
||||
|
||||
export interface ProtocolPresenceCommand {
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
absent: boolean;
|
||||
excused: boolean;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { protocolPresence } from "../../../entity/club/protocol/protocolPresence
|
|||
import InternalException from "../../../exceptions/internalException";
|
||||
import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService";
|
||||
import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class ProtocolPresenceCommandHandler {
|
||||
/**
|
||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolPresenceCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving protocol presence", err);
|
||||
throw new DatabaseActionException("SYNC", "protocolSresence", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand";
|
||||
|
||||
|
@ -25,7 +26,7 @@ export default abstract class ProtocolPrintoutCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("CREATE", "protocolPrintout", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("CREATE", "protocolVoting", err);
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
@ -42,7 +43,7 @@ export default abstract class ProtocolVotingCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating protocol", err);
|
||||
throw new DatabaseActionException("SYNC", "protocolVoting", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { award } from "../../../entity/settings/award";
|
||||
import { award } from "../../../entity/configuration/award";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
|
||||
|
||||
|
@ -22,7 +23,7 @@ export default abstract class AwardCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating award", err);
|
||||
throw new DatabaseActionException("CREATE", "award", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,7 @@ export default abstract class AwardCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating award", err);
|
||||
throw new DatabaseActionException("UPDATE", "award", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -60,10 +61,7 @@ export default abstract class AwardCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting award ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "award", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { calendarType } from "../../../entity/settings/calendarType";
|
||||
import { calendarType } from "../../../entity/configuration/calendarType";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand";
|
||||
|
||||
|
@ -25,7 +26,7 @@ export default abstract class CalendarTypeCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating calendarType", err);
|
||||
throw new DatabaseActionException("CREATE", "calendarType", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ export default abstract class CalendarTypeCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating award", err);
|
||||
throw new DatabaseActionException("UPDATE", "calenarType", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -66,10 +67,7 @@ export default abstract class CalendarTypeCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting calendarType${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "calendarType", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { communicationType } from "../../../entity/settings/communicationType";
|
||||
import { communicationType } from "../../../entity/configuration/communicationType";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateCommunicationTypeCommand,
|
||||
|
@ -27,7 +28,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating communicationType", err);
|
||||
throw new DatabaseActionException("CREATE", "communicationType", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating communicationType", err);
|
||||
throw new DatabaseActionException("UPDATE", "communicationType", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -66,12 +67,7 @@ export default abstract class CommunicationTypeCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting communicationType${
|
||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
||||
}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "communicationType", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { executivePosition } from "../../../entity/settings/executivePosition";
|
||||
import { executivePosition } from "../../../entity/configuration/executivePosition";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateExecutivePositionCommand,
|
||||
|
@ -26,7 +27,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating executivePosition", err);
|
||||
throw new DatabaseActionException("DELETE", "executivePosition", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating executivePosition", err);
|
||||
throw new DatabaseActionException("UPDATE", "executivePosition", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,12 +65,7 @@ export default abstract class ExecutivePositionCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting executivePosition${
|
||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
||||
}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "executivePosition", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { membershipStatus } from "../../../entity/settings/membershipStatus";
|
||||
import { membershipStatus } from "../../../entity/configuration/membershipStatus";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateMembershipStatusCommand,
|
||||
|
@ -26,7 +27,7 @@ export default abstract class MembershipStatusCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating membershipStatus", err);
|
||||
throw new DatabaseActionException("CREATING", "membershipStatus", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,7 @@ export default abstract class MembershipStatusCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating membershipStatus", err);
|
||||
throw new DatabaseActionException("UPDATE", "membershipStatus", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,12 +65,7 @@ export default abstract class MembershipStatusCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting membershipStatus${
|
||||
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
|
||||
}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "membershipStatus", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -4,3 +4,7 @@ export interface SetNewsletterConfigCommand {
|
|||
comTypeId: number;
|
||||
config: NewsletterConfigType;
|
||||
}
|
||||
|
||||
export interface DeleteNewsletterConfigCommand {
|
||||
comTypeId: number;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { newsletterConfig } from "../../../entity/configuration/newsletterConfig";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { DeleteNewsletterConfigCommand, SetNewsletterConfigCommand } from "./newsletterConfigCommand";
|
||||
|
||||
export default abstract class NewsletterConfigCommandHandler {
|
||||
/**
|
||||
* @description set newsletterConfig
|
||||
* @param {SetNewsletterConfigCommand} setNewsletterConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async set(setNewsletterConfig: SetNewsletterConfigCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(newsletterConfig)
|
||||
.values({
|
||||
comTypeId: setNewsletterConfig.comTypeId,
|
||||
config: setNewsletterConfig.config,
|
||||
})
|
||||
.orUpdate(["config"], "comTypeId")
|
||||
.execute()
|
||||
.then((result) => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SET", "newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete newsletterConfig
|
||||
* @param {DeleteNewsletterConfigCommand} deleteNewsletterConfig
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deleteNewsletterConfig: DeleteNewsletterConfigCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(newsletterConfig)
|
||||
.where("comTypeId = :comTypeId", { comTypeId: deleteNewsletterConfig.comTypeId })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed setting newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { qualification } from "../../../entity/settings/qualification";
|
||||
import { qualification } from "../../../entity/configuration/qualification";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateQualificationCommand,
|
||||
|
@ -27,7 +28,7 @@ export default abstract class QualificationCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating qualification", err);
|
||||
throw new DatabaseActionException("CREATE", "qualification", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ export default abstract class QualificationCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating qualification", err);
|
||||
throw new DatabaseActionException("UPDATE", "qualification", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -66,10 +67,7 @@ export default abstract class QualificationCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting qualification${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "qualification", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { query } from "../../../entity/settings/query";
|
||||
import { query } from "../../../entity/configuration/query";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default abstract class QueryStoreCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating queryStore", err);
|
||||
throw new DatabaseActionException("CREATE", "queryStore", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -45,7 +46,7 @@ export default abstract class QueryStoreCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating queryStore", err);
|
||||
throw new DatabaseActionException("UPDATE", "queryStore", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -63,10 +64,7 @@ export default abstract class QueryStoreCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting queryStore${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "queryStore", err);
|
||||
});
|
||||
}
|
||||
}
|
12
src/command/configuration/salutation/salutationCommand.ts
Normal file
12
src/command/configuration/salutation/salutationCommand.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface CreateSalutationCommand {
|
||||
salutation: string;
|
||||
}
|
||||
|
||||
export interface UpdateSalutationCommand {
|
||||
id: number;
|
||||
salutation: string;
|
||||
}
|
||||
|
||||
export interface DeleteSalutationCommand {
|
||||
id: number;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { salutation } from "../../../entity/configuration/salutation";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand";
|
||||
|
||||
export default abstract class SalutationCommandHandler {
|
||||
/**
|
||||
* @description create salutation
|
||||
* @param {CreateSalutationCommand} createSalutation
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createSalutation: CreateSalutationCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(salutation)
|
||||
.values({
|
||||
salutation: createSalutation.salutation,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("CREATE", "salutation", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update salutation
|
||||
* @param {UpdateSalutationCommand} updateSalutation
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateSalutation: UpdateSalutationCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(salutation)
|
||||
.set({
|
||||
salutation: updateSalutation.salutation,
|
||||
})
|
||||
.where("id = :id", { id: updateSalutation.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("UPDATE", "salutation", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete salutation
|
||||
* @param {DeleteSalutationCommand} deleteSalutation
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deleteSalutation: DeleteSalutationCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(salutation)
|
||||
.where("id = :id", { id: deleteSalutation.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("DELETE", "salutation", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { template } from "../../../entity/settings/template";
|
||||
import { template } from "../../../entity/configuration/template";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand";
|
||||
|
||||
|
@ -23,7 +24,7 @@ export default abstract class TemplateCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating template", err);
|
||||
throw new DatabaseActionException("CREATE", "template", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +47,7 @@ export default abstract class TemplateCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating template", err);
|
||||
throw new DatabaseActionException("UPDATE", "template", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,10 +65,7 @@ export default abstract class TemplateCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException(
|
||||
`Failed deleting template${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
|
||||
err
|
||||
);
|
||||
throw new DatabaseActionException("DELETE", "template", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { templateUsage } from "../../../entity/settings/templateUsage";
|
||||
import { templateUsage } from "../../../entity/configuration/templateUsage";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
|
||||
|
||||
|
@ -24,7 +25,7 @@ export default abstract class TemplateUsageCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating templateUsage", err);
|
||||
throw new DatabaseActionException("SET", "templateUsage", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { role } from "../../../entity/user/role";
|
||||
import { role } from "../../../entity/management/role";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand";
|
||||
|
||||
|
@ -22,7 +23,7 @@ export default abstract class RoleCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed creating role", err);
|
||||
throw new DatabaseActionException("CREATE", "role", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,7 @@ export default abstract class RoleCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating role", err);
|
||||
throw new DatabaseActionException("UPDATE", "role", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ export default abstract class RoleCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting role", err);
|
||||
throw new DatabaseActionException("DELETE", "role", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
import { DeleteResult, EntityManager, InsertResult } from "typeorm";
|
||||
import { dataSource } from "../../../data-source";
|
||||
import { rolePermission } from "../../../entity/user/role_permission";
|
||||
import { rolePermission } from "../../../entity/management/role_permission";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import RoleService from "../../../service/user/roleService";
|
||||
import RoleService from "../../../service/management/roleService";
|
||||
import {
|
||||
CreateRolePermissionCommand,
|
||||
DeleteRolePermissionCommand,
|
||||
UpdateRolePermissionsCommand,
|
||||
} from "./rolePermissionCommand";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import RolePermissionService from "../../../service/user/rolePermissionService";
|
||||
import RolePermissionService from "../../../service/management/rolePermissionService";
|
||||
import { PermissionString } from "../../../type/permissionTypes";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class RolePermissionCommandHandler {
|
||||
/**
|
||||
|
@ -35,7 +36,7 @@ export default abstract class RolePermissionCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving role permissions", err);
|
||||
throw new DatabaseActionException("UPDATE", "rolePermissions", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -71,46 +72,4 @@ export default abstract class RolePermissionCommandHandler {
|
|||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description grant permission to user
|
||||
* @param {CreateRolePermissionCommand} createPermission
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createPermission: CreateRolePermissionCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(rolePermission)
|
||||
.values({
|
||||
permission: createPermission.permission,
|
||||
role: await RoleService.getById(createPermission.roleId),
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving role permission", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description remove permission from role
|
||||
* @param {DeleteRolePermissionCommand} deletePermission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
static async delete(deletePermission: DeleteRolePermissionCommand): Promise<any> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(rolePermission)
|
||||
.where("roleId = :id", { id: deletePermission.roleId })
|
||||
.andWhere("permission = :permission", { permission: deletePermission.permission })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed role permission removal", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { invite } from "../../../entity/user/invite";
|
||||
import { invite } from "../../../entity/management/invite";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { StringHelper } from "../../../helpers/stringHelper";
|
||||
import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand";
|
||||
|
@ -31,7 +32,7 @@ export default abstract class InviteCommandHandler {
|
|||
return token;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving invite", err);
|
||||
throw new DatabaseActionException("CREATE", "invite", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -50,7 +51,7 @@ export default abstract class InviteCommandHandler {
|
|||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed invite removal", err);
|
||||
throw new DatabaseActionException("DELETE", "invite", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -68,7 +69,7 @@ export default abstract class InviteCommandHandler {
|
|||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed invite removal", err);
|
||||
throw new DatabaseActionException("DELETE", "invite", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ export interface CreateUserCommand {
|
|||
}
|
||||
|
||||
export interface UpdateUserCommand {
|
||||
id: number;
|
||||
id: string;
|
||||
mail: string;
|
||||
username: string;
|
||||
firstname: string;
|
||||
|
@ -16,20 +16,20 @@ export interface UpdateUserCommand {
|
|||
}
|
||||
|
||||
export interface UpdateUserSecretCommand {
|
||||
id: number;
|
||||
id: string;
|
||||
secret: string;
|
||||
}
|
||||
|
||||
export interface TransferUserOwnerCommand {
|
||||
fromId: number;
|
||||
toId: number;
|
||||
fromId: string;
|
||||
toId: string;
|
||||
}
|
||||
|
||||
export interface UpdateUserRolesCommand {
|
||||
id: number;
|
||||
id: string;
|
||||
roleIds: Array<number>;
|
||||
}
|
||||
|
||||
export interface DeleteUserCommand {
|
||||
id: number;
|
||||
id: string;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityManager } from "typeorm";
|
||||
import { dataSource } from "../../../data-source";
|
||||
import { user } from "../../../entity/user/user";
|
||||
import { user } from "../../../entity/management/user";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateUserCommand,
|
||||
|
@ -10,15 +10,16 @@ import {
|
|||
UpdateUserRolesCommand,
|
||||
UpdateUserSecretCommand,
|
||||
} from "./userCommand";
|
||||
import UserService from "../../../service/user/userService";
|
||||
import UserService from "../../../service/management/userService";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class UserCommandHandler {
|
||||
/**
|
||||
* @description create user
|
||||
* @param {CreateUserCommand} createUser
|
||||
* @returns {Promise<number>}
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
static async create(createUser: CreateUserCommand): Promise<number> {
|
||||
static async create(createUser: CreateUserCommand): Promise<string> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
|
@ -36,7 +37,7 @@ export default abstract class UserCommandHandler {
|
|||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving user", err);
|
||||
throw new DatabaseActionException("CREATE", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,7 +60,7 @@ export default abstract class UserCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating user", err);
|
||||
throw new DatabaseActionException("UPDATE", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -79,7 +80,7 @@ export default abstract class UserCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed updating user secret", err);
|
||||
throw new DatabaseActionException("UPDATE", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -105,15 +106,15 @@ export default abstract class UserCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving user roles", err);
|
||||
throw new DatabaseActionException("UPDATE", "userRoles", err);
|
||||
});
|
||||
}
|
||||
|
||||
private static async updateRolesAdd(manager: EntityManager, userId: number, roleId: number): Promise<void> {
|
||||
private static async updateRolesAdd(manager: EntityManager, userId: string, roleId: number): Promise<void> {
|
||||
return await manager.createQueryBuilder().relation(user, "roles").of(userId).add(roleId);
|
||||
}
|
||||
|
||||
private static async updateRolesRemove(manager: EntityManager, userId: number, roleId: number): Promise<void> {
|
||||
private static async updateRolesRemove(manager: EntityManager, userId: string, roleId: number): Promise<void> {
|
||||
return await manager.createQueryBuilder().relation(user, "roles").of(userId).remove(roleId);
|
||||
}
|
||||
|
||||
|
@ -145,7 +146,7 @@ export default abstract class UserCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed transfering ownership", err);
|
||||
throw new DatabaseActionException("ABORT", "transfer owner", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -163,7 +164,7 @@ export default abstract class UserCommandHandler {
|
|||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed deleting user", err);
|
||||
throw new DatabaseActionException("DELETE", "user", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -2,15 +2,15 @@ import { PermissionString } from "../../../type/permissionTypes";
|
|||
|
||||
export interface CreateUserPermissionCommand {
|
||||
permission: PermissionString;
|
||||
userId: number;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface DeleteUserPermissionCommand {
|
||||
permission: PermissionString;
|
||||
userId: number;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface UpdateUserPermissionsCommand {
|
||||
userId: number;
|
||||
userId: string;
|
||||
permissions: Array<PermissionString>;
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
import { DeleteResult, EntityManager, InsertResult } from "typeorm";
|
||||
import { dataSource } from "../../../data-source";
|
||||
import { user } from "../../../entity/user/user";
|
||||
import { userPermission } from "../../../entity/user/user_permission";
|
||||
import { user } from "../../../entity/management/user";
|
||||
import { userPermission } from "../../../entity/management/user_permission";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateUserPermissionCommand,
|
||||
DeleteUserPermissionCommand,
|
||||
UpdateUserPermissionsCommand,
|
||||
} from "./userPermissionCommand";
|
||||
import UserPermissionService from "../../../service/user/userPermissionService";
|
||||
import UserPermissionService from "../../../service/management/userPermissionService";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import { PermissionString } from "../../../type/permissionTypes";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class UserPermissionCommandHandler {
|
||||
/**
|
||||
|
@ -36,13 +37,13 @@ export default abstract class UserPermissionCommandHandler {
|
|||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving user permissions", err);
|
||||
throw new DatabaseActionException("UPDATE", "userPermissions", err);
|
||||
});
|
||||
}
|
||||
|
||||
private static async updatePermissionsAdd(
|
||||
manager: EntityManager,
|
||||
userId: number,
|
||||
userId: string,
|
||||
permissions: Array<PermissionString>
|
||||
): Promise<InsertResult> {
|
||||
return await manager
|
||||
|
@ -61,7 +62,7 @@ export default abstract class UserPermissionCommandHandler {
|
|||
|
||||
private static async updatePermissionsRemove(
|
||||
manager: EntityManager,
|
||||
userId: number,
|
||||
userId: string,
|
||||
permissions: Array<PermissionString>
|
||||
): Promise<DeleteResult> {
|
||||
return await manager
|
||||
|
@ -72,46 +73,4 @@ export default abstract class UserPermissionCommandHandler {
|
|||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||
.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description grant permission to user
|
||||
* @param {CreateUserPermissionCommand} createPermission
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createPermission: CreateUserPermissionCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(userPermission)
|
||||
.values({
|
||||
permission: createPermission.permission,
|
||||
userId: createPermission.userId,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving user permission", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description remove permission to user
|
||||
* @param {DeleteUserPermissionCommand} deletePermission
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
static async delete(deletePermission: DeleteUserPermissionCommand): Promise<any> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(userPermission)
|
||||
.where("userId = :id", { id: deletePermission.userId })
|
||||
.andWhere("permission = :permission", { permission: deletePermission.permission })
|
||||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed user permission removal", err);
|
||||
});
|
||||
}
|
||||
}
|
19
src/command/management/webapi/webapiCommand.ts
Normal file
19
src/command/management/webapi/webapiCommand.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
export interface CreateWebapiCommand {
|
||||
title: string;
|
||||
token: string;
|
||||
expiry?: Date;
|
||||
}
|
||||
|
||||
export interface UpdateWebapiCommand {
|
||||
id: number;
|
||||
title: string;
|
||||
expiry?: Date;
|
||||
}
|
||||
|
||||
export interface UpdateLastUsageWebapiCommand {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface DeleteWebapiCommand {
|
||||
id: number;
|
||||
}
|
95
src/command/management/webapi/webapiCommandHandler.ts
Normal file
95
src/command/management/webapi/webapiCommandHandler.ts
Normal file
|
@ -0,0 +1,95 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { webapi } from "../../../entity/management/webapi";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import {
|
||||
CreateWebapiCommand,
|
||||
DeleteWebapiCommand,
|
||||
UpdateLastUsageWebapiCommand,
|
||||
UpdateWebapiCommand,
|
||||
} from "./webapiCommand";
|
||||
|
||||
export default abstract class WebapiCommandHandler {
|
||||
/**
|
||||
* @description create api
|
||||
* @param {CreateWebapiCommand} createWebapi
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createWebapi: CreateWebapiCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(webapi)
|
||||
.values({
|
||||
token: createWebapi.token,
|
||||
title: createWebapi.title,
|
||||
expiry: createWebapi.expiry,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].token;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("CREATE", "webapi", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update api
|
||||
* @param {UpdateWebapiCommand} updateWebapi
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async update(updateWebapi: UpdateWebapiCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(webapi)
|
||||
.set({
|
||||
title: updateWebapi.title,
|
||||
expiry: updateWebapi.expiry,
|
||||
})
|
||||
.where("id = :id", { id: updateWebapi.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("UPDATE", "webapi", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update api usage
|
||||
* @param {UpdateLastUsageWebapiCommand} updateWebapi
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async updateUsage(updateWebapi: UpdateLastUsageWebapiCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.update(webapi)
|
||||
.set({
|
||||
lastUsage: new Date(),
|
||||
})
|
||||
.where("id = :id", { id: updateWebapi.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("UPDATE", "webapi", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete api
|
||||
* @param {DeleteWebapiCommand} deleteWebapi
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async delete(deleteWebapi: DeleteWebapiCommand): Promise<void> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(webapi)
|
||||
.where("id = :id", { id: deleteWebapi.id })
|
||||
.execute()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("DELETE", "webapi", err);
|
||||
});
|
||||
}
|
||||
}
|
16
src/command/management/webapi/webapiPermissionCommand.ts
Normal file
16
src/command/management/webapi/webapiPermissionCommand.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { PermissionString } from "../../../type/permissionTypes";
|
||||
|
||||
export interface CreateWebapiPermissionCommand {
|
||||
permission: PermissionString;
|
||||
webapiId: number;
|
||||
}
|
||||
|
||||
export interface DeleteWebapiPermissionCommand {
|
||||
permission: PermissionString;
|
||||
webapiId: number;
|
||||
}
|
||||
|
||||
export interface UpdateWebapiPermissionsCommand {
|
||||
webapiId: number;
|
||||
permissions: Array<PermissionString>;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
import { DeleteResult, EntityManager, InsertResult } from "typeorm";
|
||||
import { dataSource } from "../../../data-source";
|
||||
import { webapiPermission } from "../../../entity/management/webapi_permission";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import WebapiService from "../../../service/management/webapiService";
|
||||
import {
|
||||
CreateWebapiPermissionCommand,
|
||||
DeleteWebapiPermissionCommand,
|
||||
UpdateWebapiPermissionsCommand,
|
||||
} from "./webapiPermissionCommand";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import WebapiPermissionService from "../../../service/management/webapiPermissionService";
|
||||
import { PermissionString } from "../../../type/permissionTypes";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
||||
export default abstract class WebapiPermissionCommandHandler {
|
||||
/**
|
||||
* @description update api permissions
|
||||
* @param {UpdateWebapiPermissionsCommand} updateWebapiPermissions
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
static async updatePermissions(updateWebapiPermissions: UpdateWebapiPermissionsCommand): Promise<void> {
|
||||
let currentPermissions = (await WebapiPermissionService.getByApi(updateWebapiPermissions.webapiId)).map(
|
||||
(r) => r.permission
|
||||
);
|
||||
return await dataSource.manager
|
||||
.transaction(async (manager) => {
|
||||
let newPermissions = PermissionHelper.getWhatToAdd(currentPermissions, updateWebapiPermissions.permissions);
|
||||
let removePermissions = PermissionHelper.getWhatToRemove(
|
||||
currentPermissions,
|
||||
updateWebapiPermissions.permissions
|
||||
);
|
||||
if (newPermissions.length != 0) {
|
||||
await this.updatePermissionsAdd(manager, updateWebapiPermissions.webapiId, newPermissions);
|
||||
}
|
||||
if (removePermissions.length != 0) {
|
||||
await this.updatePermissionsRemove(manager, updateWebapiPermissions.webapiId, removePermissions);
|
||||
}
|
||||
})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("UPDATE", "webapiPermission", err);
|
||||
});
|
||||
}
|
||||
|
||||
private static async updatePermissionsAdd(
|
||||
manager: EntityManager,
|
||||
webapiId: number,
|
||||
permissions: Array<PermissionString>
|
||||
): Promise<InsertResult> {
|
||||
return await manager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(webapiPermission)
|
||||
.values(
|
||||
permissions.map((p) => ({
|
||||
permission: p,
|
||||
webapiId: webapiId,
|
||||
}))
|
||||
)
|
||||
.orIgnore()
|
||||
.execute();
|
||||
}
|
||||
|
||||
private static async updatePermissionsRemove(
|
||||
manager: EntityManager,
|
||||
webapiId: number,
|
||||
permissions: Array<PermissionString>
|
||||
): Promise<DeleteResult> {
|
||||
return await manager
|
||||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(webapiPermission)
|
||||
.where("webapiId = :id", { id: webapiId })
|
||||
.andWhere("permission IN (:...permission)", { permission: permissions })
|
||||
.execute();
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
export interface CreateRefreshCommand {
|
||||
userId: number;
|
||||
userId: string;
|
||||
isFromPwa?: boolean;
|
||||
}
|
||||
|
||||
export interface DeleteRefreshCommand {
|
||||
token: string;
|
||||
userId: number;
|
||||
userId: string;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { refresh } from "../entity/refresh";
|
||||
import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults";
|
||||
import DatabaseActionException from "../exceptions/databaseActionException";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import { StringHelper } from "../helpers/stringHelper";
|
||||
import UserService from "../service/user/userService";
|
||||
import UserService from "../service/management/userService";
|
||||
import { CreateRefreshCommand, DeleteRefreshCommand } from "./refreshCommand";
|
||||
import ms from "ms";
|
||||
|
||||
|
@ -22,7 +23,7 @@ export default abstract class RefreshCommandHandler {
|
|||
.into(refresh)
|
||||
.values({
|
||||
token: refreshToken,
|
||||
user: await UserService.getById(createRefresh.userId),
|
||||
userId: createRefresh.userId,
|
||||
expiry: createRefresh.isFromPwa
|
||||
? new Date(Date.now() + ms(PWA_REFRESH_EXPIRATION))
|
||||
: new Date(Date.now() + ms(REFRESH_EXPIRATION)),
|
||||
|
@ -32,7 +33,7 @@ export default abstract class RefreshCommandHandler {
|
|||
return refreshToken;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving refresh token", err);
|
||||
throw new DatabaseActionException("CREATE", "refresh", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,12 +47,11 @@ export default abstract class RefreshCommandHandler {
|
|||
.createQueryBuilder()
|
||||
.delete()
|
||||
.from(refresh)
|
||||
.where("refresh.token = :token", { token: deleteRefresh.token })
|
||||
.andWhere("refresh.userId = :userId", { userId: deleteRefresh.userId })
|
||||
.where({ token: deleteRefresh.token, userId: deleteRefresh.userId })
|
||||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed refresh removal", err);
|
||||
throw new DatabaseActionException("DELETE", "refresh", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default abstract class RefreshCommandHandler {
|
|||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed expired refresh removal", err);
|
||||
throw new DatabaseActionException("DELETE", "refresh", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { dataSource } from "../data-source";
|
||||
import { reset } from "../entity/reset";
|
||||
import DatabaseActionException from "../exceptions/databaseActionException";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import { StringHelper } from "../helpers/stringHelper";
|
||||
import { CreateResetCommand, DeleteResetCommand } from "./resetCommand";
|
||||
|
@ -29,7 +30,7 @@ export default abstract class ResetCommandHandler {
|
|||
return token;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed saving reset", err);
|
||||
throw new DatabaseActionException("CREATE", "reset", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ export default abstract class ResetCommandHandler {
|
|||
.execute()
|
||||
.then((res) => {})
|
||||
.catch((err) => {
|
||||
throw new InternalException("failed reset removal", err);
|
||||
throw new DatabaseActionException("DELETE", "reset", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { newsletterConfig } from "../../../entity/settings/newsletterConfig";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
import { SetNewsletterConfigCommand } from "./newsletterConfigCommand";
|
||||
|
||||
export default abstract class NewsletterConfigCommandHandler {
|
||||
/**
|
||||
* @description set newsletterConfig
|
||||
* @param {SetNewsletterConfigCommand} setNewsletterConfig
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async set(setNewsletterConfig: SetNewsletterConfigCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(newsletterConfig)
|
||||
.values({
|
||||
comTypeId: setNewsletterConfig.comTypeId,
|
||||
config: setNewsletterConfig.config,
|
||||
})
|
||||
.orUpdate(["config"], "comTypeId")
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("Failed setting newsletterConfig", err);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,16 +1,20 @@
|
|||
import { Request, Response } from "express";
|
||||
import CalendarService from "../../../service/club/calendarService";
|
||||
import CalendarFactory from "../../../factory/admin/club/calendar";
|
||||
import CalendarTypeService from "../../../service/settings/calendarTypeService";
|
||||
import CalendarTypeFactory from "../../../factory/admin/settings/calendarType";
|
||||
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "../../../command/club/calendar/calendarCommand";
|
||||
import CalendarTypeService from "../../../service/configuration/calendarTypeService";
|
||||
import CalendarTypeFactory from "../../../factory/admin/configuration/calendarType";
|
||||
import {
|
||||
CreateCalendarCommand,
|
||||
DeleteCalendarCommand,
|
||||
UpdateCalendarCommand,
|
||||
} from "../../../command/club/calendar/calendarCommand";
|
||||
import CalendarCommandHandler from "../../../command/club/calendar/calendarCommandHandler";
|
||||
import {
|
||||
CreateCalendarTypeCommand,
|
||||
DeleteCalendarTypeCommand,
|
||||
UpdateCalendarTypeCommand,
|
||||
} from "../../../command/settings/calendarType/calendarTypeCommand";
|
||||
import CalendarTypeCommandHandler from "../../../command/settings/calendarType/calendarTypeCommandHandler";
|
||||
} from "../../../command/configuration/calendarType/calendarTypeCommand";
|
||||
import CalendarTypeCommandHandler from "../../../command/configuration/calendarType/calendarTypeCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all calendar items
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
CreateMemberCommand,
|
||||
DeleteMemberCommand,
|
||||
UpdateMemberCommand,
|
||||
UpdateMemberNewsletterCommand,
|
||||
} from "../../../command/club/member/memberCommand";
|
||||
import MemberCommandHandler from "../../../command/club/member/memberCommandHandler";
|
||||
import {
|
||||
|
@ -61,8 +60,10 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
|
|||
let offset = parseInt((req.query.offset as string) ?? "0");
|
||||
let count = parseInt((req.query.count as string) ?? "25");
|
||||
let search = (req.query.search as string) ?? "";
|
||||
let noLimit = req.query.noLimit === "true";
|
||||
let ids = ((req.query.ids ?? "") as string).split(",").filter((i) => i);
|
||||
|
||||
let [members, total] = await MemberService.getAll(offset, count, search);
|
||||
let [members, total] = await MemberService.getAll({ offset, count, search, noLimit, ids });
|
||||
|
||||
res.json({
|
||||
members: MemberFactory.mapToBase(members),
|
||||
|
@ -72,6 +73,25 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get members by Ids
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMembersByIds(req: Request, res: Response): Promise<any> {
|
||||
let ids = req.body.ids as Array<string>;
|
||||
|
||||
let [members, total] = await MemberService.getAll({ noLimit: true, ids });
|
||||
|
||||
res.json({
|
||||
members: MemberFactory.mapToBase(members),
|
||||
total: total,
|
||||
offset: 0,
|
||||
count: total,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get member by id
|
||||
* @param req {Request} Express req object
|
||||
|
@ -79,12 +99,25 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMemberById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.id);
|
||||
const memberId = req.params.id;
|
||||
let member = await MemberService.getById(memberId);
|
||||
|
||||
res.json(MemberFactory.mapToSingle(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get member statistics by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMemberStatisticsById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.id;
|
||||
let member = await MemberService.getStatisticsById(memberId);
|
||||
|
||||
res.json(MemberFactory.mapToMemberStatistic(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get memberships by member
|
||||
* @param req {Request} Express req object
|
||||
|
@ -92,12 +125,25 @@ export async function getMemberById(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMembershipsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
let memberships = await MembershipService.getAll(memberId);
|
||||
|
||||
res.json(MembershipFactory.mapToBase(memberships));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get member statistics by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMembershipStatisticsById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = req.params.memberId;
|
||||
let member = await MembershipService.getStatisticsById(memberId);
|
||||
|
||||
res.json(MembershipFactory.mapToBaseStatistics(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get membership by member and record
|
||||
* @param req {Request} Express req object
|
||||
|
@ -105,7 +151,7 @@ export async function getMembershipsByMember(req: Request, res: Response): Promi
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMembershipByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let membership = await MembershipService.getById(memberId, recordId);
|
||||
|
||||
|
@ -119,7 +165,7 @@ export async function getMembershipByMemberAndRecord(req: Request, res: Response
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAwardsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
let awards = await MemberAwardService.getAll(memberId);
|
||||
|
||||
res.json(MemberAwardFactory.mapToBase(awards));
|
||||
|
@ -132,7 +178,7 @@ export async function getAwardsByMember(req: Request, res: Response): Promise<an
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAwardByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let award = await MemberAwardService.getById(memberId, recordId);
|
||||
|
||||
|
@ -146,7 +192,7 @@ export async function getAwardByMemberAndRecord(req: Request, res: Response): Pr
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getQualificationsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
let qualifications = await MemberQualificationService.getAll(memberId);
|
||||
|
||||
res.json(MemberQualificationFactory.mapToBase(qualifications));
|
||||
|
@ -159,7 +205,7 @@ export async function getQualificationsByMember(req: Request, res: Response): Pr
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getQualificationByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let qualification = await MemberQualificationService.getById(memberId, recordId);
|
||||
|
||||
|
@ -173,7 +219,7 @@ export async function getQualificationByMemberAndRecord(req: Request, res: Respo
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getExecutivePositionsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
let positions = await MemberExecutivePositionService.getAll(memberId);
|
||||
|
||||
res.json(MemberExecutivePositionFactory.mapToBase(positions));
|
||||
|
@ -186,7 +232,7 @@ export async function getExecutivePositionsByMember(req: Request, res: Response)
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getExecutivePositionByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let position = await MemberExecutivePositionService.getById(memberId, recordId);
|
||||
|
||||
|
@ -200,7 +246,7 @@ export async function getExecutivePositionByMemberAndRecord(req: Request, res: R
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getCommunicationsByMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
let communications = await CommunicationService.getAll(memberId);
|
||||
|
||||
res.json(CommunicationFactory.mapToBase(communications));
|
||||
|
@ -213,7 +259,7 @@ export async function getCommunicationsByMember(req: Request, res: Response): Pr
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getCommunicationByMemberAndRecord(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.id);
|
||||
let communication = await CommunicationService.getById(memberId, recordId);
|
||||
|
||||
|
@ -254,15 +300,15 @@ export async function createMemberPrintoutList(req: Request, res: Response): Pro
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createMember(req: Request, res: Response): Promise<any> {
|
||||
const salutation = req.body.salutation;
|
||||
const salutationId = parseInt(req.body.salutationId);
|
||||
const firstname = req.body.firstname;
|
||||
const lastname = req.body.lastname;
|
||||
const nameaffix = req.body.nameaffix;
|
||||
const birthdate = req.body.birthdate;
|
||||
const internalId = req.body.internalId;
|
||||
const internalId = req.body.internalId || null;
|
||||
|
||||
let createMember: CreateMemberCommand = {
|
||||
salutation,
|
||||
salutationId,
|
||||
firstname,
|
||||
lastname,
|
||||
nameaffix,
|
||||
|
@ -281,7 +327,7 @@ export async function createMember(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addMembershipToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const start = req.body.start;
|
||||
const statusId = req.body.statusId;
|
||||
|
||||
|
@ -302,7 +348,7 @@ export async function addMembershipToMember(req: Request, res: Response): Promis
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addAwardToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const given = req.body.given;
|
||||
const note = req.body.note;
|
||||
const date = req.body.date;
|
||||
|
@ -327,7 +373,7 @@ export async function addAwardToMember(req: Request, res: Response): Promise<any
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addQualificationToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const note = req.body.note;
|
||||
const start = req.body.start;
|
||||
const qualificationId = req.body.qualificationId;
|
||||
|
@ -350,7 +396,7 @@ export async function addQualificationToMember(req: Request, res: Response): Pro
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addExecutivePositionToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const note = req.body.note;
|
||||
const start = req.body.start;
|
||||
const end = req.body.end || null;
|
||||
|
@ -375,9 +421,10 @@ export async function addExecutivePositionToMember(req: Request, res: Response):
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function addCommunicationToMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const preferred = req.body.preferred;
|
||||
const isSMSAlarming = req.body.isSMSAlarming;
|
||||
const isSendNewsletter = req.body.isNewsletterMain;
|
||||
const mobile = req.body.mobile;
|
||||
const email = req.body.email;
|
||||
const postalCode = req.body.postalCode;
|
||||
|
@ -386,11 +433,11 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
|
|||
const streetNumber = req.body.streetNumber;
|
||||
const streetNumberAddition = req.body.streetNumberAddition;
|
||||
const typeId = req.body.typeId;
|
||||
const isNewsletterMain = req.body.isNewsletterMain;
|
||||
|
||||
let createCommunication: CreateCommunicationCommand = {
|
||||
preferred,
|
||||
isSMSAlarming,
|
||||
isSendNewsletter,
|
||||
mobile,
|
||||
email,
|
||||
postalCode,
|
||||
|
@ -403,14 +450,6 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
|
|||
};
|
||||
let id = await CommunicationCommandHandler.create(createCommunication);
|
||||
|
||||
if (isNewsletterMain) {
|
||||
let updateNewsletter: UpdateMemberNewsletterCommand = {
|
||||
id: memberId,
|
||||
communicationId: id,
|
||||
};
|
||||
await MemberCommandHandler.updateNewsletter(updateNewsletter);
|
||||
}
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -421,17 +460,17 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateMemberById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.id);
|
||||
const salutation = req.body.salutation;
|
||||
const memberId = req.params.id;
|
||||
const salutationId = parseInt(req.body.salutationId);
|
||||
const firstname = req.body.firstname;
|
||||
const lastname = req.body.lastname;
|
||||
const nameaffix = req.body.nameaffix;
|
||||
const birthdate = req.body.birthdate;
|
||||
const internalId = req.body.internalId;
|
||||
const internalId = req.body.internalId || null;
|
||||
|
||||
let updateMember: UpdateMemberCommand = {
|
||||
id: memberId,
|
||||
salutation,
|
||||
salutationId,
|
||||
firstname,
|
||||
lastname,
|
||||
nameaffix,
|
||||
|
@ -450,7 +489,7 @@ export async function updateMemberById(req: Request, res: Response): Promise<any
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateMembershipOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const start = req.body.start;
|
||||
const end = req.body.end || null;
|
||||
|
@ -477,7 +516,7 @@ export async function updateMembershipOfMember(req: Request, res: Response): Pro
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateAwardOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const given = req.body.given;
|
||||
const note = req.body.note;
|
||||
|
@ -504,7 +543,7 @@ export async function updateAwardOfMember(req: Request, res: Response): Promise<
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateQualificationOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const note = req.body.note;
|
||||
const start = req.body.start;
|
||||
|
@ -533,7 +572,7 @@ export async function updateQualificationOfMember(req: Request, res: Response):
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateExecutivePositionOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const note = req.body.note;
|
||||
const start = req.body.start;
|
||||
|
@ -560,10 +599,11 @@ export async function updateExecutivePositionOfMember(req: Request, res: Respons
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateCommunicationOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
const preferred = req.body.preferred;
|
||||
const isSMSAlarming = req.body.isSMSAlarming;
|
||||
const isSendNewsletter = req.body.isNewsletterMain;
|
||||
const mobile = req.body.mobile;
|
||||
const email = req.body.email;
|
||||
const postalCode = req.body.postalCode;
|
||||
|
@ -571,12 +611,12 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
|
|||
const street = req.body.street;
|
||||
const streetNumber = req.body.streetNumber;
|
||||
const streetNumberAddition = req.body.streetNumberAddition;
|
||||
const isNewsletterMain = req.body.isNewsletterMain;
|
||||
|
||||
let updateCommunication: UpdateCommunicationCommand = {
|
||||
id: recordId,
|
||||
preferred,
|
||||
isSMSAlarming,
|
||||
isSendNewsletter,
|
||||
mobile,
|
||||
email,
|
||||
postalCode,
|
||||
|
@ -588,18 +628,6 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
|
|||
};
|
||||
await CommunicationCommandHandler.update(updateCommunication);
|
||||
|
||||
let currentUserNewsletterMain = await MemberService.getNewsletterById(memberId);
|
||||
|
||||
if (isNewsletterMain) {
|
||||
let updateNewsletter: UpdateMemberNewsletterCommand = {
|
||||
id: memberId,
|
||||
communicationId: recordId,
|
||||
};
|
||||
await MemberCommandHandler.updateNewsletter(updateNewsletter);
|
||||
} else if (currentUserNewsletterMain.sendNewsletter?.id == recordId) {
|
||||
await MemberCommandHandler.unsetNewsletter(memberId);
|
||||
}
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
|
@ -610,7 +638,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteMemberById(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.id);
|
||||
const memberId = req.params.id;
|
||||
|
||||
let deleteMember: DeleteMemberCommand = {
|
||||
id: memberId,
|
||||
|
@ -627,7 +655,7 @@ export async function deleteMemberById(req: Request, res: Response): Promise<any
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteMembershipOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteMembership: DeleteMembershipCommand = {
|
||||
|
@ -646,7 +674,7 @@ export async function deleteMembershipOfMember(req: Request, res: Response): Pro
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteAwardOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteMemberAward: DeleteMemberAwardCommand = {
|
||||
|
@ -665,7 +693,7 @@ export async function deleteAwardOfMember(req: Request, res: Response): Promise<
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteQualificationOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteMemberQualification: DeleteMemberQualificationCommand = {
|
||||
|
@ -684,7 +712,7 @@ export async function deleteQualificationOfMember(req: Request, res: Response):
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteExecutivePositionOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteMemberExecutivePosition: DeleteMemberExecutivePositionCommand = {
|
||||
|
@ -703,7 +731,7 @@ export async function deleteExecutivePositionOfMember(req: Request, res: Respons
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteCommunicationOfMember(req: Request, res: Response): Promise<any> {
|
||||
const memberId = parseInt(req.params.memberId);
|
||||
const memberId = req.params.memberId;
|
||||
const recordId = parseInt(req.params.recordId);
|
||||
|
||||
let deleteCommunication: DeleteCommunicationCommand = {
|
||||
|
|
|
@ -17,11 +17,10 @@ import { SynchronizeNewsletterRecipientsCommand } from "../../../command/club/ne
|
|||
import NewsletterRecipientsCommandHandler from "../../../command/club/newsletter/newsletterRecipientsCommandHandler";
|
||||
import { NewsletterDatesViewModel } from "../../../viewmodel/admin/club/newsletter/newsletterDates.models";
|
||||
import { PdfExport } from "../../../helpers/pdfExport";
|
||||
import UserService from "../../../service/user/userService";
|
||||
import UserService from "../../../service/management/userService";
|
||||
import { TemplateHelper } from "../../../helpers/templateHelper";
|
||||
import MailHelper from "../../../helpers/mailHelper";
|
||||
import { NewsletterEventType, NewsletterHelper } from "../../../helpers/newsletterHelper";
|
||||
import { Salutation } from "../../../enums/salutation";
|
||||
|
||||
/**
|
||||
* @description get all newsletters
|
||||
|
@ -136,13 +135,13 @@ export async function createNewsletterPrintoutPreviewById(req: Request, res: Res
|
|||
let newsletterId = parseInt(req.params.newsletterId);
|
||||
let newsletter = await NewsletterService.getById(newsletterId);
|
||||
let dates = await NewsletterDatesService.getAll(newsletterId);
|
||||
let recipient = await UserService.getById(parseInt(req.userId));
|
||||
let recipient = await UserService.getById(req.userId);
|
||||
|
||||
let data = NewsletterHelper.buildData(newsletter, dates);
|
||||
data.recipient = {
|
||||
firstname: recipient.firstname,
|
||||
lastname: recipient.lastname,
|
||||
salutation: Salutation.none,
|
||||
salutation: "Anrede",
|
||||
nameaffix: "",
|
||||
street: "Straße",
|
||||
streetNumber: "Hausnummer",
|
||||
|
@ -242,13 +241,13 @@ export async function createNewsletterMailPreviewById(req: Request, res: Respons
|
|||
let newsletterId = parseInt(req.params.newsletterId);
|
||||
let newsletter = await NewsletterService.getById(newsletterId);
|
||||
let dates = await NewsletterDatesService.getAll(newsletterId);
|
||||
let recipient = await UserService.getById(parseInt(req.userId));
|
||||
let recipient = await UserService.getById(req.userId);
|
||||
|
||||
let data = NewsletterHelper.buildData(newsletter, dates);
|
||||
data.recipient = {
|
||||
firstname: recipient.firstname,
|
||||
lastname: recipient.lastname,
|
||||
salutation: Salutation.none,
|
||||
salutation: "Anrede",
|
||||
nameaffix: "",
|
||||
street: "Straße",
|
||||
streetNumber: "Hausnummer",
|
||||
|
@ -376,7 +375,7 @@ export async function synchronizeNewsletterDatesById(req: Request, res: Response
|
|||
*/
|
||||
export async function synchronizeNewsletterRecipientsById(req: Request, res: Response): Promise<any> {
|
||||
let newsletterId = parseInt(req.params.newsletterId);
|
||||
let recipients = req.body.recipients as Array<number>;
|
||||
let recipients = req.body.recipients as Array<string>;
|
||||
|
||||
let syncRecipients: SynchronizeNewsletterRecipientsCommand = {
|
||||
newsletterId,
|
||||
|
|
|
@ -36,9 +36,10 @@ export async function getTableMetaByTablename(req: Request, res: Response): Prom
|
|||
export async function executeQuery(req: Request, res: Response): Promise<any> {
|
||||
let offset = parseInt((req.query.offset as string) ?? "0");
|
||||
let count = parseInt((req.query.count as string) ?? "25");
|
||||
let noLimit = req.query.noLimit === "true";
|
||||
const query = req.body.query;
|
||||
|
||||
let result = await DynamicQueryBuilder.executeQuery(query, offset, count);
|
||||
let result = await DynamicQueryBuilder.executeQuery({ query, offset, count, noLimit });
|
||||
|
||||
res.json(result);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import AwardService from "../../../service/settings/awardService";
|
||||
import AwardFactory from "../../../factory/admin/settings/award";
|
||||
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "../../../command/settings/award/awardCommand";
|
||||
import AwardCommandHandler from "../../../command/settings/award/awardCommandHandler";
|
||||
import AwardService from "../../../service/configuration/awardService";
|
||||
import AwardFactory from "../../../factory/admin/configuration/award";
|
||||
import {
|
||||
CreateAwardCommand,
|
||||
DeleteAwardCommand,
|
||||
UpdateAwardCommand,
|
||||
} from "../../../command/configuration/award/awardCommand";
|
||||
import AwardCommandHandler from "../../../command/configuration/award/awardCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all awards
|
|
@ -1,13 +1,13 @@
|
|||
import { Request, Response } from "express";
|
||||
import CommunicationTypeService from "../../../service/settings/communicationTypeService";
|
||||
import CommunicationTypeFactory from "../../../factory/admin/settings/communicationType";
|
||||
import CommunicationTypeService from "../../../service/configuration/communicationTypeService";
|
||||
import CommunicationTypeFactory from "../../../factory/admin/configuration/communicationType";
|
||||
import CommunicationService from "../../../service/club/member/communicationService";
|
||||
import {
|
||||
CreateCommunicationTypeCommand,
|
||||
DeleteCommunicationTypeCommand,
|
||||
UpdateCommunicationTypeCommand,
|
||||
} from "../../../command/settings/communicationType/communicationTypeCommand";
|
||||
import CommunicationTypeCommandHandler from "../../../command/settings/communicationType/communicationTypeCommandHandler";
|
||||
} from "../../../command/configuration/communicationType/communicationTypeCommand";
|
||||
import CommunicationTypeCommandHandler from "../../../command/configuration/communicationType/communicationTypeCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all communicationTypes
|
|
@ -1,12 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import ExecutivePositionService from "../../../service/settings/executivePositionService";
|
||||
import ExecutivePositionFactory from "../../../factory/admin/settings/executivePosition";
|
||||
import ExecutivePositionService from "../../../service/configuration/executivePositionService";
|
||||
import ExecutivePositionFactory from "../../../factory/admin/configuration/executivePosition";
|
||||
import {
|
||||
CreateExecutivePositionCommand,
|
||||
DeleteExecutivePositionCommand,
|
||||
UpdateExecutivePositionCommand,
|
||||
} from "../../../command/settings/executivePosition/executivePositionCommand";
|
||||
import ExecutivePositionCommandHandler from "../../../command/settings/executivePosition/executivePositionCommandHandler";
|
||||
} from "../../../command/configuration/executivePosition/executivePositionCommand";
|
||||
import ExecutivePositionCommandHandler from "../../../command/configuration/executivePosition/executivePositionCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all executivePositions
|
|
@ -1,12 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import MembershipStatusService from "../../../service/settings/membershipStatusService";
|
||||
import MembershipStatusFactory from "../../../factory/admin/settings/membershipStatus";
|
||||
import MembershipStatusService from "../../../service/configuration/membershipStatusService";
|
||||
import MembershipStatusFactory from "../../../factory/admin/configuration/membershipStatus";
|
||||
import {
|
||||
CreateMembershipStatusCommand,
|
||||
DeleteMembershipStatusCommand,
|
||||
UpdateMembershipStatusCommand,
|
||||
} from "../../../command/settings/membershipStatus/membershipStatusCommand";
|
||||
import MembershipStatusCommandHandler from "../../../command/settings/membershipStatus/membershipStatusCommandHandler";
|
||||
} from "../../../command/configuration/membershipStatus/membershipStatusCommand";
|
||||
import MembershipStatusCommandHandler from "../../../command/configuration/membershipStatus/membershipStatusCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all membershipStatus
|
|
@ -1,8 +1,11 @@
|
|||
import { Request, Response } from "express";
|
||||
import NewsletterConfigService from "../../../service/settings/newsletterConfigService";
|
||||
import NewsletterConfigFactory from "../../../factory/admin/settings/newsletterConfig";
|
||||
import NewsletterConfigCommandHandler from "../../../command/settings/newsletterConfig/newsletterConfigCommandHandler";
|
||||
import { SetNewsletterConfigCommand } from "../../../command/settings/newsletterConfig/newsletterConfigCommand";
|
||||
import NewsletterConfigService from "../../../service/configuration/newsletterConfigService";
|
||||
import NewsletterConfigFactory from "../../../factory/admin/configuration/newsletterConfig";
|
||||
import NewsletterConfigCommandHandler from "../../../command/configuration/newsletterConfig/newsletterConfigCommandHandler";
|
||||
import {
|
||||
DeleteNewsletterConfigCommand,
|
||||
SetNewsletterConfigCommand,
|
||||
} from "../../../command/configuration/newsletterConfig/newsletterConfigCommand";
|
||||
|
||||
/**
|
||||
* @description get all newsletterConfigs
|
||||
|
@ -43,7 +46,24 @@ export async function setNewsletterConfig(req: Request, res: Response): Promise<
|
|||
comTypeId,
|
||||
config,
|
||||
};
|
||||
let id = await NewsletterConfigCommandHandler.set(createNewsletterConfig);
|
||||
await NewsletterConfigCommandHandler.set(createNewsletterConfig);
|
||||
|
||||
res.send(id);
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete award
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteNewsletterConfig(req: Request, res: Response): Promise<any> {
|
||||
const comTypeId = parseInt(req.params.comTypeId);
|
||||
|
||||
let deleteNewsletterConfig: DeleteNewsletterConfigCommand = {
|
||||
comTypeId: comTypeId,
|
||||
};
|
||||
await NewsletterConfigCommandHandler.delete(deleteNewsletterConfig);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import QualificationService from "../../../service/settings/qualification";
|
||||
import QualificationFactory from "../../../factory/admin/settings/qualification";
|
||||
import QualificationService from "../../../service/configuration/qualification";
|
||||
import QualificationFactory from "../../../factory/admin/configuration/qualification";
|
||||
import {
|
||||
CreateQualificationCommand,
|
||||
DeleteQualificationCommand,
|
||||
UpdateQualificationCommand,
|
||||
} from "../../../command/settings/qualification/qualificationCommand";
|
||||
import QualificationCommandHandler from "../../../command/settings/qualification/qualificationCommandHandler";
|
||||
} from "../../../command/configuration/qualification/qualificationCommand";
|
||||
import QualificationCommandHandler from "../../../command/configuration/qualification/qualificationCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all qualifications
|
|
@ -1,12 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import QueryStoreFactory from "../../../factory/admin/settings/queryStore";
|
||||
import QueryStoreService from "../../../service/settings/queryStoreService";
|
||||
import QueryStoreFactory from "../../../factory/admin/configuration/queryStore";
|
||||
import QueryStoreService from "../../../service/configuration/queryStoreService";
|
||||
import {
|
||||
CreateQueryStoreCommand,
|
||||
DeleteQueryStoreCommand,
|
||||
UpdateQueryStoreCommand,
|
||||
} from "../../../command/settings/queryStore/queryStoreCommand";
|
||||
import QueryStoreCommandHandler from "../../../command/settings/queryStore/queryStoreCommandHandler";
|
||||
} from "../../../command/configuration/queryStore/queryStoreCommand";
|
||||
import QueryStoreCommandHandler from "../../../command/configuration/queryStore/queryStoreCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all queryStores
|
87
src/controller/admin/configuration/salutationController.ts
Normal file
87
src/controller/admin/configuration/salutationController.ts
Normal file
|
@ -0,0 +1,87 @@
|
|||
import { Request, Response } from "express";
|
||||
import SalutationService from "../../../service/configuration/salutationService";
|
||||
import SalutationFactory from "../../../factory/admin/configuration/salutation";
|
||||
import {
|
||||
CreateSalutationCommand,
|
||||
DeleteSalutationCommand,
|
||||
UpdateSalutationCommand,
|
||||
} from "../../../command/configuration/salutation/salutationCommand";
|
||||
import SalutationCommandHandler from "../../../command/configuration/salutation/salutationCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all salutations
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAllSalutations(req: Request, res: Response): Promise<any> {
|
||||
let salutations = await SalutationService.getAll();
|
||||
|
||||
res.json(SalutationFactory.mapToBase(salutations));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get salutation by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getSalutationById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let salutation = await SalutationService.getById(id);
|
||||
|
||||
res.json(SalutationFactory.mapToSingle(salutation));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create new salutation
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createSalutation(req: Request, res: Response): Promise<any> {
|
||||
const salutation = req.body.salutation;
|
||||
|
||||
let createSalutation: CreateSalutationCommand = {
|
||||
salutation: salutation,
|
||||
};
|
||||
await SalutationCommandHandler.create(createSalutation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update salutation
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateSalutation(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const salutation = req.body.salutation;
|
||||
|
||||
let updateSalutation: UpdateSalutationCommand = {
|
||||
id: id,
|
||||
salutation: salutation,
|
||||
};
|
||||
await SalutationCommandHandler.update(updateSalutation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete salutation
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteSalutation(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteSalutation: DeleteSalutationCommand = {
|
||||
id: id,
|
||||
};
|
||||
await SalutationCommandHandler.delete(deleteSalutation);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import TemplateService from "../../../service/settings/templateService";
|
||||
import TemplateFactory from "../../../factory/admin/settings/template";
|
||||
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "../../../command/settings/template/templateCommand";
|
||||
import TemplateCommandHandler from "../../../command/settings/template/templateCommandHandler";
|
||||
import TemplateService from "../../../service/configuration/templateService";
|
||||
import TemplateFactory from "../../../factory/admin/configuration/template";
|
||||
import {
|
||||
CreateTemplateCommand,
|
||||
DeleteTemplateCommand,
|
||||
UpdateTemplateCommand,
|
||||
} from "../../../command/configuration/template/templateCommand";
|
||||
import TemplateCommandHandler from "../../../command/configuration/template/templateCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get all templates
|
|
@ -1,8 +1,8 @@
|
|||
import { Request, Response } from "express";
|
||||
import TemplateUsageService from "../../../service/settings/templateUsageService";
|
||||
import TemplateUsageFactory from "../../../factory/admin/settings/templateUsage";
|
||||
import { UpdateTemplateUsageCommand } from "../../../command/settings/templateUsage/templateUsageCommand";
|
||||
import TemplateUsageCommandHandler from "../../../command/settings/templateUsage/templateUsageCommandHandler";
|
||||
import TemplateUsageService from "../../../service/configuration/templateUsageService";
|
||||
import TemplateUsageFactory from "../../../factory/admin/configuration/templateUsage";
|
||||
import { UpdateTemplateUsageCommand } from "../../../command/configuration/templateUsage/templateUsageCommand";
|
||||
import TemplateUsageCommandHandler from "../../../command/configuration/templateUsage/templateUsageCommandHandler";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import ForbiddenRequestException from "../../../exceptions/forbiddenRequestException";
|
||||
import { PermissionModule } from "../../../type/permissionTypes";
|
||||
|
@ -21,7 +21,7 @@ export async function getAllTemplateUsages(req: Request, res: Response): Promise
|
|||
if (!req.isOwner) {
|
||||
templateUsages = templateUsages.filter((tu) => {
|
||||
return (
|
||||
PermissionHelper.can(req.permissions, "update", "settings", tu.scope.split(".")[0] as PermissionModule) ||
|
||||
PermissionHelper.can(req.permissions, "update", "configuration", tu.scope.split(".")[0] as PermissionModule) ||
|
||||
PermissionHelper.can(req.permissions, "update", "club", tu.scope.split(".")[0] as PermissionModule)
|
||||
);
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ export async function updateTemplateUsage(req: Request, res: Response): Promise<
|
|||
let allowedSettings = PermissionHelper.can(
|
||||
req.permissions,
|
||||
"update",
|
||||
"settings",
|
||||
"configuration",
|
||||
req.params.scope as PermissionModule
|
||||
);
|
||||
let allowedClub = PermissionHelper.can(req.permissions, "update", "club", req.params.scope as PermissionModule);
|
126
src/controller/admin/management/backupController.ts
Normal file
126
src/controller/admin/management/backupController.ts
Normal file
|
@ -0,0 +1,126 @@
|
|||
import { Request, Response } from "express";
|
||||
import { FileSystemHelper } from "../../../helpers/fileSystemHelper";
|
||||
import BackupHelper from "../../../helpers/backupHelper";
|
||||
import InternalException from "../../../exceptions/internalException";
|
||||
|
||||
/**
|
||||
* @description get generated backups
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getGeneratedBackups(req: Request, res: Response): Promise<any> {
|
||||
let filesInFolder = FileSystemHelper.getFilesInDirectory(`backup`);
|
||||
|
||||
let sorted = filesInFolder.sort((a, b) => new Date(b.split(".")[0]).getTime() - new Date(a.split(".")[0]).getTime());
|
||||
|
||||
res.json(sorted);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description download backup file
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function downloadBackupFile(req: Request, res: Response): Promise<any> {
|
||||
let filename = req.params.filename;
|
||||
|
||||
let filepath = FileSystemHelper.formatPath("backup", filename);
|
||||
|
||||
res.sendFile(filepath, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get uploaded backups
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getUploadedBackups(req: Request, res: Response): Promise<any> {
|
||||
let filesInFolder = FileSystemHelper.getFilesInDirectory("uploaded-backup");
|
||||
|
||||
let sorted = filesInFolder.sort((a, b) => new Date(b.split("_")[0]).getTime() - new Date(a.split("_")[0]).getTime());
|
||||
|
||||
res.json(sorted);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description download uploaded backup file
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function downloadUploadedBackupFile(req: Request, res: Response): Promise<any> {
|
||||
let filename = req.params.filename;
|
||||
|
||||
let filepath = FileSystemHelper.formatPath("uploaded-backup", filename);
|
||||
|
||||
res.sendFile(filepath, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create backup manually
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createManualBackup(req: Request, res: Response): Promise<any> {
|
||||
await BackupHelper.createBackup({});
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description restore backup by selected
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function restoreBackupByLocalFile(req: Request, res: Response): Promise<any> {
|
||||
let filename = req.body.filename;
|
||||
let partial = req.body.partial;
|
||||
let include = req.body.include;
|
||||
let overwrite = req.body.overwrite;
|
||||
|
||||
await BackupHelper.loadBackup({ filename, include, partial, overwrite });
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description restore uploaded backup by selected
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function restoreBackupByUploadedFile(req: Request, res: Response): Promise<any> {
|
||||
let filename = req.body.filename;
|
||||
let partial = req.body.partial;
|
||||
let include = req.body.include;
|
||||
|
||||
await BackupHelper.loadBackup({ filename, path: "uploaded-backup", include, partial });
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description upload backup
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function uploadBackupFile(req: Request, res: Response): Promise<any> {
|
||||
if (!req.file) {
|
||||
throw new InternalException("File upload failed");
|
||||
}
|
||||
res.sendStatus(204);
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
import { Request, Response } from "express";
|
||||
import RoleService from "../../../service/user/roleService";
|
||||
import RoleFactory from "../../../factory/admin/user/role";
|
||||
import RolePermissionService from "../../../service/user/rolePermissionService";
|
||||
import RoleService from "../../../service/management/roleService";
|
||||
import RoleFactory from "../../../factory/admin/management/role";
|
||||
import RolePermissionService from "../../../service/management/rolePermissionService";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../../command/user/role/roleCommand";
|
||||
import RoleCommandHandler from "../../../command/user/role/roleCommandHandler";
|
||||
import { UpdateRolePermissionsCommand } from "../../../command/user/role/rolePermissionCommand";
|
||||
import RolePermissionCommandHandler from "../../../command/user/role/rolePermissionCommandHandler";
|
||||
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../../command/management/role/roleCommand";
|
||||
import RoleCommandHandler from "../../../command/management/role/roleCommandHandler";
|
||||
import { UpdateRolePermissionsCommand } from "../../../command/management/role/rolePermissionCommand";
|
||||
import RolePermissionCommandHandler from "../../../command/management/role/rolePermissionCommandHandler";
|
||||
|
||||
/**
|
||||
* @description get All roles
|
|
@ -1,15 +1,20 @@
|
|||
import { Request, Response } from "express";
|
||||
import UserService from "../../../service/user/userService";
|
||||
import UserFactory from "../../../factory/admin/user/user";
|
||||
import UserPermissionService from "../../../service/user/userPermissionService";
|
||||
import UserService from "../../../service/management/userService";
|
||||
import UserFactory from "../../../factory/admin/management/user";
|
||||
import UserPermissionService from "../../../service/management/userPermissionService";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import RoleFactory from "../../../factory/admin/user/role";
|
||||
import { DeleteUserCommand, UpdateUserCommand, UpdateUserRolesCommand } from "../../../command/user/user/userCommand";
|
||||
import UserCommandHandler from "../../../command/user/user/userCommandHandler";
|
||||
import RoleFactory from "../../../factory/admin/management/role";
|
||||
import {
|
||||
DeleteUserCommand,
|
||||
UpdateUserCommand,
|
||||
UpdateUserRolesCommand,
|
||||
} from "../../../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../../../command/management/user/userCommandHandler";
|
||||
import MailHelper from "../../../helpers/mailHelper";
|
||||
import { CLUB_NAME } from "../../../env.defaults";
|
||||
import { UpdateUserPermissionsCommand } from "../../../command/user/user/userPermissionCommand";
|
||||
import UserPermissionCommandHandler from "../../../command/user/user/userPermissionCommandHandler";
|
||||
import { UpdateUserPermissionsCommand } from "../../../command/management/user/userPermissionCommand";
|
||||
import UserPermissionCommandHandler from "../../../command/management/user/userPermissionCommandHandler";
|
||||
import BadRequestException from "../../../exceptions/badRequestException";
|
||||
|
||||
/**
|
||||
* @description get All users
|
||||
|
@ -30,7 +35,7 @@ export async function getAllUsers(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getUserById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
let user = await UserService.getById(id);
|
||||
|
||||
res.json(UserFactory.mapToSingle(user));
|
||||
|
@ -43,7 +48,7 @@ export async function getUserById(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getUserPermissions(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
let permissions = await UserPermissionService.getByUser(id);
|
||||
|
||||
res.json(PermissionHelper.convertToObject(permissions.map((p) => p.permission)));
|
||||
|
@ -56,7 +61,7 @@ export async function getUserPermissions(req: Request, res: Response): Promise<a
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getUserRoles(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
|
||||
let roles = await UserService.getAssignedRolesByUserId(id);
|
||||
|
||||
|
@ -70,7 +75,7 @@ export async function getUserRoles(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateUser(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
let mail = req.body.mail;
|
||||
let firstname = req.body.firstname;
|
||||
let lastname = req.body.lastname;
|
||||
|
@ -95,7 +100,7 @@ export async function updateUser(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateUserPermissions(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
let permissions = req.body.permissions;
|
||||
|
||||
let permissionStrings = PermissionHelper.convertToStringArray(permissions);
|
||||
|
@ -116,7 +121,7 @@ export async function updateUserPermissions(req: Request, res: Response): Promis
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateUserRoles(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
let roleIds = req.body.roleIds as Array<number>;
|
||||
|
||||
let updateRoles: UpdateUserRolesCommand = {
|
||||
|
@ -135,9 +140,13 @@ export async function updateUserRoles(req: Request, res: Response): Promise<any>
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteUser(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
const id = req.params.id;
|
||||
|
||||
let user = await UserService.getById(id);
|
||||
let { mail, isOwner } = await UserService.getById(id);
|
||||
|
||||
if (isOwner) {
|
||||
throw new BadRequestException("Owner cannot be deleted");
|
||||
}
|
||||
|
||||
let deleteUser: DeleteUserCommand = {
|
||||
id: id,
|
||||
|
@ -147,7 +156,7 @@ export async function deleteUser(req: Request, res: Response): Promise<any> {
|
|||
try {
|
||||
// sendmail
|
||||
await MailHelper.sendMail(
|
||||
user.mail,
|
||||
mail,
|
||||
`Email Bestätigung für Mitglieder Admin-Portal von ${CLUB_NAME}`,
|
||||
`Ihr Nutzerkonto des Adminportals wurde erfolgreich gelöscht.`
|
||||
);
|
155
src/controller/admin/management/webapiController.ts
Normal file
155
src/controller/admin/management/webapiController.ts
Normal file
|
@ -0,0 +1,155 @@
|
|||
import { Request, Response } from "express";
|
||||
import WebapiService from "../../../service/management/webapiService";
|
||||
import ApiFactory from "../../../factory/admin/management/webapi";
|
||||
import WebapiPermissionService from "../../../service/management/webapiPermissionService";
|
||||
import PermissionHelper from "../../../helpers/permissionHelper";
|
||||
import {
|
||||
CreateWebapiCommand,
|
||||
DeleteWebapiCommand,
|
||||
UpdateWebapiCommand,
|
||||
} from "../../../command/management/webapi/webapiCommand";
|
||||
import WebapiCommandHandler from "../../../command/management/webapi/webapiCommandHandler";
|
||||
import { UpdateWebapiPermissionsCommand } from "../../../command/management/webapi/webapiPermissionCommand";
|
||||
import WebapiPermissionCommandHandler from "../../../command/management/webapi/webapiPermissionCommandHandler";
|
||||
import { JWTHelper } from "../../../helpers/jwtHelper";
|
||||
import { CLUB_NAME } from "../../../env.defaults";
|
||||
import { StringHelper } from "../../../helpers/stringHelper";
|
||||
|
||||
/**
|
||||
* @description get All apis
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAllWebapis(req: Request, res: Response): Promise<any> {
|
||||
let apis = await WebapiService.getAll();
|
||||
|
||||
res.json(ApiFactory.mapToBase(apis));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get api by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getWebapiById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let api = await WebapiService.getById(id);
|
||||
|
||||
res.json(ApiFactory.mapToSingle(api));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get api token by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getWebapiTokenById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let { token } = await WebapiService.getTokenById(id);
|
||||
|
||||
res.send(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get permissions by api
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getWebapiPermissions(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let permissions = await WebapiPermissionService.getByApi(id);
|
||||
|
||||
res.json(PermissionHelper.convertToObject(permissions.map((p) => p.permission)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create new api
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function createWebapi(req: Request, res: Response): Promise<any> {
|
||||
let title = req.body.title;
|
||||
let expiry = req.body.expiry || null;
|
||||
|
||||
let token = await JWTHelper.create(
|
||||
{
|
||||
iss: CLUB_NAME,
|
||||
sub: "api_token_retrieve",
|
||||
aud: StringHelper.random(32),
|
||||
},
|
||||
{ useExpiration: false }
|
||||
);
|
||||
|
||||
let createApi: CreateWebapiCommand = {
|
||||
token: token,
|
||||
title: title,
|
||||
expiry: expiry,
|
||||
};
|
||||
await WebapiCommandHandler.create(createApi);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update api data
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateWebapi(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let title = req.body.title;
|
||||
let expiry = req.body.expiry || null;
|
||||
|
||||
let updateApi: UpdateWebapiCommand = {
|
||||
id: id,
|
||||
title: title,
|
||||
expiry: expiry,
|
||||
};
|
||||
await WebapiCommandHandler.update(updateApi);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description update api assigned permission strings
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateWebapiPermissions(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
let permissions = req.body.permissions;
|
||||
|
||||
let permissionStrings = PermissionHelper.convertToStringArray(permissions);
|
||||
|
||||
let updateApiPermissions: UpdateWebapiPermissionsCommand = {
|
||||
webapiId: id,
|
||||
permissions: permissionStrings,
|
||||
};
|
||||
await WebapiPermissionCommandHandler.updatePermissions(updateApiPermissions);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description delete api by id
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function deleteWebapi(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.params.id);
|
||||
|
||||
let deleteApi: DeleteWebapiCommand = {
|
||||
id: id,
|
||||
};
|
||||
await WebapiCommandHandler.delete(deleteApi);
|
||||
|
||||
res.sendStatus(204);
|
||||
}
|
|
@ -4,7 +4,7 @@ import { JWTToken } from "../type/jwtTypes";
|
|||
import InternalException from "../exceptions/internalException";
|
||||
import RefreshCommandHandler from "../command/refreshCommandHandler";
|
||||
import { CreateRefreshCommand, DeleteRefreshCommand } from "../command/refreshCommand";
|
||||
import UserService from "../service/user/userService";
|
||||
import UserService from "../service/management/userService";
|
||||
import speakeasy from "speakeasy";
|
||||
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
|
||||
import RefreshService from "../service/refreshService";
|
||||
|
|
|
@ -7,18 +7,18 @@ import { CreateRefreshCommand } from "../command/refreshCommand";
|
|||
import speakeasy from "speakeasy";
|
||||
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
|
||||
import QRCode from "qrcode";
|
||||
import { CreateUserCommand } from "../command/user/user/userCommand";
|
||||
import UserCommandHandler from "../command/user/user/userCommandHandler";
|
||||
import { CreateInviteCommand, DeleteInviteCommand } from "../command/user/user/inviteCommand";
|
||||
import InviteCommandHandler from "../command/user/user/inviteCommandHandler";
|
||||
import { CreateUserCommand } from "../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../command/management/user/userCommandHandler";
|
||||
import { CreateInviteCommand, DeleteInviteCommand } from "../command/management/user/inviteCommand";
|
||||
import InviteCommandHandler from "../command/management/user/inviteCommandHandler";
|
||||
import MailHelper from "../helpers/mailHelper";
|
||||
import InviteService from "../service/user/inviteService";
|
||||
import UserService from "../service/user/userService";
|
||||
import InviteService from "../service/management/inviteService";
|
||||
import UserService from "../service/management/userService";
|
||||
import CustomRequestException from "../exceptions/customRequestException";
|
||||
import { CLUB_NAME } from "../env.defaults";
|
||||
import { CreateUserPermissionCommand } from "../command/user/user/userPermissionCommand";
|
||||
import UserPermissionCommandHandler from "../command/user/user/userPermissionCommandHandler";
|
||||
import InviteFactory from "../factory/admin/user/invite";
|
||||
import { CreateUserPermissionCommand } from "../command/management/user/userPermissionCommand";
|
||||
import UserPermissionCommandHandler from "../command/management/user/userPermissionCommandHandler";
|
||||
import InviteFactory from "../factory/admin/management/invite";
|
||||
|
||||
/**
|
||||
* @description get all invites
|
||||
|
@ -59,7 +59,7 @@ export async function inviteUser(req: Request, res: Response, isInvite: boolean
|
|||
throw new CustomRequestException(409, "Username and Mail are already in use");
|
||||
}
|
||||
|
||||
var secret = speakeasy.generateSecret({ length: 20, name: `Mitgliederverwaltung ${CLUB_NAME}` });
|
||||
var secret = speakeasy.generateSecret({ length: 20, name: `FF Admin ${CLUB_NAME}` });
|
||||
|
||||
let createInvite: CreateInviteCommand = {
|
||||
username: username,
|
||||
|
@ -92,7 +92,7 @@ export async function verifyInvite(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { secret, username } = await InviteService.getByMailAndToken(mail, token);
|
||||
|
||||
const url = `otpauth://totp/Mitgliederverwaltung ${CLUB_NAME}?secret=${secret}`;
|
||||
const url = `otpauth://totp/FF Admin ${CLUB_NAME}?secret=${secret}`;
|
||||
|
||||
QRCode.toDataURL(url)
|
||||
.then((result) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Request, Response } from "express";
|
||||
import CalendarService from "../service/club/calendarService";
|
||||
import CalendarTypeService from "../service/settings/calendarTypeService";
|
||||
import CalendarTypeService from "../service/configuration/calendarTypeService";
|
||||
import { calendar } from "../entity/club/calendar";
|
||||
import { createEvents } from "ics";
|
||||
import moment from "moment";
|
||||
|
|
|
@ -11,13 +11,13 @@ import { CreateResetCommand, DeleteResetCommand } from "../command/resetCommand"
|
|||
import ResetCommandHandler from "../command/resetCommandHandler";
|
||||
import MailHelper from "../helpers/mailHelper";
|
||||
import ResetService from "../service/resetService";
|
||||
import UserService from "../service/user/userService";
|
||||
import UserService from "../service/management/userService";
|
||||
import { CLUB_NAME } from "../env.defaults";
|
||||
import PermissionHelper from "../helpers/permissionHelper";
|
||||
import RolePermissionService from "../service/user/rolePermissionService";
|
||||
import UserPermissionService from "../service/user/userPermissionService";
|
||||
import { UpdateUserSecretCommand } from "../command/user/user/userCommand";
|
||||
import UserCommandHandler from "../command/user/user/userCommandHandler";
|
||||
import RolePermissionService from "../service/management/rolePermissionService";
|
||||
import UserPermissionService from "../service/management/userPermissionService";
|
||||
import { UpdateUserSecretCommand } from "../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../command/management/user/userCommandHandler";
|
||||
|
||||
/**
|
||||
* @description request totp reset
|
||||
|
@ -31,7 +31,7 @@ export async function startReset(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { mail } = await UserService.getByUsername(username);
|
||||
|
||||
var secret = speakeasy.generateSecret({ length: 20, name: `Mitgliederverwaltung ${CLUB_NAME}` });
|
||||
var secret = speakeasy.generateSecret({ length: 20, name: `FF Admin ${CLUB_NAME}` });
|
||||
|
||||
let createReset: CreateResetCommand = {
|
||||
username: username,
|
||||
|
@ -62,7 +62,7 @@ export async function verifyReset(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { secret } = await ResetService.getByMailAndToken(mail, token);
|
||||
|
||||
const url = `otpauth://totp/Mitgliederverwaltung ${CLUB_NAME}?secret=${secret}`;
|
||||
const url = `otpauth://totp/FF Admin ${CLUB_NAME}?secret=${secret}`;
|
||||
|
||||
QRCode.toDataURL(url)
|
||||
.then((result) => {
|
||||
|
|
|
@ -3,10 +3,10 @@ import speakeasy from "speakeasy";
|
|||
import QRCode from "qrcode";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import { CLUB_NAME } from "../env.defaults";
|
||||
import UserService from "../service/user/userService";
|
||||
import UserFactory from "../factory/admin/user/user";
|
||||
import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/user/user/userCommand";
|
||||
import UserCommandHandler from "../command/user/user/userCommandHandler";
|
||||
import UserService from "../service/management/userService";
|
||||
import UserFactory from "../factory/admin/management/user";
|
||||
import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../command/management/user/userCommandHandler";
|
||||
import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMeById(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.userId);
|
||||
const id = req.userId;
|
||||
let user = await UserService.getById(id);
|
||||
|
||||
res.json(UserFactory.mapToSingle(user));
|
||||
|
@ -29,11 +29,11 @@ export async function getMeById(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getMyTotp(req: Request, res: Response): Promise<any> {
|
||||
const userId = parseInt(req.userId);
|
||||
const userId = req.userId;
|
||||
|
||||
let { secret } = await UserService.getById(userId);
|
||||
|
||||
const url = `otpauth://totp/Mitgliederverwaltung ${CLUB_NAME}?secret=${secret}`;
|
||||
const url = `otpauth://totp/FF Admin ${CLUB_NAME}?secret=${secret}`;
|
||||
|
||||
QRCode.toDataURL(url)
|
||||
.then((result) => {
|
||||
|
@ -54,7 +54,7 @@ export async function getMyTotp(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function verifyMyTotp(req: Request, res: Response): Promise<any> {
|
||||
const userId = parseInt(req.userId);
|
||||
const userId = req.userId;
|
||||
let totp = req.body.totp;
|
||||
|
||||
let { secret } = await UserService.getById(userId);
|
||||
|
@ -78,7 +78,7 @@ export async function verifyMyTotp(req: Request, res: Response): Promise<any> {
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function transferOwnership(req: Request, res: Response): Promise<any> {
|
||||
const userId = parseInt(req.userId);
|
||||
const userId = req.userId;
|
||||
let toId = req.body.toId;
|
||||
|
||||
let { isOwner } = await UserService.getById(userId);
|
||||
|
@ -102,7 +102,7 @@ export async function transferOwnership(req: Request, res: Response): Promise<an
|
|||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function updateMe(req: Request, res: Response): Promise<any> {
|
||||
const id = parseInt(req.userId);
|
||||
const id = req.userId;
|
||||
let mail = req.body.mail;
|
||||
let firstname = req.body.firstname;
|
||||
let lastname = req.body.lastname;
|
||||
|
|
37
src/controller/webapiController.ts
Normal file
37
src/controller/webapiController.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { Request, Response } from "express";
|
||||
import { JWTHelper } from "../helpers/jwtHelper";
|
||||
import { JWTToken } from "../type/jwtTypes";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import RefreshCommandHandler from "../command/refreshCommandHandler";
|
||||
import { CreateRefreshCommand, DeleteRefreshCommand } from "../command/refreshCommand";
|
||||
import UserService from "../service/management/userService";
|
||||
import speakeasy from "speakeasy";
|
||||
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
|
||||
import RefreshService from "../service/refreshService";
|
||||
import WebapiService from "../service/management/webapiService";
|
||||
import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
|
||||
import WebapiCommandHandler from "../command/management/webapi/webapiCommandHandler";
|
||||
|
||||
/**
|
||||
* @description Check authentication status by token
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getWebApiAccess(req: Request, res: Response): Promise<any> {
|
||||
const bearer = req.headers.authorization?.split(" ")?.[1] ?? undefined;
|
||||
|
||||
let { id, expiry } = await WebapiService.getByToken(bearer);
|
||||
|
||||
if (expiry != null && new Date() > new Date(expiry)) {
|
||||
throw new ForbiddenRequestException("api token expired");
|
||||
}
|
||||
|
||||
await WebapiCommandHandler.updateUsage({ id });
|
||||
|
||||
let accessToken = await JWTHelper.buildWebapiToken(bearer, expiry);
|
||||
|
||||
res.json({
|
||||
accessToken,
|
||||
});
|
||||
}
|
|
@ -3,75 +3,54 @@ import "reflect-metadata";
|
|||
import { DataSource } from "typeorm";
|
||||
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE, DB_PORT } from "./env.defaults";
|
||||
|
||||
import { user } from "./entity/user/user";
|
||||
import { user } from "./entity/management/user";
|
||||
import { refresh } from "./entity/refresh";
|
||||
import { invite } from "./entity/user/invite";
|
||||
import { userPermission } from "./entity/user/user_permission";
|
||||
import { role } from "./entity/user/role";
|
||||
import { rolePermission } from "./entity/user/role_permission";
|
||||
import { award } from "./entity/settings/award";
|
||||
import { invite } from "./entity/management/invite";
|
||||
import { userPermission } from "./entity/management/user_permission";
|
||||
import { role } from "./entity/management/role";
|
||||
import { rolePermission } from "./entity/management/role_permission";
|
||||
import { award } from "./entity/configuration/award";
|
||||
import { communication } from "./entity/club/member/communication";
|
||||
import { communicationType } from "./entity/settings/communicationType";
|
||||
import { executivePosition } from "./entity/settings/executivePosition";
|
||||
import { membershipStatus } from "./entity/settings/membershipStatus";
|
||||
import { qualification } from "./entity/settings/qualification";
|
||||
import { communicationType } from "./entity/configuration/communicationType";
|
||||
import { executivePosition } from "./entity/configuration/executivePosition";
|
||||
import { membershipStatus } from "./entity/configuration/membershipStatus";
|
||||
import { qualification } from "./entity/configuration/qualification";
|
||||
|
||||
import { Initial1724317398939 } from "./migrations/1724317398939-initial";
|
||||
import { RefreshPrimaryChange1724573307851 } from "./migrations/1724573307851-refreshPrimaryChange";
|
||||
import { Invite1724579024939 } from "./migrations/1724579024939-invite";
|
||||
import { Permissions1724661484664 } from "./migrations/1724661484664-permissions";
|
||||
import { RolePermission1724771491085 } from "./migrations/1724771491085-role_permission";
|
||||
import { MemberBaseData1725435669492 } from "./migrations/1725435669492-member_base_data";
|
||||
import { member } from "./entity/club/member/member";
|
||||
import { memberAwards } from "./entity/club/member/memberAwards";
|
||||
import { memberExecutivePositions } from "./entity/club/member/memberExecutivePositions";
|
||||
import { memberQualifications } from "./entity/club/member/memberQualifications";
|
||||
import { membership } from "./entity/club/member/membership";
|
||||
import { Memberdata1726301836849 } from "./migrations/1726301836849-memberdata";
|
||||
import { CommunicationFields1727439800630 } from "./migrations/1727439800630-communicationFields";
|
||||
import { Ownership1728313041449 } from "./migrations/1728313041449-ownership";
|
||||
import { protocol } from "./entity/club/protocol/protocol";
|
||||
import { protocolAgenda } from "./entity/club/protocol/protocolAgenda";
|
||||
import { protocolDecision } from "./entity/club/protocol/protocolDecision";
|
||||
import { protocolPresence } from "./entity/club/protocol/protocolPresence";
|
||||
import { protocolVoting } from "./entity/club/protocol/protocolVoting";
|
||||
import { protocolPrintout } from "./entity/club/protocol/protocolPrintout";
|
||||
import { Protocol1729347911107 } from "./migrations/1729347911107-protocol";
|
||||
import { calendar } from "./entity/club/calendar";
|
||||
import { calendarType } from "./entity/settings/calendarType";
|
||||
import { Calendar1729947763295 } from "./migrations/1729947763295-calendar";
|
||||
import { calendarType } from "./entity/configuration/calendarType";
|
||||
import { reset } from "./entity/reset";
|
||||
import { ResetToken1732358596823 } from "./migrations/1732358596823-resetToken";
|
||||
import { SMSAlarming1732696919191 } from "./migrations/1732696919191-SMSAlarming";
|
||||
import { SecuringCalendarType1733249553766 } from "./migrations/1733249553766-securingCalendarType";
|
||||
import { query } from "./entity/settings/query";
|
||||
import { QueryStore1734187754677 } from "./migrations/1734187754677-queryStore";
|
||||
import { query } from "./entity/configuration/query";
|
||||
import { memberView } from "./views/memberView";
|
||||
import { memberExecutivePositionsView } from "./views/memberExecutivePositionView";
|
||||
import { memberQualificationsView } from "./views/memberQualificationsView";
|
||||
import { membershipView } from "./views/membershipsView";
|
||||
import { MemberDataViews1734520998539 } from "./migrations/1734520998539-memberDataViews";
|
||||
import { template } from "./entity/settings/template";
|
||||
import { Template1734854680201 } from "./migrations/1734854680201-template";
|
||||
import { templateUsage } from "./entity/settings/templateUsage";
|
||||
import { TemplateUsage1734949173739 } from "./migrations/1734949173739-templateUsage";
|
||||
import { template } from "./entity/configuration/template";
|
||||
import { templateUsage } from "./entity/configuration/templateUsage";
|
||||
import { newsletter } from "./entity/club/newsletter/newsletter";
|
||||
import { newsletterDates } from "./entity/club/newsletter/newsletterDates";
|
||||
import { newsletterRecipients } from "./entity/club/newsletter/newsletterRecipients";
|
||||
import { Newsletter1735118780511 } from "./migrations/1735118780511-newsletter";
|
||||
import { newsletterConfig } from "./entity/settings/newsletterConfig";
|
||||
import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig";
|
||||
import { InternalId1735822722235 } from "./migrations/1735822722235-internalId";
|
||||
import { PostalCode1735927918979 } from "./migrations/1735927918979-postalCode";
|
||||
import { ProtocolAbsent1736072179716 } from "./migrations/1736072179716-protocolAbsent";
|
||||
import { Memberlist1736079005086 } from "./migrations/1736079005086-memberlist";
|
||||
import { ExtendViewValues1736084198860 } from "./migrations/1736084198860-extendViewValues";
|
||||
import { FinishInternalIdTransfer1736505324488 } from "./migrations/1736505324488-finishInternalIdTransfer";
|
||||
import { ProtocolPresenceExcuse1737287798828 } from "./migrations/1737287798828-protocolPresenceExcuse";
|
||||
import { newsletterConfig } from "./entity/configuration/newsletterConfig";
|
||||
import { webapi } from "./entity/management/webapi";
|
||||
import { webapiPermission } from "./entity/management/webapi_permission";
|
||||
import { salutation } from "./entity/configuration/salutation";
|
||||
|
||||
import { BackupAndResetDatabase1738166124200 } from "./migrations/1738166124200-BackupAndResetDatabase";
|
||||
import { CreateSchema1738166167472 } from "./migrations/1738166167472-CreateSchema";
|
||||
|
||||
const dataSource = new DataSource({
|
||||
type: DB_TYPE as any,
|
||||
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : DB_HOST,
|
||||
host: DB_HOST,
|
||||
port: DB_PORT,
|
||||
username: DB_USERNAME,
|
||||
password: DB_PASSWORD,
|
||||
|
@ -93,6 +72,7 @@ const dataSource = new DataSource({
|
|||
executivePosition,
|
||||
membershipStatus,
|
||||
qualification,
|
||||
salutation,
|
||||
member,
|
||||
memberAwards,
|
||||
memberExecutivePositions,
|
||||
|
@ -117,36 +97,10 @@ const dataSource = new DataSource({
|
|||
memberExecutivePositionsView,
|
||||
memberQualificationsView,
|
||||
membershipView,
|
||||
webapi,
|
||||
webapiPermission,
|
||||
],
|
||||
migrations: [
|
||||
Initial1724317398939,
|
||||
RefreshPrimaryChange1724573307851,
|
||||
Invite1724579024939,
|
||||
Permissions1724661484664,
|
||||
RolePermission1724771491085,
|
||||
MemberBaseData1725435669492,
|
||||
Memberdata1726301836849,
|
||||
CommunicationFields1727439800630,
|
||||
Ownership1728313041449,
|
||||
Protocol1729347911107,
|
||||
Calendar1729947763295,
|
||||
ResetToken1732358596823,
|
||||
SMSAlarming1732696919191,
|
||||
SecuringCalendarType1733249553766,
|
||||
QueryStore1734187754677,
|
||||
MemberDataViews1734520998539,
|
||||
Template1734854680201,
|
||||
TemplateUsage1734949173739,
|
||||
Newsletter1735118780511,
|
||||
NewsletterConfig1735207446910,
|
||||
InternalId1735822722235,
|
||||
PostalCode1735927918979,
|
||||
ProtocolAbsent1736072179716,
|
||||
Memberlist1736079005086,
|
||||
ExtendViewValues1736084198860,
|
||||
FinishInternalIdTransfer1736505324488,
|
||||
ProtocolPresenceExcuse1737287798828,
|
||||
],
|
||||
migrations: [BackupAndResetDatabase1738166124200, CreateSchema1738166167472],
|
||||
migrationsRun: true,
|
||||
migrationsTransactionMode: "each",
|
||||
subscribers: [],
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { calendar } from "../entity/club/calendar";
|
||||
import { member } from "../entity/club/member/member";
|
||||
import { Salutation } from "../enums/salutation";
|
||||
|
||||
export const newsletterDemoData: {
|
||||
title: string;
|
||||
|
@ -18,7 +17,9 @@ export const newsletterDemoData: {
|
|||
}
|
||||
>
|
||||
>;
|
||||
recipient: Partial<member & { street: string; streetNumber: string; streetNumberAdd: string }>;
|
||||
recipient: Partial<
|
||||
Omit<member, "salutation"> & { salutation: string; street: string; streetNumber: string; streetNumberAdd: string }
|
||||
>;
|
||||
} = {
|
||||
title: "Beispiel Newsletter Daten",
|
||||
description: "Zusammenfassung der Demodaten.",
|
||||
|
@ -63,7 +64,7 @@ export const newsletterDemoData: {
|
|||
recipient: {
|
||||
firstname: "Julian",
|
||||
lastname: "Krauser",
|
||||
salutation: Salutation.sir,
|
||||
salutation: "Herr",
|
||||
nameaffix: "",
|
||||
street: "Straße",
|
||||
streetNumber: "Hausnummer",
|
||||
|
|
|
@ -8,18 +8,20 @@ import {
|
|||
UpdateDateColumn,
|
||||
AfterUpdate,
|
||||
BeforeUpdate,
|
||||
ColumnType,
|
||||
} from "typeorm";
|
||||
import { calendarType } from "../settings/calendarType";
|
||||
import { calendarType } from "../configuration/calendarType";
|
||||
import { getTypeByORM } from "../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class calendar {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({ type: "datetime", nullable: false })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||
starttime: Date;
|
||||
|
||||
@Column({ type: "datetime", nullable: false })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||
endtime: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, nullable: false })
|
||||
|
@ -43,10 +45,14 @@ export class calendar {
|
|||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
|
||||
@Column({ type: "varchar", nullable: true, default: null, unique: true })
|
||||
webpageId: string;
|
||||
|
||||
@ManyToOne(() => calendarType, (t) => t.calendar, {
|
||||
nullable: false,
|
||||
onDelete: "RESTRICT",
|
||||
onUpdate: "RESTRICT",
|
||||
cascade: ["insert"],
|
||||
})
|
||||
type: calendarType;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { member } from "./member";
|
||||
import { communicationType } from "../../settings/communicationType";
|
||||
import { communicationType } from "../../configuration/communicationType";
|
||||
|
||||
@Entity()
|
||||
export class communication {
|
||||
|
@ -13,6 +13,9 @@ export class communication {
|
|||
@Column({ type: "boolean", default: false })
|
||||
isSMSAlarming: boolean;
|
||||
|
||||
@Column({ type: "boolean", default: false })
|
||||
isSendNewsletter: boolean;
|
||||
|
||||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
mobile: string;
|
||||
|
||||
|
@ -35,7 +38,7 @@ export class communication {
|
|||
streetNumberAddition: string;
|
||||
|
||||
@Column()
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
|
||||
@Column()
|
||||
typeId: number;
|
||||
|
@ -51,6 +54,7 @@ export class communication {
|
|||
nullable: false,
|
||||
onDelete: "RESTRICT",
|
||||
onUpdate: "RESTRICT",
|
||||
cascade: ["insert"],
|
||||
})
|
||||
type: communicationType;
|
||||
}
|
||||
|
|
|
@ -1,31 +1,16 @@
|
|||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { Salutation } from "../../../enums/salutation";
|
||||
import { Column, ColumnType, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { membership } from "./membership";
|
||||
import { memberAwards } from "./memberAwards";
|
||||
import { memberQualifications } from "./memberQualifications";
|
||||
import { memberExecutivePositions } from "./memberExecutivePositions";
|
||||
import { communication } from "./communication";
|
||||
import { CommunicationViewModel } from "../../../viewmodel/admin/club/member/communication.models";
|
||||
import { salutation } from "../../configuration/salutation";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class member {
|
||||
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||
id: number;
|
||||
|
||||
@Column({
|
||||
type: "varchar",
|
||||
length: "255",
|
||||
default: Salutation.none.toString(),
|
||||
transformer: {
|
||||
to(value: Salutation) {
|
||||
return value.toString();
|
||||
},
|
||||
from(value: string) {
|
||||
return Salutation[value as keyof typeof Salutation];
|
||||
},
|
||||
},
|
||||
})
|
||||
salutation: Salutation;
|
||||
@PrimaryColumn({ generated: "uuid", type: "varchar" })
|
||||
id: string;
|
||||
|
||||
@Column({ type: "varchar", length: 255 })
|
||||
firstname: string;
|
||||
|
@ -36,37 +21,41 @@ export class member {
|
|||
@Column({ type: "varchar", length: 255 })
|
||||
nameaffix: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
birthdate: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
||||
internalId?: string;
|
||||
|
||||
@OneToMany(() => communication, (communications) => communications.member)
|
||||
@Column()
|
||||
salutationId: number;
|
||||
|
||||
@ManyToOne(() => salutation, (salutation) => salutation.members, {
|
||||
nullable: false,
|
||||
onDelete: "RESTRICT",
|
||||
onUpdate: "RESTRICT",
|
||||
cascade: ["insert"],
|
||||
})
|
||||
salutation: salutation;
|
||||
|
||||
@OneToMany(() => communication, (communications) => communications.member, { cascade: ["insert"] })
|
||||
communications: communication[];
|
||||
|
||||
@OneToOne(() => communication, {
|
||||
nullable: true,
|
||||
onDelete: "SET NULL",
|
||||
onUpdate: "RESTRICT",
|
||||
})
|
||||
@JoinColumn()
|
||||
sendNewsletter?: communication;
|
||||
|
||||
@OneToMany(() => membership, (membership) => membership.member)
|
||||
@OneToMany(() => membership, (membership) => membership.member, { cascade: ["insert"] })
|
||||
memberships: membership[];
|
||||
|
||||
@OneToMany(() => memberAwards, (awards) => awards.member)
|
||||
@OneToMany(() => memberAwards, (awards) => awards.member, { cascade: ["insert"] })
|
||||
awards: memberAwards[];
|
||||
|
||||
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member)
|
||||
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member, { cascade: ["insert"] })
|
||||
positions: memberExecutivePositions[];
|
||||
|
||||
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member)
|
||||
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member, { cascade: ["insert"] })
|
||||
qualifications: memberQualifications[];
|
||||
|
||||
firstMembershipEntry?: membership;
|
||||
lastMembershipEntry?: membership;
|
||||
preferredCommunication?: Array<communication>;
|
||||
smsAlarming?: Array<communication>;
|
||||
sendNewsletter?: communication;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue