Compare commits

...

141 commits
v1.2.2 ... main

Author SHA1 Message Date
fa5e778d0c 1.4.2 2025-04-18 11:10:45 +02:00
c2c782985c Merge pull request 'patches v1.4.2' (#91) from develop into main
Reviewed-on: #91
2025-04-18 09:10:13 +00:00
57848ff29b Merge branch 'main' into develop 2025-04-18 09:09:40 +00:00
3a956919b2 hotfix: template backup restore 2025-04-17 13:41:04 +02:00
77fd3697b3 1.4.1 2025-04-17 09:26:21 +02:00
412871842f Merge pull request 'patches v1.4.1' (#90) from develop into main
Reviewed-on: #90
2025-04-17 07:24:34 +00:00
7910b561ea Merge branch 'main' into develop 2025-04-17 07:24:25 +00:00
097236c3e0 hotfix: backup failed of queryId 2025-04-17 09:22:41 +02:00
8bee509090 fix: pass updatedAt in response 2025-04-17 09:17:31 +02:00
7e66353da1 1.4.0 2025-04-16 17:02:29 +02:00
839360f380 Merge pull request 'minor v1.4.0' (#89) from develop into main
Reviewed-on: #89
2025-04-16 15:01:05 +00:00
a43d755fe8 Merge branch 'main' into develop 2025-04-16 15:00:47 +00:00
78d0e9b8a9 Merge pull request 'feature/#42-query-builder-joins' (#88) from feature/#42-query-builder-joins into develop
Reviewed-on: #88
2025-04-16 14:39:48 +00:00
fd2f49f175 custom join by condition 2025-04-16 16:35:03 +02:00
6d5d8d9ded extend join structure for custom join 2025-04-16 16:11:33 +02:00
f1ed6d095a enhance: add updateAt column to query 2025-04-16 11:33:11 +02:00
9fefd93f09 Merge pull request '#41-query-builder-sorting' (#87) from #41-query-builder-sorting into develop
Reviewed-on: #87
2025-04-15 08:47:22 +00:00
68ddd4dec4 query builder where clause error 2025-04-15 10:29:40 +02:00
e08b7e8683 compatability layer 2025-04-15 10:09:08 +02:00
dbafd568dd sort by new query structure 2025-04-15 10:02:15 +02:00
16f6846d89 enhance: add endpoint to fetch query data by query store id 2025-04-14 09:28:26 +02:00
fdf67d4763 Merge pull request 'version-update' (#86) from version-update into develop
Reviewed-on: #86
2025-04-13 14:39:36 +00:00
55d7ce2eee update 2025-04-13 16:28:47 +02:00
5923e650fa update packages 2025-04-12 15:18:31 +02:00
d6ae83415d 1.3.12 2025-04-11 08:14:58 +02:00
dff3e49aeb Merge pull request 'patches v1.3.12' (#84) from develop into main
Reviewed-on: #84
2025-04-11 06:13:56 +00:00
f914cf25a6 Merge branch 'main' into develop 2025-04-11 06:13:52 +00:00
b934953aca hotfix: column type of newsletter texts 2025-04-11 08:13:55 +02:00
427e5d9288 1.3.11 2025-04-10 12:48:32 +02:00
81ecfcee1e Merge pull request 'patches v1.3.11' (#83) from develop into main
Reviewed-on: #83
2025-04-10 10:47:12 +00:00
cee8912191 Merge branch 'main' into develop 2025-04-10 10:47:00 +00:00
2e88c8db54 undo: count of print 2025-04-10 12:45:29 +02:00
2a7a0ad523 fix: name of job emit 2025-04-10 12:32:08 +02:00
2942d9a059 fix: sort dates in newsletter print 2025-04-10 12:28:41 +02:00
8e80901c0f optimize: browser open / close at sequential printing 2025-04-10 12:28:26 +02:00
e3ff3456ad fix: member commumication update 2025-04-10 10:02:32 +02:00
a660642bbb fix: string replacement on all occurances 2025-04-10 08:07:11 +02:00
8c333b1b89 enhance: provide count of receivers at newsletter 2025-04-10 08:02:32 +02:00
43f397f0e2 fix: prevent whitespace in printout filename 2025-04-09 20:08:19 +02:00
a05e7fcf63 fix: prevent print all by empty ids array 2025-04-09 20:07:56 +02:00
74ff6838cc populate Admin Rights by Ownership to permission object 2025-04-08 09:26:18 +02:00
a5f3a64c00 1.3.10 2025-04-07 16:28:56 +02:00
fc5a6634ef Merge pull request 'patches v1.3.10' (#82) from develop into main
Reviewed-on: #82
2025-04-07 14:28:07 +00:00
d7cb8eb475 Merge branch 'main' into develop 2025-04-07 14:27:44 +00:00
cee4abc6a5 fix: Newsletter printing 2025-04-07 16:27:47 +02:00
81cb810546 1.3.9 2025-04-07 15:34:42 +02:00
edf509afae Merge pull request 'patches v1.3.9' (#81) from develop into main
Reviewed-on: #81
2025-04-07 13:33:30 +00:00
1f7c2c97fe Merge branch 'main' into develop 2025-04-07 13:33:05 +00:00
daa0dda4db change: optimized member search 2025-04-03 08:10:00 +02:00
240943210e change: more precise member search 2025-04-02 08:37:33 +02:00
c3f88dc8fa 1.3.8 2025-03-28 22:30:32 +01:00
f9485fc31d Merge pull request 'patches v1.3.8' (#80) from develop into main
Reviewed-on: #80
2025-03-28 21:29:31 +00:00
1e22968d05 Merge branch 'main' into develop 2025-03-28 21:29:21 +00:00
7b27c7d49a fix: check template usages being present after backup 2025-03-28 22:28:07 +01:00
df231d6462 change: make query id to uuid 2025-03-26 09:10:08 +01:00
7664f68567 1.3.7 2025-03-24 09:22:52 +01:00
e52140a8d2 Merge pull request 'patches v1.3.7' (#79) from develop into main
Reviewed-on: #79
2025-03-24 08:21:20 +00:00
c0a0365406 Merge branch 'main' into develop 2025-03-24 08:21:08 +00:00
eb4db01b27 hotfix: insert or update with postgres 2025-03-24 09:19:11 +01:00
7fdae81680 1.3.6 2025-03-21 10:49:17 +01:00
d59f5b0767 Merge pull request 'patches v1.3.3' (#78) from develop into main
Reviewed-on: #78
2025-03-21 09:47:59 +00:00
1f5ddc05d2 Merge branch 'main' into develop 2025-03-21 09:47:31 +00:00
2aa7ea99ac squash: combine template and protocol migrations 2025-03-21 10:44:30 +01:00
6e618e7531 Merge pull request 'feature/#65-protocol-content-sort' (#77) from feature/#69-protcol-content-sort into develop
Reviewed-on: #77
2025-03-21 09:35:03 +00:00
2e5b345daa add sorting to protocol agenda, decision and votings 2025-03-21 09:46:29 +01:00
4b6f0b34df Merge pull request 'feature/#35-list-printing' (#76) from feature/#35-list-printing into develop
Reviewed-on: #76
2025-03-19 14:25:14 +00:00
f8a5183f1a system queries + custom template selection 2025-03-19 15:19:03 +01:00
a085de6e2f base structure for list printing with custom template 2025-03-18 16:54:53 +01:00
e2a916f37d Merge pull request 'feature/#33-print-member' (#75) from feature/#33-print-member into develop
Reviewed-on: #75
2025-03-18 09:27:23 +00:00
14957c2abc template improvements & handlebars helpers 2025-03-18 10:26:05 +01:00
de5e4afffb demo data & template usage 2025-03-17 11:56:17 +01:00
2f72cc3925 template + route & controller 2025-03-16 17:42:51 +01:00
d6a13d657b member base template 2025-03-15 09:05:22 +01:00
0c44b01037 fix: calendar alarms 2025-03-14 13:17:25 +01:00
0080728610 1.3.5 2025-03-12 09:54:01 +01:00
a0cb25106d Merge pull request 'patches v1.3.5' (#74) from develop into main
Reviewed-on: #74
2025-03-12 08:52:48 +00:00
49cb4e4d23 Merge branch 'main' into develop
# Conflicts:
#	package-lock.json
2025-03-12 09:51:43 +01:00
da78c17235 change: query builder fetch all 2025-02-16 13:32:10 +01:00
7904a98d5f change: namings for FF Admin 2025-02-16 10:21:10 +01:00
1ee94b48ba license update finish 2025-02-16 09:53:28 +01:00
12bf239085 change of License: GPLv3 -> AGPLv3later 2025-02-16 08:42:05 +01:00
c35a549100 Merge pull request 'feature/#63-System-naming' (#72) from feature/#63-System-naming into develop
Reviewed-on: #72
2025-02-15 10:56:25 +00:00
357c27861b permission type rename 2025-02-15 11:16:38 +01:00
a09c75a998 change folder structure 2025-02-15 10:59:54 +01:00
a332e4d779 change: default calendar status 2025-02-11 11:39:49 +01:00
c984d1ef2f fix: undefined year, month, day values on postgres statistics 2025-02-10 10:29:51 +01:00
6263b410c6 1.3.4 2025-02-09 17:26:34 +01:00
c787761335 Merge pull request 'patches v1.3.4' (#62) from develop into main
Reviewed-on: #62
2025-02-09 16:25:57 +00:00
eb9139dbd0 Merge branch 'main' into develop 2025-02-09 16:25:37 +00:00
08a893aa0e fix: newsletter send error 2025-02-09 17:23:54 +01:00
a5bd9ec114 fix: ComTyp Field hide 2025-02-08 12:55:08 +01:00
b196f684e7 ENV Update 2025-02-08 12:54:50 +01:00
e4f6b095df 1.3.3 2025-02-08 11:06:39 +01:00
0539ae9f9a Merge pull request 'patches v1.3.3' (#61) from develop into main
Reviewed-on: #61
2025-02-08 10:06:21 +00:00
34a0a35d40 Merge branch 'main' into develop 2025-02-08 10:06:13 +00:00
c02cc81ad6 fix: postgres refresh requests fail userId 2025-02-08 11:05:01 +01:00
80b083f1aa change: trust proxy option 2025-02-08 11:04:46 +01:00
f4747e3d53 1.3.2 2025-02-08 09:31:35 +01:00
2f5c59b598 Merge pull request 'patches v1.3.2' (#60) from develop into main
Reviewed-on: #60
2025-02-08 08:31:01 +00:00
1006a2b1c1 Merge branch 'main' into develop 2025-02-08 08:30:46 +00:00
ad2232969f change: security with ENV 2025-02-08 09:30:41 +01:00
2e69f87578 change: viewmodell reading 2025-02-08 09:00:50 +01:00
8b08dda934 change: Api Security and Rate Limiting 2025-02-07 17:27:45 +01:00
465663a7e9 1.3.1 2025-02-07 09:42:18 +01:00
4d454f24da Merge pull request 'patches v1.3.1' (#59) from develop into main
Reviewed-on: #59
2025-02-07 08:41:30 +00:00
311a34f4b9 Merge branch 'main' into develop 2025-02-07 08:41:18 +00:00
db1d830a2e fix: member request was not working with postgres 2025-02-07 09:35:57 +01:00
3f3ad9ca58 reintroduce newsletter config 2025-02-05 10:22:51 +01:00
2ce56a49bb Readme & Env Example Updates 2025-02-04 11:03:27 +01:00
872e6ef9fe fix: newsletter receiver backup and env Defaults 2025-02-03 16:34:49 +01:00
e8a10091af 1.3.0 2025-02-03 13:54:22 +01:00
b39e2233e8 Merge pull request 'minor v1.3.0' (#58) from develop into main
Reviewed-on: #58
2025-02-03 12:52:05 +00:00
c3e8b6b53b change ids to body 2025-02-03 11:26:43 +01:00
b336329966 post route to get ids 2025-02-03 11:25:13 +01:00
a24ee9fc4a install pg for usage 2025-02-03 11:15:26 +01:00
d7275ac9eb Merge pull request 'feature/#34-backup-&-import' (#57) from feature/#34-backup-&-import into develop
Reviewed-on: #57
2025-02-03 10:08:18 +00:00
0d6103170a split uploaded and generated backups 2025-02-03 11:03:31 +01:00
542a77fbef fix backup await 2025-02-02 16:37:55 +01:00
6330ebd01d backup serving, storing and restoring 2025-02-02 16:23:44 +01:00
fc01263c4e enhance views to display exact year, month, day values
sqlite displays negative days and months
2025-02-01 18:09:58 +01:00
a73c712626 transform migrations to work with mysql, postgres and sqlite
sqlite currently fails syntax of views
2025-02-01 13:11:10 +01:00
2cee8b5119 calendar externa prefix 2025-01-31 17:48:20 +01:00
ee60f497fa improved backup restore 2025-01-31 13:58:07 +01:00
0f621ac46d Merge branch 'develop' into feature/#34-backup-&-import
# Conflicts:
#	src/command/club/member/memberCommandHandler.ts
#	src/data-source.ts
#	src/entity/club/member/member.ts
#	src/service/club/member/memberService.ts
2025-01-31 11:51:38 +01:00
0468a4f331 Merge branch 'main' into develop 2025-01-31 11:50:39 +01:00
0994274c0c update prevention message 2025-01-31 11:25:00 +01:00
9a1f4a2985 extend backup file with file details 2025-01-31 11:10:08 +01:00
e17eb30aed change: allow read to related data from allowed modules 2025-01-31 11:07:58 +01:00
668d8448da fix: newsletter recipients with type 2025-01-31 11:07:10 +01:00
0b7de992c8 extend base schema for future features 2025-01-31 11:06:02 +01:00
b7b6694407 backup and base schema creation 2025-01-30 15:58:34 +01:00
a91b723f04 default arrays and none existant data inserts 2025-01-30 14:02:42 +01:00
5701313228 restart schema with clean database 2025-01-29 18:10:41 +01:00
f78097b616 create and restore backups 2025-01-29 16:49:34 +01:00
6ae463a784 fix: member update internal id default 2025-01-29 10:05:55 +01:00
f245ff74a8 update database error messages 2025-01-29 09:42:22 +01:00
f89483f878 change user to uuid 2025-01-29 08:53:49 +01:00
07f8e2dbcb Merge branch 'develop' into feature/#34-backup-&-import 2025-01-28 11:10:12 +01:00
4378c02d17 unique fields for tables 2025-01-28 11:09:42 +01:00
684c24e4fd extend ENVs 2025-01-25 16:54:01 +01:00
46ad96c470 move sendNewsletter flag to communication table 2025-01-25 16:37:52 +01:00
321 changed files with 8149 additions and 5239 deletions

View file

@ -1,22 +1,47 @@
DB_TYPE = (mysql|sqlite|...) DB_TYPE = (mysql|sqlite|postgres) # default ist mysql
DB_PORT = number
## BSP für mysql
DB_PORT = 3306
DB_HOST = database_host DB_HOST = database_host
DB_NAME = database_name DB_NAME = database_name
DB_USERNAME = database_username DB_USERNAME = database_username
DB_PASSWORD = database_password 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 SERVER_PORT = portnumber
JWT_SECRET = ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 JWT_SECRET = ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 # besitzt default
JWT_EXPIRATION = [0-9]*(y|d|h|m|s) JWT_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 15m
REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 1d
PWA_REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) PWA_REFRESH_EXPIRATION = [0-9]*(y|d|h|m|s) # default ist 5d
MAIL_USERNAME = mail_username MAIL_USERNAME = mail_username
MAIL_PASSWORD = mail_password MAIL_PASSWORD = mail_password
MAIL_HOST = mail_hoststring MAIL_HOST = mail_hoststring
MAIL_PORT = mail_portnumber MAIL_PORT = mail_portnumber # default ist 587
MAIL_SECURE (true|false) // true for port 465, fals for other ports MAIL_SECURE = (true|false) # true für port 465, false für anders gewählten port
CLUB_NAME = clubname #default FF Admin CLUB_NAME = clubname #default FF Admin
CLUB_WEBSITE = https://my-club-website-url 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.

3
.gitignore vendored
View file

@ -132,4 +132,5 @@ dist
files files
.idea .idea
*.db

View file

@ -1,4 +1,4 @@
FROM node:18-alpine AS build FROM node:22-alpine AS build
RUN apk add --no-cache \ RUN apk add --no-cache \
chromium \ chromium \
@ -20,7 +20,7 @@ COPY . /app
RUN npm run build RUN npm run build
FROM node:18-alpine AS prod FROM node:22-alpine AS prod
RUN apk add --no-cache \ RUN apk add --no-cache \
chromium \ chromium \
@ -32,7 +32,7 @@ RUN apk add --no-cache \
WORKDIR /app WORKDIR /app
RUN mkdir -p /app/export RUN mkdir -p /app/files
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

183
LICENSE
View file

@ -1,71 +1,68 @@
GNU GENERAL PUBLIC LICENSE GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 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. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble 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. 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. 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.
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.
The precise terms and conditions for copying, distribution and modification follow. The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS TERMS AND CONDITIONS
0. Definitions. 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. 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. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work. The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions. 2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
@ -80,153 +77,159 @@ You may charge any price or no price for each copy that you convey, and you may
5. Conveying Modified Source Versions. 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date. 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. 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. 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. 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: 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:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
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 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). 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).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
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. 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. 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. 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.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
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. 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. 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. 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. 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).
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. 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.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
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. 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. 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.
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. 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. 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.
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. 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. 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. 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. 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. 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. 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. 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
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. 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. 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.
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. 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. 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. 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. 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. 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. 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 END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs 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. 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 ff-admin-server
Copyright (C) 2024 Ehrenamt 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. 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 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/>.
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>.

View file

@ -25,7 +25,7 @@ services:
container_name: ff_member_administration_server container_name: ff_member_administration_server
restart: unless-stopped restart: unless-stopped
environment: environment:
- DB_TYPE=<mysql|sqlite> # default ist auf mysql gesetzt - DB_TYPE=<mysql|sqlite|postgres> # default ist auf mysql gesetzt
- DB_HOST=ff-db - DB_HOST=ff-db
- DB_PORT=<number> # default ist auf 3306 gesetzt - DB_PORT=<number> # default ist auf 3306 gesetzt
- DB_NAME=ffadmin - DB_NAME=ffadmin
@ -38,10 +38,20 @@ services:
- MAIL_USERNAME=<mailadress|username> - MAIL_USERNAME=<mailadress|username>
- MAIL_PASSWORD=<password> - MAIL_PASSWORD=<password>
- MAIL_HOST=<url> - 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 - MAIL_SECURE=<boolean> # default ist auf false gesetzt
- CLUB_NAME=<tobemodified> # default ist auf FF Admin gesetzt - CLUB_NAME=<tobemodified> # default ist auf FF Admin gesetzt
- CLUB_WEBSITE=<tobemodified> - 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: volumes:
- <volume|local path>:/app/files - <volume|local path>:/app/files
networks: networks:
@ -62,11 +72,27 @@ services:
- <volume|local path>:/var/lib/mysql - <volume|local path>:/var/lib/mysql
networks: networks:
- ff_internal - 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: networks:
ff_internal: 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: Führen Sie dann den folgenden Befehl im Verzeichnis der compose-Datei aus, um den Container zu starten:
```sh ```sh

4083
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "ff-admin-server", "name": "ff-admin-server",
"version": "1.2.2", "version": "1.4.2",
"description": "Feuerwehr/Verein Mitgliederverwaltung Server", "description": "Feuerwehr/Verein Mitgliederverwaltung Server",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
@ -22,42 +22,56 @@
"Feuerwehr" "Feuerwehr"
], ],
"author": "JK Effects", "author": "JK Effects",
"license": "GPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^5.0.0-beta.3", "express": "^5.1.0",
"express-rate-limit": "^7.5.0",
"express-validator": "^7.2.1",
"handlebars": "^4.7.8", "handlebars": "^4.7.8",
"helmet": "^8.0.0",
"ics": "^3.8.1", "ics": "^3.8.1",
"ip": "^2.0.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"lodash.uniqby": "^4.7.0",
"moment": "^2.30.1", "moment": "^2.30.1",
"morgan": "^1.10.0",
"ms": "^2.1.3", "ms": "^2.1.3",
"multer": "^1.4.5-lts.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"node-schedule": "^2.1.1", "node-schedule": "^2.1.1",
"nodemailer": "^6.9.14", "nodemailer": "^6.10.1",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"puppeteer": "^23.11.1", "pg": "^8.13.1",
"puppeteer": "^24.6.1",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"reflect-metadata": "^0.2.2", "reflect-metadata": "^0.2.2",
"rss-parser": "^3.13.0", "rss-parser": "^3.13.0",
"socket.io": "^4.7.5", "socket.io": "^4.7.5",
"speakeasy": "^2.0.0", "speakeasy": "^2.0.0",
"sqlite3": "^5.1.7",
"typeorm": "^0.3.20", "typeorm": "^0.3.20",
"uuid": "^10.0.0" "uuid": "^11.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/cors": "^2.8.14", "@types/cors": "^2.8.14",
"@types/express": "^4.17.17", "@types/express": "^5.0.1",
"@types/ip": "^1.1.3",
"@types/jsonwebtoken": "^9.0.6", "@types/jsonwebtoken": "^9.0.6",
"@types/ms": "^0.7.34", "@types/lodash.uniqby": "^4.7.9",
"@types/morgan": "^1.9.9",
"@types/ms": "^2.1.0",
"@types/multer": "^1.4.12",
"@types/mysql": "^2.15.21", "@types/mysql": "^2.15.21",
"@types/node": "^16.18.41", "@types/node": "^22.14.1",
"@types/node-schedule": "^2.1.6", "@types/node-schedule": "^2.1.6",
"@types/nodemailer": "^6.4.14", "@types/nodemailer": "^6.4.14",
"@types/pg": "~8.11.12",
"@types/qrcode": "~1.5.5", "@types/qrcode": "~1.5.5",
"@types/speakeasy": "^2.0.10", "@types/speakeasy": "^2.0.10",
"@types/uuid": "^9.0.2", "@types/uuid": "^10.0.0",
"ts-node": "10.7.0", "ts-node": "10.9.2",
"typescript": "^4.5.2" "typescript": "^5.8.3"
} }
} }

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { calendar } from "../../../entity/club/calendar"; 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 InternalException from "../../../exceptions/internalException";
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand"; import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "./calendarCommand";
@ -33,7 +34,7 @@ export default abstract class CalendarCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting calendar", err); throw new DatabaseActionException("DELETE", "calendar", err);
}); });
} }
} }

View file

@ -9,7 +9,7 @@ export interface CreateCommunicationCommand {
street: string; street: string;
streetNumber: number; streetNumber: number;
streetNumberAddition: string; streetNumberAddition: string;
memberId: number; memberId: string;
typeId: number; typeId: number;
} }
@ -25,10 +25,10 @@ export interface UpdateCommunicationCommand {
street: string; street: string;
streetNumber: number; streetNumber: number;
streetNumberAddition: string; streetNumberAddition: string;
memberId: number; memberId: string;
} }
export interface DeleteCommunicationCommand { export interface DeleteCommunicationCommand {
id: number; id: number;
memberId: number; memberId: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { communication } from "../../../entity/club/member/communication"; import { communication } from "../../../entity/club/member/communication";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateCommunicationCommand, CreateCommunicationCommand,
@ -17,6 +18,17 @@ export default abstract class CommunicationCommandHandler {
let insertId = -1; let insertId = -1;
return await dataSource return await dataSource
.transaction(async (manager) => { .transaction(async (manager) => {
if (createCommunication.isSendNewsletter) {
await manager
.createQueryBuilder()
.update(communication)
.set({
isSendNewsletter: false,
})
.where("memberId = :memberId", { memberId: createCommunication.memberId })
.execute();
}
await manager await manager
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
@ -39,22 +51,12 @@ export default abstract class CommunicationCommandHandler {
.then((result) => { .then((result) => {
insertId = 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(() => { .then(() => {
return insertId; return insertId;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating communication", err); throw new DatabaseActionException("CREATE", "communication", err);
}); });
} }
@ -66,6 +68,17 @@ export default abstract class CommunicationCommandHandler {
static async update(updateCommunication: UpdateCommunicationCommand): Promise<void> { static async update(updateCommunication: UpdateCommunicationCommand): Promise<void> {
return await dataSource return await dataSource
.transaction(async (manager) => { .transaction(async (manager) => {
if (updateCommunication.isSendNewsletter) {
await manager
.createQueryBuilder()
.update(communication)
.set({
isSendNewsletter: false,
})
.where("memberId = :memberId", { memberId: updateCommunication.memberId })
.execute();
}
await manager await manager
.createQueryBuilder() .createQueryBuilder()
.update(communication) .update(communication)
@ -84,20 +97,10 @@ export default abstract class CommunicationCommandHandler {
.where("id = :id", { id: updateCommunication.id }) .where("id = :id", { id: updateCommunication.id })
.andWhere("memberId = :memberId", { memberId: updateCommunication.memberId }) .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(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed updating communication", err); throw new DatabaseActionException("UPDATE", "communication", err);
}); });
} }
@ -116,7 +119,7 @@ export default abstract class CommunicationCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting communication", err); throw new DatabaseActionException("DELETE", "communication", err);
}); });
} }
} }

View file

@ -2,7 +2,7 @@ export interface CreateMemberAwardCommand {
given: boolean; given: boolean;
note?: string; note?: string;
date: Date; date: Date;
memberId: number; memberId: string;
awardId: number; awardId: number;
} }
@ -11,11 +11,11 @@ export interface UpdateMemberAwardCommand {
given: boolean; given: boolean;
note?: string; note?: string;
date: Date; date: Date;
memberId: number; memberId: string;
awardId: number; awardId: number;
} }
export interface DeleteMemberAwardCommand { export interface DeleteMemberAwardCommand {
id: number; id: number;
memberId: number; memberId: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { memberAwards } from "../../../entity/club/member/memberAwards"; import { memberAwards } from "../../../entity/club/member/memberAwards";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand"; import { CreateMemberAwardCommand, DeleteMemberAwardCommand, UpdateMemberAwardCommand } from "./memberAwardCommand";
@ -26,7 +27,7 @@ export default abstract class MemberAwardCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting memberAward", err); throw new DatabaseActionException("DELETE", "memberAward", err);
}); });
} }
} }

View file

@ -8,7 +8,7 @@ export interface CreateMemberCommand {
} }
export interface UpdateMemberCommand { export interface UpdateMemberCommand {
id: number; id: string;
salutationId: number; salutationId: number;
firstname: string; firstname: string;
lastname: string; lastname: string;
@ -18,5 +18,5 @@ export interface UpdateMemberCommand {
} }
export interface DeleteMemberCommand { export interface DeleteMemberCommand {
id: number; id: string;
} }

View file

@ -1,6 +1,7 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { communication } from "../../../entity/club/member/communication"; import { communication } from "../../../entity/club/member/communication";
import { member } from "../../../entity/club/member/member"; import { member } from "../../../entity/club/member/member";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand"; import { CreateMemberCommand, DeleteMemberCommand, UpdateMemberCommand } from "./memberCommand";
@ -28,10 +29,7 @@ export default abstract class MemberCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("CREATE", "member", err);
`Failed creating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
}); });
} }
@ -56,10 +54,7 @@ export default abstract class MemberCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("UPDATE", "member", err);
`Failed updating member${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
}); });
} }
@ -77,7 +72,7 @@ export default abstract class MemberCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting member", err); throw new DatabaseActionException("DELETE", "member", err);
}); });
} }
} }

View file

@ -2,7 +2,7 @@ export interface CreateMemberExecutivePositionCommand {
note?: string; note?: string;
start: Date; start: Date;
end?: Date; end?: Date;
memberId: number; memberId: string;
executivePositionId: number; executivePositionId: number;
} }
@ -11,11 +11,11 @@ export interface UpdateMemberExecutivePositionCommand {
note?: string; note?: string;
start: Date; start: Date;
end?: Date; end?: Date;
memberId: number; memberId: string;
executivePositionId: number; executivePositionId: number;
} }
export interface DeleteMemberExecutivePositionCommand { export interface DeleteMemberExecutivePositionCommand {
id: number; id: number;
memberId: number; memberId: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions"; import { memberExecutivePositions } from "../../../entity/club/member/memberExecutivePositions";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateMemberExecutivePositionCommand, CreateMemberExecutivePositionCommand,
@ -30,7 +31,7 @@ export default abstract class MemberExecutivePositionCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting memberExecutivePosition", err); throw new DatabaseActionException("DELETE", "memberExecutivePosition", err);
}); });
} }
} }

View file

@ -1,7 +1,7 @@
export interface CreateMemberQualificationCommand { export interface CreateMemberQualificationCommand {
note?: string; note?: string;
start: Date; start: Date;
memberId: number; memberId: string;
qualificationId: number; qualificationId: number;
} }
@ -11,11 +11,11 @@ export interface UpdateMemberQualificationCommand {
start: Date; start: Date;
end?: Date; end?: Date;
terminationReason?: string; terminationReason?: string;
memberId: number; memberId: string;
qualificationId: number; qualificationId: number;
} }
export interface DeleteMemberQualificationCommand { export interface DeleteMemberQualificationCommand {
id: number; id: number;
memberId: number; memberId: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { memberQualifications } from "../../../entity/club/member/memberQualifications"; import { memberQualifications } from "../../../entity/club/member/memberQualifications";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateMemberQualificationCommand, CreateMemberQualificationCommand,
@ -29,7 +30,7 @@ export default abstract class MemberQualificationCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting memberQualification", err); throw new DatabaseActionException("DELETE", "memberQualification", err);
}); });
} }
} }

View file

@ -1,6 +1,6 @@
export interface CreateMembershipCommand { export interface CreateMembershipCommand {
start: Date; start: Date;
memberId: number; memberId: string;
statusId: number; statusId: number;
} }
@ -9,11 +9,11 @@ export interface UpdateMembershipCommand {
start: Date; start: Date;
end?: Date; end?: Date;
terminationReason?: string; terminationReason?: string;
memberId: number; memberId: string;
statusId: number; statusId: number;
} }
export interface DeleteMembershipCommand { export interface DeleteMembershipCommand {
id: number; id: number;
memberId: number; memberId: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { membership } from "../../../entity/club/member/membership"; import { membership } from "../../../entity/club/member/membership";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand"; import { CreateMembershipCommand, DeleteMembershipCommand, UpdateMembershipCommand } from "./membershipCommand";
@ -43,7 +44,7 @@ export default abstract class MembershipCommandHandler {
return insertId; return insertId;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting membership", err); throw new DatabaseActionException("DELETE", "membership", err);
}); });
} }
} }

View file

@ -9,7 +9,7 @@ export interface SynchronizeNewsletterCommand {
newsletterTitle: string; newsletterTitle: string;
newsletterText: string; newsletterText: string;
newsletterSignatur: string; newsletterSignatur: string;
recipientsByQueryId?: number; recipientsByQueryId?: string;
} }
export interface SendNewsletterCommand { export interface SendNewsletterCommand {

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { newsletter } from "../../../entity/club/newsletter/newsletter"; import { newsletter } from "../../../entity/club/newsletter/newsletter";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand"; import { CreateNewsletterCommand, SendNewsletterCommand, SynchronizeNewsletterCommand } from "./newsletterCommand";
@ -22,7 +23,7 @@ export default abstract class NewsletterCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed setting newsletter send state", err); throw new DatabaseActionException("SET SEND STATE", "newsletter", err);
}); });
} }
} }

View file

@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService"; import NewsletterDatesService from "../../../service/club/newsletter/newsletterDatesService";
import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand"; import { NewsletterDateCommand, SynchronizeNewsletterDatesCommand } from "./newsletterDatesCommand";
import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates"; import { newsletterDates } from "../../../entity/club/newsletter/newsletterDates";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterDatesCommandHandler { export default abstract class NewsletterDatesCommandHandler {
/** /**
@ -42,7 +43,7 @@ export default abstract class NewsletterDatesCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed syncing newsletter dates", err); throw new DatabaseActionException("SYNC", "newsletterDates", err);
}); });
} }

View file

@ -1,4 +1,4 @@
export interface SynchronizeNewsletterRecipientsCommand { export interface SynchronizeNewsletterRecipientsCommand {
newsletterId: number; newsletterId: number;
recipients: Array<number>; recipients: Array<string>;
} }

View file

@ -4,6 +4,7 @@ import InternalException from "../../../exceptions/internalException";
import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService"; import NewsletterRecipientsService from "../../../service/club/newsletter/newsletterRecipientsService";
import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand"; import { SynchronizeNewsletterRecipientsCommand } from "./newsletterRecipientsCommand";
import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients"; import { newsletterRecipients } from "../../../entity/club/newsletter/newsletterRecipients";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class NewsletterRecipientsCommandHandler { export default abstract class NewsletterRecipientsCommandHandler {
/** /**
@ -35,14 +36,14 @@ export default abstract class NewsletterRecipientsCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed syncing newsletter recipients", err); throw new DatabaseActionException("SYNC", "newsletterRecipients", err);
}); });
} }
private static async syncPresenceAdd( private static async syncPresenceAdd(
manager: EntityManager, manager: EntityManager,
newsletterId: number, newsletterId: number,
recipients: Array<number> recipients: Array<string>
): Promise<InsertResult> { ): Promise<InsertResult> {
return await manager return await manager
.createQueryBuilder() .createQueryBuilder()
@ -60,7 +61,7 @@ export default abstract class NewsletterRecipientsCommandHandler {
private static async syncPresenceRemove( private static async syncPresenceRemove(
manager: EntityManager, manager: EntityManager,
newsletterId: number, newsletterId: number,
recipients: Array<number> recipients: Array<string>
): Promise<DeleteResult> { ): Promise<DeleteResult> {
return await manager return await manager
.createQueryBuilder() .createQueryBuilder()

View file

@ -1,6 +1,7 @@
export interface SynchronizeProtocolAgendaCommand { export interface SynchronizeProtocolAgendaCommand {
id?: number; id: number;
topic: string; topic: string;
context: string; context: string;
sort: number;
protocolId: number; protocolId: number;
} }

View file

@ -1,6 +1,8 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda"; import { protocolAgenda } from "../../../entity/club/protocol/protocolAgenda";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import ProtocolAgendaService from "../../../service/club/protocol/protocolAgendaService";
import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand"; import { SynchronizeProtocolAgendaCommand } from "./protocolAgendaCommand";
export default abstract class ProtocolAgendaCommandHandler { export default abstract class ProtocolAgendaCommandHandler {
@ -10,6 +12,7 @@ export default abstract class ProtocolAgendaCommandHandler {
* @returns {Promise<number>} * @returns {Promise<number>}
*/ */
static async create(protocolId: number): Promise<number> { static async create(protocolId: number): Promise<number> {
let count = await ProtocolAgendaService.getInstanceCount(protocolId);
return await dataSource return await dataSource
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
@ -17,6 +20,7 @@ export default abstract class ProtocolAgendaCommandHandler {
.values({ .values({
topic: "", topic: "",
context: "", context: "",
sort: count,
protocolId, protocolId,
}) })
.execute() .execute()
@ -24,7 +28,7 @@ export default abstract class ProtocolAgendaCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("CREATE", "protocolAgenda", err);
}); });
} }
@ -35,15 +39,18 @@ export default abstract class ProtocolAgendaCommandHandler {
*/ */
static async sync(syncProtocolAgenda: Array<SynchronizeProtocolAgendaCommand>): Promise<void> { static async sync(syncProtocolAgenda: Array<SynchronizeProtocolAgendaCommand>): Promise<void> {
return await dataSource return await dataSource
.createQueryBuilder() .transaction(async (transactionalEntityManager) => {
.insert() for (const agenda of syncProtocolAgenda) {
.into(protocolAgenda) await transactionalEntityManager
.values(syncProtocolAgenda) .createQueryBuilder()
.orUpdate(["topic", "context"], ["id"]) .update(protocolAgenda)
.execute() .set(agenda)
.then(() => {}) .where({ id: agenda.id })
.execute();
}
})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("SYNC", "protocolAgenda", err);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { protocol } from "../../../entity/club/protocol/protocol"; import { protocol } from "../../../entity/club/protocol/protocol";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand"; import { CreateProtocolCommand, SynchronizeProtocolCommand } from "./protocolCommand";
@ -23,7 +24,7 @@ export default abstract class ProtocolCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("SYNC", "protocol", err);
}); });
} }
} }

View file

@ -1,6 +1,7 @@
export interface SynchronizeProtocolDecisionCommand { export interface SynchronizeProtocolDecisionCommand {
id?: number; id: number;
topic: string; topic: string;
context: string; context: string;
sort: number;
protocolId: number; protocolId: number;
} }

View file

@ -1,6 +1,8 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { protocolDecision } from "../../../entity/club/protocol/protocolDecision"; import { protocolDecision } from "../../../entity/club/protocol/protocolDecision";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import ProtocolDecisionService from "../../../service/club/protocol/protocolDecisionService";
import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand"; import { SynchronizeProtocolDecisionCommand } from "./protocolDecisionCommand";
export default abstract class ProtocolDecisionCommandHandler { export default abstract class ProtocolDecisionCommandHandler {
@ -10,6 +12,7 @@ export default abstract class ProtocolDecisionCommandHandler {
* @returns {Promise<number>} * @returns {Promise<number>}
*/ */
static async create(protocolId: number): Promise<number> { static async create(protocolId: number): Promise<number> {
let count = await ProtocolDecisionService.getInstanceCount(protocolId);
return await dataSource return await dataSource
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
@ -17,6 +20,7 @@ export default abstract class ProtocolDecisionCommandHandler {
.values({ .values({
topic: "", topic: "",
context: "", context: "",
sort: count,
protocolId, protocolId,
}) })
.execute() .execute()
@ -24,7 +28,7 @@ export default abstract class ProtocolDecisionCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("CREATE", "protocolDecision", err);
}); });
} }
/** /**
@ -34,15 +38,19 @@ export default abstract class ProtocolDecisionCommandHandler {
*/ */
static async sync(syncProtocolDecisions: Array<SynchronizeProtocolDecisionCommand>): Promise<void> { static async sync(syncProtocolDecisions: Array<SynchronizeProtocolDecisionCommand>): Promise<void> {
return await dataSource return await dataSource
.createQueryBuilder() .transaction(async (transactionalEntityManager) => {
.insert() for (const decision of syncProtocolDecisions) {
.into(protocolDecision) await transactionalEntityManager
.values(syncProtocolDecisions) .createQueryBuilder()
.orUpdate(["topic", "context"], ["id"]) .update(protocolDecision)
.execute() .set(decision)
.where({ id: decision.id })
.execute();
}
})
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("SYNC", "protocolDecision", err);
}); });
} }
} }

View file

@ -4,7 +4,7 @@ export interface SynchronizeProtocolPresenceCommand {
} }
export interface ProtocolPresenceCommand { export interface ProtocolPresenceCommand {
memberId: number; memberId: string;
absent: boolean; absent: boolean;
excused: boolean; excused: boolean;
} }

View file

@ -4,6 +4,7 @@ import { protocolPresence } from "../../../entity/club/protocol/protocolPresence
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService"; import ProtocolPresenceService from "../../../service/club/protocol/protocolPrecenseService";
import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand"; import { ProtocolPresenceCommand, SynchronizeProtocolPresenceCommand } from "./protocolPresenceCommand";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class ProtocolPresenceCommandHandler { export default abstract class ProtocolPresenceCommandHandler {
/** /**
@ -42,7 +43,7 @@ export default abstract class ProtocolPresenceCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed saving protocol presence", err); throw new DatabaseActionException("SYNC", "protocolSresence", err);
}); });
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout"; import { protocolPrintout } from "../../../entity/club/protocol/protocolPrintout";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand"; import { CreateProtocolPrintoutCommand } from "./protocolPrintoutCommand";
@ -25,7 +26,7 @@ export default abstract class ProtocolPrintoutCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("CREATE", "protocolPrintout", err);
}); });
} }
} }

View file

@ -5,5 +5,6 @@ export interface SynchronizeProtocolVotingCommand {
favour: number; favour: number;
abstain: number; abstain: number;
against: number; against: number;
sort: number;
protocolId: number; protocolId: number;
} }

View file

@ -1,6 +1,8 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { protocolVoting } from "../../../entity/club/protocol/protocolVoting"; import { protocolVoting } from "../../../entity/club/protocol/protocolVoting";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import ProtocolVotingService from "../../../service/club/protocol/protocolVotingService";
import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand"; import { SynchronizeProtocolVotingCommand } from "./protocolVotingCommand";
export default abstract class ProtocolVotingCommandHandler { export default abstract class ProtocolVotingCommandHandler {
@ -10,6 +12,7 @@ export default abstract class ProtocolVotingCommandHandler {
* @returns {Promise<number>} * @returns {Promise<number>}
*/ */
static async create(protocolId: number): Promise<number> { static async create(protocolId: number): Promise<number> {
let count = await ProtocolVotingService.getInstanceCount(protocolId);
return await dataSource return await dataSource
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
@ -17,6 +20,7 @@ export default abstract class ProtocolVotingCommandHandler {
.values({ .values({
topic: "", topic: "",
context: "", context: "",
sort: count,
protocolId, protocolId,
}) })
.execute() .execute()
@ -24,7 +28,7 @@ export default abstract class ProtocolVotingCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("CREATE", "protocolVoting", err);
}); });
} }
/** /**
@ -34,15 +38,19 @@ export default abstract class ProtocolVotingCommandHandler {
*/ */
static async sync(syncProtocolVotings: Array<SynchronizeProtocolVotingCommand>): Promise<void> { static async sync(syncProtocolVotings: Array<SynchronizeProtocolVotingCommand>): Promise<void> {
return await dataSource return await dataSource
.createQueryBuilder() .transaction(async (transactionalEntityManager) => {
.insert() for (const voting of syncProtocolVotings) {
.into(protocolVoting) await transactionalEntityManager
.values(syncProtocolVotings) .createQueryBuilder()
.orUpdate(["topic", "context", "favour", "abstain", "against"], ["id"]) .update(protocolVoting)
.execute() .set(voting)
.where({ id: voting.id })
.execute();
}
})
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating protocol", err); throw new DatabaseActionException("SYNC", "protocolVoting", err);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand"; import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "./awardCommand";
@ -22,7 +23,7 @@ export default abstract class AwardCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "award", err);
`Failed deleting award ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand"; import { CreateCalendarTypeCommand, DeleteCalendarTypeCommand, UpdateCalendarTypeCommand } from "./calendarTypeCommand";
@ -25,7 +26,7 @@ export default abstract class CalendarTypeCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "calendarType", err);
`Failed deleting calendarType${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { import {
CreateCommunicationTypeCommand, CreateCommunicationTypeCommand,
@ -27,7 +28,7 @@ export default abstract class CommunicationTypeCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "communicationType", err);
`Failed deleting communicationType${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { import {
CreateExecutivePositionCommand, CreateExecutivePositionCommand,
@ -26,7 +27,7 @@ export default abstract class ExecutivePositionCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "executivePosition", err);
`Failed deleting executivePosition${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { import {
CreateMembershipStatusCommand, CreateMembershipStatusCommand,
@ -26,7 +27,7 @@ export default abstract class MembershipStatusCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "membershipStatus", err);
`Failed deleting membershipStatus${
err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""
}`,
err
);
}); });
} }
} }

View file

@ -4,3 +4,7 @@ export interface SetNewsletterConfigCommand {
comTypeId: number; comTypeId: number;
config: NewsletterConfigType; config: NewsletterConfigType;
} }
export interface DeleteNewsletterConfigCommand {
comTypeId: number;
}

View file

@ -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);
});
}
}

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { import {
CreateQualificationCommand, CreateQualificationCommand,
@ -27,7 +28,7 @@ export default abstract class QualificationCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "qualification", err);
`Failed deleting qualification${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -6,10 +6,10 @@ export interface CreateQueryStoreCommand {
} }
export interface UpdateQueryStoreCommand { export interface UpdateQueryStoreCommand {
id: number; id: string;
query: string | DynamicQueryStructure; query: string | DynamicQueryStructure;
} }
export interface DeleteQueryStoreCommand { export interface DeleteQueryStoreCommand {
id: number; id: string;
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand"; import { CreateQueryStoreCommand, DeleteQueryStoreCommand, UpdateQueryStoreCommand } from "./queryStoreCommand";
@ -24,7 +25,7 @@ export default abstract class QueryStoreCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "queryStore", err);
`Failed deleting queryStore${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { salutation } from "../../../entity/settings/salutation"; import { salutation } from "../../../entity/configuration/salutation";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand"; import { CreateSalutationCommand, DeleteSalutationCommand, UpdateSalutationCommand } from "./salutationCommand";
@ -22,7 +23,7 @@ export default abstract class SalutationCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException("Failed creating salutation", err); throw new DatabaseActionException("CREATE", "salutation", err);
}); });
} }
@ -42,7 +43,7 @@ export default abstract class SalutationCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed updating salutation", err); throw new DatabaseActionException("UPDATE", "salutation", err);
}); });
} }
@ -60,10 +61,7 @@ export default abstract class SalutationCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "salutation", err);
`Failed deleting salutation ${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand"; import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "./templateCommand";
@ -23,7 +24,7 @@ export default abstract class TemplateCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("DELETE", "template", err);
`Failed deleting template${err.code.includes("ER_ROW_IS_REFERENCED") ? " due to referenced data" : ""}`,
err
);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { UpdateTemplateUsageCommand } from "./templateUsageCommand"; import { UpdateTemplateUsageCommand } from "./templateUsageCommand";
@ -24,7 +25,7 @@ export default abstract class TemplateUsageCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed updating templateUsage", err); throw new DatabaseActionException("SET", "templateUsage", err);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand"; import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "./roleCommand";
@ -22,7 +23,7 @@ export default abstract class RoleCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting role", err); throw new DatabaseActionException("DELETE", "role", err);
}); });
} }
} }

View file

@ -1,16 +1,17 @@
import { DeleteResult, EntityManager, InsertResult } from "typeorm"; import { DeleteResult, EntityManager, InsertResult } from "typeorm";
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import RoleService from "../../../service/user/roleService"; import RoleService from "../../../service/management/roleService";
import { import {
CreateRolePermissionCommand, CreateRolePermissionCommand,
DeleteRolePermissionCommand, DeleteRolePermissionCommand,
UpdateRolePermissionsCommand, UpdateRolePermissionsCommand,
} from "./rolePermissionCommand"; } from "./rolePermissionCommand";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import RolePermissionService from "../../../service/user/rolePermissionService"; import RolePermissionService from "../../../service/management/rolePermissionService";
import { PermissionString } from "../../../type/permissionTypes"; import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class RolePermissionCommandHandler { export default abstract class RolePermissionCommandHandler {
/** /**
@ -35,7 +36,7 @@ export default abstract class RolePermissionCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .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 }) .andWhere("permission IN (:...permission)", { permission: permissions })
.execute(); .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);
});
}
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; 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 InternalException from "../../../exceptions/internalException";
import { StringHelper } from "../../../helpers/stringHelper"; import { StringHelper } from "../../../helpers/stringHelper";
import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand"; import { CreateInviteCommand, DeleteInviteCommand } from "./inviteCommand";
@ -31,7 +32,7 @@ export default abstract class InviteCommandHandler {
return token; return token;
}) })
.catch((err) => { .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() .execute()
.then((res) => {}) .then((res) => {})
.catch((err) => { .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() .execute()
.then((res) => {}) .then((res) => {})
.catch((err) => { .catch((err) => {
throw new InternalException("failed invite removal", err); throw new DatabaseActionException("DELETE", "invite", err);
}); });
} }
} }

View file

@ -8,7 +8,7 @@ export interface CreateUserCommand {
} }
export interface UpdateUserCommand { export interface UpdateUserCommand {
id: number; id: string;
mail: string; mail: string;
username: string; username: string;
firstname: string; firstname: string;
@ -16,20 +16,20 @@ export interface UpdateUserCommand {
} }
export interface UpdateUserSecretCommand { export interface UpdateUserSecretCommand {
id: number; id: string;
secret: string; secret: string;
} }
export interface TransferUserOwnerCommand { export interface TransferUserOwnerCommand {
fromId: number; fromId: string;
toId: number; toId: string;
} }
export interface UpdateUserRolesCommand { export interface UpdateUserRolesCommand {
id: number; id: string;
roleIds: Array<number>; roleIds: Array<number>;
} }
export interface DeleteUserCommand { export interface DeleteUserCommand {
id: number; id: string;
} }

View file

@ -1,6 +1,6 @@
import { EntityManager } from "typeorm"; import { EntityManager } from "typeorm";
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { user } from "../../../entity/user/user"; import { user } from "../../../entity/management/user";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateUserCommand, CreateUserCommand,
@ -10,15 +10,16 @@ import {
UpdateUserRolesCommand, UpdateUserRolesCommand,
UpdateUserSecretCommand, UpdateUserSecretCommand,
} from "./userCommand"; } from "./userCommand";
import UserService from "../../../service/user/userService"; import UserService from "../../../service/management/userService";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class UserCommandHandler { export default abstract class UserCommandHandler {
/** /**
* @description create user * @description create user
* @param {CreateUserCommand} createUser * @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 return await dataSource
.createQueryBuilder() .createQueryBuilder()
.insert() .insert()
@ -36,7 +37,7 @@ export default abstract class UserCommandHandler {
return result.identifiers[0].id; return result.identifiers[0].id;
}) })
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .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(() => {}) .then(() => {})
.catch((err) => { .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); 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); return await manager.createQueryBuilder().relation(user, "roles").of(userId).remove(roleId);
} }
@ -145,7 +146,7 @@ export default abstract class UserCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .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() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting user", err); throw new DatabaseActionException("DELETE", "user", err);
}); });
} }
} }

View file

@ -2,15 +2,15 @@ import { PermissionString } from "../../../type/permissionTypes";
export interface CreateUserPermissionCommand { export interface CreateUserPermissionCommand {
permission: PermissionString; permission: PermissionString;
userId: number; userId: string;
} }
export interface DeleteUserPermissionCommand { export interface DeleteUserPermissionCommand {
permission: PermissionString; permission: PermissionString;
userId: number; userId: string;
} }
export interface UpdateUserPermissionsCommand { export interface UpdateUserPermissionsCommand {
userId: number; userId: string;
permissions: Array<PermissionString>; permissions: Array<PermissionString>;
} }

View file

@ -1,16 +1,17 @@
import { DeleteResult, EntityManager, InsertResult } from "typeorm"; import { DeleteResult, EntityManager, InsertResult } from "typeorm";
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { user } from "../../../entity/user/user"; import { user } from "../../../entity/management/user";
import { userPermission } from "../../../entity/user/user_permission"; import { userPermission } from "../../../entity/management/user_permission";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateUserPermissionCommand, CreateUserPermissionCommand,
DeleteUserPermissionCommand, DeleteUserPermissionCommand,
UpdateUserPermissionsCommand, UpdateUserPermissionsCommand,
} from "./userPermissionCommand"; } from "./userPermissionCommand";
import UserPermissionService from "../../../service/user/userPermissionService"; import UserPermissionService from "../../../service/management/userPermissionService";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import { PermissionString } from "../../../type/permissionTypes"; import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class UserPermissionCommandHandler { export default abstract class UserPermissionCommandHandler {
/** /**
@ -36,13 +37,13 @@ export default abstract class UserPermissionCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed saving user permissions", err); throw new DatabaseActionException("UPDATE", "userPermissions", err);
}); });
} }
private static async updatePermissionsAdd( private static async updatePermissionsAdd(
manager: EntityManager, manager: EntityManager,
userId: number, userId: string,
permissions: Array<PermissionString> permissions: Array<PermissionString>
): Promise<InsertResult> { ): Promise<InsertResult> {
return await manager return await manager
@ -61,7 +62,7 @@ export default abstract class UserPermissionCommandHandler {
private static async updatePermissionsRemove( private static async updatePermissionsRemove(
manager: EntityManager, manager: EntityManager,
userId: number, userId: string,
permissions: Array<PermissionString> permissions: Array<PermissionString>
): Promise<DeleteResult> { ): Promise<DeleteResult> {
return await manager return await manager
@ -72,46 +73,4 @@ export default abstract class UserPermissionCommandHandler {
.andWhere("permission IN (:...permission)", { permission: permissions }) .andWhere("permission IN (:...permission)", { permission: permissions })
.execute(); .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);
});
}
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { webapi } from "../../../entity/user/webapi"; import { webapi } from "../../../entity/management/webapi";
import DatabaseActionException from "../../../exceptions/databaseActionException";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import { import {
CreateWebapiCommand, CreateWebapiCommand,
@ -29,10 +30,7 @@ export default abstract class WebapiCommandHandler {
return result.identifiers[0].token; return result.identifiers[0].token;
}) })
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("CREATE", "webapi", err);
`Failed creating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
}); });
} }
@ -53,10 +51,7 @@ export default abstract class WebapiCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException( throw new DatabaseActionException("UPDATE", "webapi", err);
`Failed updating api${err.code.includes("ER_DUP_ENTRY") ? " due to duplicate entry for column" : ""}`,
err
);
}); });
} }
@ -76,7 +71,7 @@ export default abstract class WebapiCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException(`Failed updating api last usage`, err); throw new DatabaseActionException("UPDATE", "webapi", err);
}); });
} }
@ -94,7 +89,7 @@ export default abstract class WebapiCommandHandler {
.execute() .execute()
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed deleting api", err); throw new DatabaseActionException("DELETE", "webapi", err);
}); });
} }
} }

View file

@ -1,16 +1,17 @@
import { DeleteResult, EntityManager, InsertResult } from "typeorm"; import { DeleteResult, EntityManager, InsertResult } from "typeorm";
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import { webapiPermission } from "../../../entity/user/webapi_permission"; import { webapiPermission } from "../../../entity/management/webapi_permission";
import InternalException from "../../../exceptions/internalException"; import InternalException from "../../../exceptions/internalException";
import WebapiService from "../../../service/user/webapiService"; import WebapiService from "../../../service/management/webapiService";
import { import {
CreateWebapiPermissionCommand, CreateWebapiPermissionCommand,
DeleteWebapiPermissionCommand, DeleteWebapiPermissionCommand,
UpdateWebapiPermissionsCommand, UpdateWebapiPermissionsCommand,
} from "./webapiPermissionCommand"; } from "./webapiPermissionCommand";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import WebapiPermissionService from "../../../service/user/webapiPermissionService"; import WebapiPermissionService from "../../../service/management/webapiPermissionService";
import { PermissionString } from "../../../type/permissionTypes"; import { PermissionString } from "../../../type/permissionTypes";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class WebapiPermissionCommandHandler { export default abstract class WebapiPermissionCommandHandler {
/** /**
@ -38,7 +39,7 @@ export default abstract class WebapiPermissionCommandHandler {
}) })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
throw new InternalException("Failed saving api permissions", err); throw new DatabaseActionException("UPDATE", "webapiPermission", err);
}); });
} }
@ -74,46 +75,4 @@ export default abstract class WebapiPermissionCommandHandler {
.andWhere("permission IN (:...permission)", { permission: permissions }) .andWhere("permission IN (:...permission)", { permission: permissions })
.execute(); .execute();
} }
/**
* @description grant permission to user
* @param {CreateWebapiPermissionCommand} createPermission
* @returns {Promise<number>}
*/
static async create(createPermission: CreateWebapiPermissionCommand): Promise<number> {
return await dataSource
.createQueryBuilder()
.insert()
.into(webapiPermission)
.values({
permission: createPermission.permission,
webapiId: createPermission.webapiId,
})
.execute()
.then((result) => {
return result.identifiers[0].id;
})
.catch((err) => {
throw new InternalException("Failed saving api permission", err);
});
}
/**
* @description remove permission from api
* @param {DeleteWebapiPermissionCommand} deletePermission
* @returns {Promise<any>}
*/
static async delete(deletePermission: DeleteWebapiPermissionCommand): Promise<any> {
return await dataSource
.createQueryBuilder()
.delete()
.from(webapiPermission)
.where("webapiId = :id", { id: deletePermission.webapiId })
.andWhere("permission = :permission", { permission: deletePermission.permission })
.execute()
.then(() => {})
.catch((err) => {
throw new InternalException("failed api permission removal", err);
});
}
} }

View file

@ -1,9 +1,9 @@
export interface CreateRefreshCommand { export interface CreateRefreshCommand {
userId: number; userId: string;
isFromPwa?: boolean; isFromPwa?: boolean;
} }
export interface DeleteRefreshCommand { export interface DeleteRefreshCommand {
token: string; token: string;
userId: number; userId: string;
} }

View file

@ -1,9 +1,10 @@
import { dataSource } from "../data-source"; import { dataSource } from "../data-source";
import { refresh } from "../entity/refresh"; import { refresh } from "../entity/refresh";
import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults"; import { PWA_REFRESH_EXPIRATION, REFRESH_EXPIRATION } from "../env.defaults";
import DatabaseActionException from "../exceptions/databaseActionException";
import InternalException from "../exceptions/internalException"; import InternalException from "../exceptions/internalException";
import { StringHelper } from "../helpers/stringHelper"; import { StringHelper } from "../helpers/stringHelper";
import UserService from "../service/user/userService"; import UserService from "../service/management/userService";
import { CreateRefreshCommand, DeleteRefreshCommand } from "./refreshCommand"; import { CreateRefreshCommand, DeleteRefreshCommand } from "./refreshCommand";
import ms from "ms"; import ms from "ms";
@ -22,7 +23,7 @@ export default abstract class RefreshCommandHandler {
.into(refresh) .into(refresh)
.values({ .values({
token: refreshToken, token: refreshToken,
user: await UserService.getById(createRefresh.userId), userId: createRefresh.userId,
expiry: createRefresh.isFromPwa expiry: createRefresh.isFromPwa
? new Date(Date.now() + ms(PWA_REFRESH_EXPIRATION)) ? new Date(Date.now() + ms(PWA_REFRESH_EXPIRATION))
: new Date(Date.now() + ms(REFRESH_EXPIRATION)), : new Date(Date.now() + ms(REFRESH_EXPIRATION)),
@ -32,7 +33,7 @@ export default abstract class RefreshCommandHandler {
return refreshToken; return refreshToken;
}) })
.catch((err) => { .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() .createQueryBuilder()
.delete() .delete()
.from(refresh) .from(refresh)
.where("refresh.token = :token", { token: deleteRefresh.token }) .where({ token: deleteRefresh.token, userId: deleteRefresh.userId })
.andWhere("refresh.userId = :userId", { userId: deleteRefresh.userId })
.execute() .execute()
.then((res) => {}) .then((res) => {})
.catch((err) => { .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() .execute()
.then((res) => {}) .then((res) => {})
.catch((err) => { .catch((err) => {
throw new InternalException("failed expired refresh removal", err); throw new DatabaseActionException("DELETE", "refresh", err);
}); });
} }
} }

View file

@ -1,5 +1,6 @@
import { dataSource } from "../data-source"; import { dataSource } from "../data-source";
import { reset } from "../entity/reset"; import { reset } from "../entity/reset";
import DatabaseActionException from "../exceptions/databaseActionException";
import InternalException from "../exceptions/internalException"; import InternalException from "../exceptions/internalException";
import { StringHelper } from "../helpers/stringHelper"; import { StringHelper } from "../helpers/stringHelper";
import { CreateResetCommand, DeleteResetCommand } from "./resetCommand"; import { CreateResetCommand, DeleteResetCommand } from "./resetCommand";
@ -29,7 +30,7 @@ export default abstract class ResetCommandHandler {
return token; return token;
}) })
.catch((err) => { .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() .execute()
.then((res) => {}) .then((res) => {})
.catch((err) => { .catch((err) => {
throw new InternalException("failed reset removal", err); throw new DatabaseActionException("DELETE", "reset", err);
}); });
} }
} }

View file

@ -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);
});
}
}

View file

@ -1,16 +1,20 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import CalendarService from "../../../service/club/calendarService"; import CalendarService from "../../../service/club/calendarService";
import CalendarFactory from "../../../factory/admin/club/calendar"; import CalendarFactory from "../../../factory/admin/club/calendar";
import CalendarTypeService from "../../../service/settings/calendarTypeService"; import CalendarTypeService from "../../../service/configuration/calendarTypeService";
import CalendarTypeFactory from "../../../factory/admin/settings/calendarType"; import CalendarTypeFactory from "../../../factory/admin/configuration/calendarType";
import { CreateCalendarCommand, DeleteCalendarCommand, UpdateCalendarCommand } from "../../../command/club/calendar/calendarCommand"; import {
CreateCalendarCommand,
DeleteCalendarCommand,
UpdateCalendarCommand,
} from "../../../command/club/calendar/calendarCommand";
import CalendarCommandHandler from "../../../command/club/calendar/calendarCommandHandler"; import CalendarCommandHandler from "../../../command/club/calendar/calendarCommandHandler";
import { import {
CreateCalendarTypeCommand, CreateCalendarTypeCommand,
DeleteCalendarTypeCommand, DeleteCalendarTypeCommand,
UpdateCalendarTypeCommand, UpdateCalendarTypeCommand,
} from "../../../command/settings/calendarType/calendarTypeCommand"; } from "../../../command/configuration/calendarType/calendarTypeCommand";
import CalendarTypeCommandHandler from "../../../command/settings/calendarType/calendarTypeCommandHandler"; import CalendarTypeCommandHandler from "../../../command/configuration/calendarType/calendarTypeCommandHandler";
/** /**
* @description get all calendar items * @description get all calendar items

View file

@ -0,0 +1,60 @@
import { Request, Response } from "express";
import { PdfExport } from "../../../helpers/pdfExport";
import DynamicQueryBuilder from "../../../helpers/dynamicQueryBuilder";
import QueryStoreService from "../../../service/configuration/queryStoreService";
import InternalException from "../../../exceptions/internalException";
/**
* @description print list by query and template
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function printListByQueryAndTemplate(req: Request, res: Response): Promise<any> {
const title = req.body.title;
const queryStore = req.body.queryStore;
const headerId = req.body.headerId ?? null;
const bodyId = req.body.bodyId ?? null;
const footerId = req.body.footerId ?? null;
const headerHeight = req.body.headerHeight ?? null;
const footerHeight = req.body.footerHeight ?? null;
let query = queryStore;
if (queryStore != "member" && queryStore != "memberByRunningMembership") {
query = (await QueryStoreService.getById(queryStore)).query;
}
let data = await DynamicQueryBuilder.executeQuery({
query: query.startsWith("{") ? JSON.parse(query) : query,
noLimit: true,
});
if (data.stats == "error") {
throw new InternalException("Failed executing Query");
}
let pdf = await PdfExport.renderFile({
title: title,
template: "listprint",
saveToDisk: false,
data: {
today: new Date(),
list: data.rows,
},
customTemplate: {
headerId,
footerId,
bodyId,
headerHeight,
footerHeight,
},
});
let pdfbuffer = Buffer.from(pdf);
res.setHeader("Content-Type", "application/pdf");
res.setHeader("Content-Length", pdfbuffer.byteLength);
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
res.send(pdfbuffer);
}

View file

@ -61,10 +61,7 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
let count = parseInt((req.query.count as string) ?? "25"); let count = parseInt((req.query.count as string) ?? "25");
let search = (req.query.search as string) ?? ""; let search = (req.query.search as string) ?? "";
let noLimit = req.query.noLimit === "true"; let noLimit = req.query.noLimit === "true";
let ids = ((req.query.ids ?? "") as string) let ids = ((req.query.ids ?? "") as string).split(",").filter((i) => i);
.split(",")
.filter((i) => i)
.map((i) => parseInt(i));
let [members, total] = await MemberService.getAll({ offset, count, search, noLimit, ids }); let [members, total] = await MemberService.getAll({ offset, count, search, noLimit, ids });
@ -76,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 * @description get member by id
* @param req {Request} Express req object * @param req {Request} Express req object
@ -83,7 +99,7 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMemberById(req: Request, res: Response): Promise<any> { 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); let member = await MemberService.getById(memberId);
res.json(MemberFactory.mapToSingle(member)); res.json(MemberFactory.mapToSingle(member));
@ -96,12 +112,51 @@ export async function getMemberById(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMemberStatisticsById(req: Request, res: Response): Promise<any> { export async function getMemberStatisticsById(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.id); const memberId = req.params.id;
let member = await MemberService.getStatisticsById(memberId); let member = await MemberService.getStatisticsById(memberId);
res.json(MemberFactory.mapToMemberStatistic(member)); res.json(MemberFactory.mapToMemberStatistic(member));
} }
/**
* @description get member printout by id
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function getMemberPrintoutById(req: Request, res: Response): Promise<any> {
const memberId = req.params.id;
let member = await MemberService.getById(memberId);
let memberships = await MembershipService.getAll(memberId);
let awards = await MemberAwardService.getAll(memberId);
let qualifications = await MemberQualificationService.getAll(memberId);
let positions = await MemberExecutivePositionService.getAll(memberId);
let communications = await CommunicationService.getAll(memberId);
let pdf = await PdfExport.renderFile({
title: "Mitglieder-Ausdruck",
template: "member",
saveToDisk: false,
data: {
today: new Date(),
member,
memberships,
awards,
qualifications,
positions,
communications,
},
});
let pdfbuffer = Buffer.from(pdf);
res.setHeader("Content-Type", "application/pdf");
res.setHeader("Content-Length", pdfbuffer.byteLength);
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
res.send(pdfbuffer);
}
/** /**
* @description get memberships by member * @description get memberships by member
* @param req {Request} Express req object * @param req {Request} Express req object
@ -109,7 +164,7 @@ export async function getMemberStatisticsById(req: Request, res: Response): Prom
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMembershipsByMember(req: Request, res: Response): Promise<any> { 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); let memberships = await MembershipService.getAll(memberId);
res.json(MembershipFactory.mapToBase(memberships)); res.json(MembershipFactory.mapToBase(memberships));
@ -122,7 +177,7 @@ export async function getMembershipsByMember(req: Request, res: Response): Promi
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMembershipStatisticsById(req: Request, res: Response): Promise<any> { export async function getMembershipStatisticsById(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.memberId); const memberId = req.params.memberId;
let member = await MembershipService.getStatisticsById(memberId); let member = await MembershipService.getStatisticsById(memberId);
res.json(MembershipFactory.mapToBaseStatistics(member)); res.json(MembershipFactory.mapToBaseStatistics(member));
@ -135,7 +190,7 @@ export async function getMembershipStatisticsById(req: Request, res: Response):
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMembershipByMemberAndRecord(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.id);
let membership = await MembershipService.getById(memberId, recordId); let membership = await MembershipService.getById(memberId, recordId);
@ -149,7 +204,7 @@ export async function getMembershipByMemberAndRecord(req: Request, res: Response
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getAwardsByMember(req: Request, res: Response): Promise<any> { 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); let awards = await MemberAwardService.getAll(memberId);
res.json(MemberAwardFactory.mapToBase(awards)); res.json(MemberAwardFactory.mapToBase(awards));
@ -162,7 +217,7 @@ export async function getAwardsByMember(req: Request, res: Response): Promise<an
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getAwardByMemberAndRecord(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.id);
let award = await MemberAwardService.getById(memberId, recordId); let award = await MemberAwardService.getById(memberId, recordId);
@ -176,7 +231,7 @@ export async function getAwardByMemberAndRecord(req: Request, res: Response): Pr
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getQualificationsByMember(req: Request, res: Response): Promise<any> { 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); let qualifications = await MemberQualificationService.getAll(memberId);
res.json(MemberQualificationFactory.mapToBase(qualifications)); res.json(MemberQualificationFactory.mapToBase(qualifications));
@ -189,7 +244,7 @@ export async function getQualificationsByMember(req: Request, res: Response): Pr
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getQualificationByMemberAndRecord(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.id);
let qualification = await MemberQualificationService.getById(memberId, recordId); let qualification = await MemberQualificationService.getById(memberId, recordId);
@ -203,7 +258,7 @@ export async function getQualificationByMemberAndRecord(req: Request, res: Respo
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getExecutivePositionsByMember(req: Request, res: Response): Promise<any> { 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); let positions = await MemberExecutivePositionService.getAll(memberId);
res.json(MemberExecutivePositionFactory.mapToBase(positions)); res.json(MemberExecutivePositionFactory.mapToBase(positions));
@ -216,7 +271,7 @@ export async function getExecutivePositionsByMember(req: Request, res: Response)
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getExecutivePositionByMemberAndRecord(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.id);
let position = await MemberExecutivePositionService.getById(memberId, recordId); let position = await MemberExecutivePositionService.getById(memberId, recordId);
@ -230,7 +285,7 @@ export async function getExecutivePositionByMemberAndRecord(req: Request, res: R
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getCommunicationsByMember(req: Request, res: Response): Promise<any> { 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); let communications = await CommunicationService.getAll(memberId);
res.json(CommunicationFactory.mapToBase(communications)); res.json(CommunicationFactory.mapToBase(communications));
@ -243,40 +298,13 @@ export async function getCommunicationsByMember(req: Request, res: Response): Pr
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getCommunicationByMemberAndRecord(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.id);
let communication = await CommunicationService.getById(memberId, recordId); let communication = await CommunicationService.getById(memberId, recordId);
res.json(CommunicationFactory.mapToSingle(communication)); res.json(CommunicationFactory.mapToSingle(communication));
} }
/**
* @description create member printout list
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function createMemberPrintoutList(req: Request, res: Response): Promise<any> {
let members = await MemberService.getByRunningMembership();
let pdf = await PdfExport.renderFile({
title: "Mitgliederliste",
template: "member.list",
saveToDisk: false,
data: {
member: members,
},
});
let pdfbuffer = Buffer.from(pdf);
res.setHeader("Content-Type", "application/pdf");
res.setHeader("Content-Length", pdfbuffer.byteLength);
res.setHeader("Content-Disposition", "inline; filename=preview.pdf");
res.send(pdfbuffer);
}
/** /**
* @description create member * @description create member
* @param req {Request} Express req object * @param req {Request} Express req object
@ -289,7 +317,7 @@ export async function createMember(req: Request, res: Response): Promise<any> {
const lastname = req.body.lastname; const lastname = req.body.lastname;
const nameaffix = req.body.nameaffix; const nameaffix = req.body.nameaffix;
const birthdate = req.body.birthdate; const birthdate = req.body.birthdate;
const internalId = req.body.internalId; const internalId = req.body.internalId || null;
let createMember: CreateMemberCommand = { let createMember: CreateMemberCommand = {
salutationId, salutationId,
@ -311,7 +339,7 @@ export async function createMember(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function addMembershipToMember(req: Request, res: Response): Promise<any> { 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 start = req.body.start;
const statusId = req.body.statusId; const statusId = req.body.statusId;
@ -332,7 +360,7 @@ export async function addMembershipToMember(req: Request, res: Response): Promis
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function addAwardToMember(req: Request, res: Response): Promise<any> { 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 given = req.body.given;
const note = req.body.note; const note = req.body.note;
const date = req.body.date; const date = req.body.date;
@ -357,7 +385,7 @@ export async function addAwardToMember(req: Request, res: Response): Promise<any
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function addQualificationToMember(req: Request, res: Response): Promise<any> { 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 note = req.body.note;
const start = req.body.start; const start = req.body.start;
const qualificationId = req.body.qualificationId; const qualificationId = req.body.qualificationId;
@ -380,7 +408,7 @@ export async function addQualificationToMember(req: Request, res: Response): Pro
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function addExecutivePositionToMember(req: Request, res: Response): Promise<any> { 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 note = req.body.note;
const start = req.body.start; const start = req.body.start;
const end = req.body.end || null; const end = req.body.end || null;
@ -405,7 +433,7 @@ export async function addExecutivePositionToMember(req: Request, res: Response):
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function addCommunicationToMember(req: Request, res: Response): Promise<any> { 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 preferred = req.body.preferred;
const isSMSAlarming = req.body.isSMSAlarming; const isSMSAlarming = req.body.isSMSAlarming;
const isSendNewsletter = req.body.isNewsletterMain; const isSendNewsletter = req.body.isNewsletterMain;
@ -444,13 +472,13 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateMemberById(req: Request, res: Response): Promise<any> { export async function updateMemberById(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.id); const memberId = req.params.id;
const salutationId = parseInt(req.body.salutationId); const salutationId = parseInt(req.body.salutationId);
const firstname = req.body.firstname; const firstname = req.body.firstname;
const lastname = req.body.lastname; const lastname = req.body.lastname;
const nameaffix = req.body.nameaffix; const nameaffix = req.body.nameaffix;
const birthdate = req.body.birthdate; const birthdate = req.body.birthdate;
const internalId = req.body.internalId; const internalId = req.body.internalId || null;
let updateMember: UpdateMemberCommand = { let updateMember: UpdateMemberCommand = {
id: memberId, id: memberId,
@ -473,7 +501,7 @@ export async function updateMemberById(req: Request, res: Response): Promise<any
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateMembershipOfMember(req: Request, res: Response): Promise<any> { 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 recordId = parseInt(req.params.recordId);
const start = req.body.start; const start = req.body.start;
const end = req.body.end || null; const end = req.body.end || null;
@ -500,7 +528,7 @@ export async function updateMembershipOfMember(req: Request, res: Response): Pro
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateAwardOfMember(req: Request, res: Response): Promise<any> { 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 recordId = parseInt(req.params.recordId);
const given = req.body.given; const given = req.body.given;
const note = req.body.note; const note = req.body.note;
@ -527,7 +555,7 @@ export async function updateAwardOfMember(req: Request, res: Response): Promise<
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateQualificationOfMember(req: Request, res: Response): Promise<any> { 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 recordId = parseInt(req.params.recordId);
const note = req.body.note; const note = req.body.note;
const start = req.body.start; const start = req.body.start;
@ -556,7 +584,7 @@ export async function updateQualificationOfMember(req: Request, res: Response):
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateExecutivePositionOfMember(req: Request, res: Response): Promise<any> { 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 recordId = parseInt(req.params.recordId);
const note = req.body.note; const note = req.body.note;
const start = req.body.start; const start = req.body.start;
@ -583,7 +611,7 @@ export async function updateExecutivePositionOfMember(req: Request, res: Respons
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateCommunicationOfMember(req: Request, res: Response): Promise<any> { 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 recordId = parseInt(req.params.recordId);
const preferred = req.body.preferred; const preferred = req.body.preferred;
const isSMSAlarming = req.body.isSMSAlarming; const isSMSAlarming = req.body.isSMSAlarming;
@ -622,7 +650,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteMemberById(req: Request, res: Response): Promise<any> { export async function deleteMemberById(req: Request, res: Response): Promise<any> {
const memberId = parseInt(req.params.id); const memberId = req.params.id;
let deleteMember: DeleteMemberCommand = { let deleteMember: DeleteMemberCommand = {
id: memberId, id: memberId,
@ -639,7 +667,7 @@ export async function deleteMemberById(req: Request, res: Response): Promise<any
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteMembershipOfMember(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.recordId);
let deleteMembership: DeleteMembershipCommand = { let deleteMembership: DeleteMembershipCommand = {
@ -658,7 +686,7 @@ export async function deleteMembershipOfMember(req: Request, res: Response): Pro
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteAwardOfMember(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.recordId);
let deleteMemberAward: DeleteMemberAwardCommand = { let deleteMemberAward: DeleteMemberAwardCommand = {
@ -677,7 +705,7 @@ export async function deleteAwardOfMember(req: Request, res: Response): Promise<
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteQualificationOfMember(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.recordId);
let deleteMemberQualification: DeleteMemberQualificationCommand = { let deleteMemberQualification: DeleteMemberQualificationCommand = {
@ -696,7 +724,7 @@ export async function deleteQualificationOfMember(req: Request, res: Response):
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteExecutivePositionOfMember(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.recordId);
let deleteMemberExecutivePosition: DeleteMemberExecutivePositionCommand = { let deleteMemberExecutivePosition: DeleteMemberExecutivePositionCommand = {
@ -715,7 +743,7 @@ export async function deleteExecutivePositionOfMember(req: Request, res: Respons
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteCommunicationOfMember(req: Request, res: Response): Promise<any> { 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); const recordId = parseInt(req.params.recordId);
let deleteCommunication: DeleteCommunicationCommand = { let deleteCommunication: DeleteCommunicationCommand = {

View file

@ -17,7 +17,7 @@ import { SynchronizeNewsletterRecipientsCommand } from "../../../command/club/ne
import NewsletterRecipientsCommandHandler from "../../../command/club/newsletter/newsletterRecipientsCommandHandler"; import NewsletterRecipientsCommandHandler from "../../../command/club/newsletter/newsletterRecipientsCommandHandler";
import { NewsletterDatesViewModel } from "../../../viewmodel/admin/club/newsletter/newsletterDates.models"; import { NewsletterDatesViewModel } from "../../../viewmodel/admin/club/newsletter/newsletterDates.models";
import { PdfExport } from "../../../helpers/pdfExport"; import { PdfExport } from "../../../helpers/pdfExport";
import UserService from "../../../service/user/userService"; import UserService from "../../../service/management/userService";
import { TemplateHelper } from "../../../helpers/templateHelper"; import { TemplateHelper } from "../../../helpers/templateHelper";
import MailHelper from "../../../helpers/mailHelper"; import MailHelper from "../../../helpers/mailHelper";
import { NewsletterEventType, NewsletterHelper } from "../../../helpers/newsletterHelper"; import { NewsletterEventType, NewsletterHelper } from "../../../helpers/newsletterHelper";
@ -94,7 +94,7 @@ export async function getNewsletterPrintoutsById(req: Request, res: Response): P
let newsletter = await NewsletterService.getById(newsletterId); let newsletter = await NewsletterService.getById(newsletterId);
let filesInFolder = FileSystemHelper.getFilesInDirectory( let filesInFolder = FileSystemHelper.getFilesInDirectory(
`newsletter/${newsletter.id}_${newsletter.title.replace(" ", "")}` `newsletter/${newsletter.id}_${newsletter.title.replaceAll(" ", "")}`
); );
res.json(filesInFolder); res.json(filesInFolder);
@ -114,7 +114,7 @@ export async function getNewsletterPrintoutByIdAndPrint(req: Request, res: Respo
let filepath = FileSystemHelper.formatPath( let filepath = FileSystemHelper.formatPath(
"newsletter", "newsletter",
`${newsletter.id}_${newsletter.title.replace(" ", "")}`, `${newsletter.id}_${newsletter.title.replaceAll(" ", "")}`,
filename filename
); );
@ -135,7 +135,7 @@ export async function createNewsletterPrintoutPreviewById(req: Request, res: Res
let newsletterId = parseInt(req.params.newsletterId); let newsletterId = parseInt(req.params.newsletterId);
let newsletter = await NewsletterService.getById(newsletterId); let newsletter = await NewsletterService.getById(newsletterId);
let dates = await NewsletterDatesService.getAll(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); let data = NewsletterHelper.buildData(newsletter, dates);
data.recipient = { data.recipient = {
@ -164,6 +164,34 @@ export async function createNewsletterPrintoutPreviewById(req: Request, res: Res
res.send(pdfbuffer); res.send(pdfbuffer);
} }
/**
* @description get all members receiving a newsletter printout by id
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function getNewsletterPrintReceiversById(req: Request, res: Response): Promise<any> {
let newsletterId = parseInt(req.params.newsletterId);
let recipients = await NewsletterHelper.getPrintRecipients(newsletterId);
res.json(recipients);
}
/**
* @description get all members receiving a newsletter mail by id
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function getNewsletterMailReceiversById(req: Request, res: Response): Promise<any> {
let newsletterId = parseInt(req.params.newsletterId);
let recipients = await NewsletterHelper.getMailRecipients(newsletterId);
res.json(recipients);
}
/** /**
* @description create newsletter * @description create newsletter
* @param req {Request} Express req object * @param req {Request} Express req object
@ -241,7 +269,7 @@ export async function createNewsletterMailPreviewById(req: Request, res: Respons
let newsletterId = parseInt(req.params.newsletterId); let newsletterId = parseInt(req.params.newsletterId);
let newsletter = await NewsletterService.getById(newsletterId); let newsletter = await NewsletterService.getById(newsletterId);
let dates = await NewsletterDatesService.getAll(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); let data = NewsletterHelper.buildData(newsletter, dates);
data.recipient = { data.recipient = {
@ -328,7 +356,7 @@ export async function synchronizeNewsletterById(req: Request, res: Response): Pr
let newsletterTitle = req.body.newsletterTitle; let newsletterTitle = req.body.newsletterTitle;
let newsletterText = req.body.newsletterText; let newsletterText = req.body.newsletterText;
let newsletterSignatur = req.body.newsletterSignatur; let newsletterSignatur = req.body.newsletterSignatur;
let recipientsByQueryId = req.body.recipientsByQueryId ?? null; let recipientsByQueryId = req.body.recipientsByQueryId || null;
let syncNewsletter: SynchronizeNewsletterCommand = { let syncNewsletter: SynchronizeNewsletterCommand = {
id, id,
@ -375,7 +403,7 @@ export async function synchronizeNewsletterDatesById(req: Request, res: Response
*/ */
export async function synchronizeNewsletterRecipientsById(req: Request, res: Response): Promise<any> { export async function synchronizeNewsletterRecipientsById(req: Request, res: Response): Promise<any> {
let newsletterId = parseInt(req.params.newsletterId); 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 = { let syncRecipients: SynchronizeNewsletterRecipientsCommand = {
newsletterId, newsletterId,

View file

@ -235,7 +235,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
year: "numeric", year: "numeric",
})}`; })}`;
let filename = `${new Date().toISOString().split("T")[0]}_${iteration + 1}_Protokoll_${protocol.title.replace( let filename = `${new Date().toISOString().split("T")[0]}_${iteration + 1}_Protokoll_${protocol.title.replaceAll(
/[^a-zA-Z0-9]/g, /[^a-zA-Z0-9]/g,
"" ""
)}`; )}`;
@ -257,13 +257,13 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
}), }),
start: protocol.starttime, start: protocol.starttime,
end: protocol.endtime, end: protocol.endtime,
agenda, agenda: agenda.sort((a, b) => a.sort - b.sort),
decisions, decisions: decisions.sort((a, b) => a.sort - b.sort),
presence: presence.filter((p) => !p.absent).map((p) => p.member), presence: presence.filter((p) => !p.absent).map((p) => p.member),
absent: presence.filter((p) => p.absent).map((p) => ({ ...p.member, excused: p.excused })), absent: presence.filter((p) => p.absent).map((p) => ({ ...p.member, excused: p.excused })),
excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member), excused_absent: presence.filter((p) => p.absent && p.excused).map((p) => p.member),
unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member), unexcused_absent: presence.filter((p) => p.absent && !p.excused).map((p) => p.member),
votings, votings: votings.sort((a, b) => a.sort - b.sort),
}, },
}); });
@ -317,9 +317,10 @@ export async function synchronizeProtocolAgendaById(req: Request, res: Response)
let syncAgenda: Array<SynchronizeProtocolAgendaCommand> = agenda.map( let syncAgenda: Array<SynchronizeProtocolAgendaCommand> = agenda.map(
(a: ProtocolAgendaViewModel): SynchronizeProtocolAgendaCommand => ({ (a: ProtocolAgendaViewModel): SynchronizeProtocolAgendaCommand => ({
id: a.id ?? null, id: a.id,
topic: a.topic, topic: a.topic,
context: a.context, context: a.context,
sort: a.sort,
protocolId, protocolId,
}) })
); );
@ -340,9 +341,10 @@ export async function synchronizeProtocolDecisonsById(req: Request, res: Respons
let syncDecision: Array<SynchronizeProtocolDecisionCommand> = decisions.map( let syncDecision: Array<SynchronizeProtocolDecisionCommand> = decisions.map(
(d: ProtocolDecisionViewModel): SynchronizeProtocolDecisionCommand => ({ (d: ProtocolDecisionViewModel): SynchronizeProtocolDecisionCommand => ({
id: d.id ?? null, id: d.id,
topic: d.topic, topic: d.topic,
context: d.context, context: d.context,
sort: d.sort,
protocolId, protocolId,
}) })
); );
@ -362,13 +364,14 @@ export async function synchronizeProtocolVotingsById(req: Request, res: Response
let votings = req.body.votings as Array<ProtocolVotingViewModel>; let votings = req.body.votings as Array<ProtocolVotingViewModel>;
let syncVoting: Array<SynchronizeProtocolVotingCommand> = votings.map( let syncVoting: Array<SynchronizeProtocolVotingCommand> = votings.map(
(d: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({ (v: ProtocolVotingViewModel): SynchronizeProtocolVotingCommand => ({
id: d.id ?? null, id: v.id,
topic: d.topic, topic: v.topic,
context: d.context, context: v.context,
favour: d.favour, favour: v.favour,
abstain: d.abstain, abstain: v.abstain,
against: d.abstain, against: v.abstain,
sort: v.sort,
protocolId, protocolId,
}) })
); );

View file

@ -1,6 +1,7 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import DynamicQueryBuilder from "../../../helpers/dynamicQueryBuilder"; import DynamicQueryBuilder from "../../../helpers/dynamicQueryBuilder";
import { dataSource } from "../../../data-source"; import { dataSource } from "../../../data-source";
import QueryStoreService from "../../../service/configuration/queryStoreService";
/** /**
* @description get all table metas * @description get all table metas
@ -36,9 +37,30 @@ export async function getTableMetaByTablename(req: Request, res: Response): Prom
export async function executeQuery(req: Request, res: Response): Promise<any> { export async function executeQuery(req: Request, res: Response): Promise<any> {
let offset = parseInt((req.query.offset as string) ?? "0"); let offset = parseInt((req.query.offset as string) ?? "0");
let count = parseInt((req.query.count as string) ?? "25"); let count = parseInt((req.query.count as string) ?? "25");
let noLimit = req.query.noLimit === "true";
const query = req.body.query; 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);
}
/**
* @description execute Query by StoreId
* @param req {Request} Express req object
* @param res {Response} Express res object
* @returns {Promise<*>}
*/
export async function executeQueryByStoreId(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 storeId = req.params.storeId;
let queryStore = await QueryStoreService.getById(storeId);
let query = queryStore.query.startsWith("{") ? JSON.parse(queryStore.query) : queryStore.query;
let result = await DynamicQueryBuilder.executeQuery({ query, offset, count, noLimit });
res.json(result); res.json(result);
} }

View file

@ -1,8 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import AwardService from "../../../service/settings/awardService"; import AwardService from "../../../service/configuration/awardService";
import AwardFactory from "../../../factory/admin/settings/award"; import AwardFactory from "../../../factory/admin/configuration/award";
import { CreateAwardCommand, DeleteAwardCommand, UpdateAwardCommand } from "../../../command/settings/award/awardCommand"; import {
import AwardCommandHandler from "../../../command/settings/award/awardCommandHandler"; CreateAwardCommand,
DeleteAwardCommand,
UpdateAwardCommand,
} from "../../../command/configuration/award/awardCommand";
import AwardCommandHandler from "../../../command/configuration/award/awardCommandHandler";
/** /**
* @description get all awards * @description get all awards

View file

@ -1,13 +1,13 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import CommunicationTypeService from "../../../service/settings/communicationTypeService"; import CommunicationTypeService from "../../../service/configuration/communicationTypeService";
import CommunicationTypeFactory from "../../../factory/admin/settings/communicationType"; import CommunicationTypeFactory from "../../../factory/admin/configuration/communicationType";
import CommunicationService from "../../../service/club/member/communicationService"; import CommunicationService from "../../../service/club/member/communicationService";
import { import {
CreateCommunicationTypeCommand, CreateCommunicationTypeCommand,
DeleteCommunicationTypeCommand, DeleteCommunicationTypeCommand,
UpdateCommunicationTypeCommand, UpdateCommunicationTypeCommand,
} from "../../../command/settings/communicationType/communicationTypeCommand"; } from "../../../command/configuration/communicationType/communicationTypeCommand";
import CommunicationTypeCommandHandler from "../../../command/settings/communicationType/communicationTypeCommandHandler"; import CommunicationTypeCommandHandler from "../../../command/configuration/communicationType/communicationTypeCommandHandler";
/** /**
* @description get all communicationTypes * @description get all communicationTypes

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import ExecutivePositionService from "../../../service/settings/executivePositionService"; import ExecutivePositionService from "../../../service/configuration/executivePositionService";
import ExecutivePositionFactory from "../../../factory/admin/settings/executivePosition"; import ExecutivePositionFactory from "../../../factory/admin/configuration/executivePosition";
import { import {
CreateExecutivePositionCommand, CreateExecutivePositionCommand,
DeleteExecutivePositionCommand, DeleteExecutivePositionCommand,
UpdateExecutivePositionCommand, UpdateExecutivePositionCommand,
} from "../../../command/settings/executivePosition/executivePositionCommand"; } from "../../../command/configuration/executivePosition/executivePositionCommand";
import ExecutivePositionCommandHandler from "../../../command/settings/executivePosition/executivePositionCommandHandler"; import ExecutivePositionCommandHandler from "../../../command/configuration/executivePosition/executivePositionCommandHandler";
/** /**
* @description get all executivePositions * @description get all executivePositions

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import MembershipStatusService from "../../../service/settings/membershipStatusService"; import MembershipStatusService from "../../../service/configuration/membershipStatusService";
import MembershipStatusFactory from "../../../factory/admin/settings/membershipStatus"; import MembershipStatusFactory from "../../../factory/admin/configuration/membershipStatus";
import { import {
CreateMembershipStatusCommand, CreateMembershipStatusCommand,
DeleteMembershipStatusCommand, DeleteMembershipStatusCommand,
UpdateMembershipStatusCommand, UpdateMembershipStatusCommand,
} from "../../../command/settings/membershipStatus/membershipStatusCommand"; } from "../../../command/configuration/membershipStatus/membershipStatusCommand";
import MembershipStatusCommandHandler from "../../../command/settings/membershipStatus/membershipStatusCommandHandler"; import MembershipStatusCommandHandler from "../../../command/configuration/membershipStatus/membershipStatusCommandHandler";
/** /**
* @description get all membershipStatus * @description get all membershipStatus

View file

@ -1,8 +1,11 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import NewsletterConfigService from "../../../service/settings/newsletterConfigService"; import NewsletterConfigService from "../../../service/configuration/newsletterConfigService";
import NewsletterConfigFactory from "../../../factory/admin/settings/newsletterConfig"; import NewsletterConfigFactory from "../../../factory/admin/configuration/newsletterConfig";
import NewsletterConfigCommandHandler from "../../../command/settings/newsletterConfig/newsletterConfigCommandHandler"; import NewsletterConfigCommandHandler from "../../../command/configuration/newsletterConfig/newsletterConfigCommandHandler";
import { SetNewsletterConfigCommand } from "../../../command/settings/newsletterConfig/newsletterConfigCommand"; import {
DeleteNewsletterConfigCommand,
SetNewsletterConfigCommand,
} from "../../../command/configuration/newsletterConfig/newsletterConfigCommand";
/** /**
* @description get all newsletterConfigs * @description get all newsletterConfigs
@ -43,7 +46,24 @@ export async function setNewsletterConfig(req: Request, res: Response): Promise<
comTypeId, comTypeId,
config, 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);
} }

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import QualificationService from "../../../service/settings/qualification"; import QualificationService from "../../../service/configuration/qualification";
import QualificationFactory from "../../../factory/admin/settings/qualification"; import QualificationFactory from "../../../factory/admin/configuration/qualification";
import { import {
CreateQualificationCommand, CreateQualificationCommand,
DeleteQualificationCommand, DeleteQualificationCommand,
UpdateQualificationCommand, UpdateQualificationCommand,
} from "../../../command/settings/qualification/qualificationCommand"; } from "../../../command/configuration/qualification/qualificationCommand";
import QualificationCommandHandler from "../../../command/settings/qualification/qualificationCommandHandler"; import QualificationCommandHandler from "../../../command/configuration/qualification/qualificationCommandHandler";
/** /**
* @description get all qualifications * @description get all qualifications

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import QueryStoreFactory from "../../../factory/admin/settings/queryStore"; import QueryStoreFactory from "../../../factory/admin/configuration/queryStore";
import QueryStoreService from "../../../service/settings/queryStoreService"; import QueryStoreService from "../../../service/configuration/queryStoreService";
import { import {
CreateQueryStoreCommand, CreateQueryStoreCommand,
DeleteQueryStoreCommand, DeleteQueryStoreCommand,
UpdateQueryStoreCommand, UpdateQueryStoreCommand,
} from "../../../command/settings/queryStore/queryStoreCommand"; } from "../../../command/configuration/queryStore/queryStoreCommand";
import QueryStoreCommandHandler from "../../../command/settings/queryStore/queryStoreCommandHandler"; import QueryStoreCommandHandler from "../../../command/configuration/queryStore/queryStoreCommandHandler";
/** /**
* @description get all queryStores * @description get all queryStores
@ -27,7 +27,7 @@ export async function getAllQueryStores(req: Request, res: Response): Promise<an
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getQueryStoreById(req: Request, res: Response): Promise<any> { export async function getQueryStoreById(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = req.params.id;
let queryStore = await QueryStoreService.getById(id); let queryStore = await QueryStoreService.getById(id);
@ -61,7 +61,7 @@ export async function createQueryStore(req: Request, res: Response): Promise<any
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateQueryStore(req: Request, res: Response): Promise<any> { export async function updateQueryStore(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = req.params.id;
const query = req.body.query; const query = req.body.query;
let updateQueryStore: UpdateQueryStoreCommand = { let updateQueryStore: UpdateQueryStoreCommand = {
@ -81,7 +81,7 @@ export async function updateQueryStore(req: Request, res: Response): Promise<any
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteQueryStore(req: Request, res: Response): Promise<any> { export async function deleteQueryStore(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = req.params.id;
let deleteQueryStore: DeleteQueryStoreCommand = { let deleteQueryStore: DeleteQueryStoreCommand = {
id: id, id: id,

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import SalutationService from "../../../service/settings/salutationService"; import SalutationService from "../../../service/configuration/salutationService";
import SalutationFactory from "../../../factory/admin/settings/salutation"; import SalutationFactory from "../../../factory/admin/configuration/salutation";
import { import {
CreateSalutationCommand, CreateSalutationCommand,
DeleteSalutationCommand, DeleteSalutationCommand,
UpdateSalutationCommand, UpdateSalutationCommand,
} from "../../../command/settings/salutation/salutationCommand"; } from "../../../command/configuration/salutation/salutationCommand";
import SalutationCommandHandler from "../../../command/settings/salutation/salutationCommandHandler"; import SalutationCommandHandler from "../../../command/configuration/salutation/salutationCommandHandler";
/** /**
* @description get all salutations * @description get all salutations

View file

@ -1,8 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import TemplateService from "../../../service/settings/templateService"; import TemplateService from "../../../service/configuration/templateService";
import TemplateFactory from "../../../factory/admin/settings/template"; import TemplateFactory from "../../../factory/admin/configuration/template";
import { CreateTemplateCommand, DeleteTemplateCommand, UpdateTemplateCommand } from "../../../command/settings/template/templateCommand"; import {
import TemplateCommandHandler from "../../../command/settings/template/templateCommandHandler"; CreateTemplateCommand,
DeleteTemplateCommand,
UpdateTemplateCommand,
} from "../../../command/configuration/template/templateCommand";
import TemplateCommandHandler from "../../../command/configuration/template/templateCommandHandler";
/** /**
* @description get all templates * @description get all templates

View file

@ -1,8 +1,8 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import TemplateUsageService from "../../../service/settings/templateUsageService"; import TemplateUsageService from "../../../service/configuration/templateUsageService";
import TemplateUsageFactory from "../../../factory/admin/settings/templateUsage"; import TemplateUsageFactory from "../../../factory/admin/configuration/templateUsage";
import { UpdateTemplateUsageCommand } from "../../../command/settings/templateUsage/templateUsageCommand"; import { UpdateTemplateUsageCommand } from "../../../command/configuration/templateUsage/templateUsageCommand";
import TemplateUsageCommandHandler from "../../../command/settings/templateUsage/templateUsageCommandHandler"; import TemplateUsageCommandHandler from "../../../command/configuration/templateUsage/templateUsageCommandHandler";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import ForbiddenRequestException from "../../../exceptions/forbiddenRequestException"; import ForbiddenRequestException from "../../../exceptions/forbiddenRequestException";
import { PermissionModule } from "../../../type/permissionTypes"; import { PermissionModule } from "../../../type/permissionTypes";
@ -21,7 +21,7 @@ export async function getAllTemplateUsages(req: Request, res: Response): Promise
if (!req.isOwner) { if (!req.isOwner) {
templateUsages = templateUsages.filter((tu) => { templateUsages = templateUsages.filter((tu) => {
return ( 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) 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( let allowedSettings = PermissionHelper.can(
req.permissions, req.permissions,
"update", "update",
"settings", "configuration",
req.params.scope as PermissionModule req.params.scope as PermissionModule
); );
let allowedClub = PermissionHelper.can(req.permissions, "update", "club", req.params.scope as PermissionModule); let allowedClub = PermissionHelper.can(req.permissions, "update", "club", req.params.scope as PermissionModule);

View 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);
}

View file

@ -1,12 +1,12 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import RoleService from "../../../service/user/roleService"; import RoleService from "../../../service/management/roleService";
import RoleFactory from "../../../factory/admin/user/role"; import RoleFactory from "../../../factory/admin/management/role";
import RolePermissionService from "../../../service/user/rolePermissionService"; import RolePermissionService from "../../../service/management/rolePermissionService";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../../command/user/role/roleCommand"; import { CreateRoleCommand, DeleteRoleCommand, UpdateRoleCommand } from "../../../command/management/role/roleCommand";
import RoleCommandHandler from "../../../command/user/role/roleCommandHandler"; import RoleCommandHandler from "../../../command/management/role/roleCommandHandler";
import { UpdateRolePermissionsCommand } from "../../../command/user/role/rolePermissionCommand"; import { UpdateRolePermissionsCommand } from "../../../command/management/role/rolePermissionCommand";
import RolePermissionCommandHandler from "../../../command/user/role/rolePermissionCommandHandler"; import RolePermissionCommandHandler from "../../../command/management/role/rolePermissionCommandHandler";
/** /**
* @description get All roles * @description get All roles

View file

@ -1,15 +1,19 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import UserService from "../../../service/user/userService"; import UserService from "../../../service/management/userService";
import UserFactory from "../../../factory/admin/user/user"; import UserFactory from "../../../factory/admin/management/user";
import UserPermissionService from "../../../service/user/userPermissionService"; import UserPermissionService from "../../../service/management/userPermissionService";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import RoleFactory from "../../../factory/admin/user/role"; import RoleFactory from "../../../factory/admin/management/role";
import { DeleteUserCommand, UpdateUserCommand, UpdateUserRolesCommand } from "../../../command/user/user/userCommand"; import {
import UserCommandHandler from "../../../command/user/user/userCommandHandler"; DeleteUserCommand,
UpdateUserCommand,
UpdateUserRolesCommand,
} from "../../../command/management/user/userCommand";
import UserCommandHandler from "../../../command/management/user/userCommandHandler";
import MailHelper from "../../../helpers/mailHelper"; import MailHelper from "../../../helpers/mailHelper";
import { CLUB_NAME } from "../../../env.defaults"; import { CLUB_NAME } from "../../../env.defaults";
import { UpdateUserPermissionsCommand } from "../../../command/user/user/userPermissionCommand"; import { UpdateUserPermissionsCommand } from "../../../command/management/user/userPermissionCommand";
import UserPermissionCommandHandler from "../../../command/user/user/userPermissionCommandHandler"; import UserPermissionCommandHandler from "../../../command/management/user/userPermissionCommandHandler";
import BadRequestException from "../../../exceptions/badRequestException"; import BadRequestException from "../../../exceptions/badRequestException";
/** /**
@ -31,7 +35,7 @@ export async function getAllUsers(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getUserById(req: Request, res: Response): Promise<any> { 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); let user = await UserService.getById(id);
res.json(UserFactory.mapToSingle(user)); res.json(UserFactory.mapToSingle(user));
@ -44,7 +48,7 @@ export async function getUserById(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getUserPermissions(req: Request, res: Response): Promise<any> { 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); let permissions = await UserPermissionService.getByUser(id);
res.json(PermissionHelper.convertToObject(permissions.map((p) => p.permission))); res.json(PermissionHelper.convertToObject(permissions.map((p) => p.permission)));
@ -57,7 +61,7 @@ export async function getUserPermissions(req: Request, res: Response): Promise<a
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getUserRoles(req: Request, res: Response): Promise<any> { 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); let roles = await UserService.getAssignedRolesByUserId(id);
@ -71,7 +75,7 @@ export async function getUserRoles(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateUser(req: Request, res: Response): Promise<any> { 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 mail = req.body.mail;
let firstname = req.body.firstname; let firstname = req.body.firstname;
let lastname = req.body.lastname; let lastname = req.body.lastname;
@ -96,7 +100,7 @@ export async function updateUser(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateUserPermissions(req: Request, res: Response): Promise<any> { 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 permissions = req.body.permissions;
let permissionStrings = PermissionHelper.convertToStringArray(permissions); let permissionStrings = PermissionHelper.convertToStringArray(permissions);
@ -117,7 +121,7 @@ export async function updateUserPermissions(req: Request, res: Response): Promis
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateUserRoles(req: Request, res: Response): Promise<any> { 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 roleIds = req.body.roleIds as Array<number>;
let updateRoles: UpdateUserRolesCommand = { let updateRoles: UpdateUserRolesCommand = {
@ -136,7 +140,7 @@ export async function updateUserRoles(req: Request, res: Response): Promise<any>
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function deleteUser(req: Request, res: Response): Promise<any> { export async function deleteUser(req: Request, res: Response): Promise<any> {
const id = parseInt(req.params.id); const id = req.params.id;
let { mail, isOwner } = await UserService.getById(id); let { mail, isOwner } = await UserService.getById(id);

View file

@ -1,16 +1,16 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import WebapiService from "../../../service/user/webapiService"; import WebapiService from "../../../service/management/webapiService";
import ApiFactory from "../../../factory/admin/user/webapi"; import ApiFactory from "../../../factory/admin/management/webapi";
import WebapiPermissionService from "../../../service/user/webapiPermissionService"; import WebapiPermissionService from "../../../service/management/webapiPermissionService";
import PermissionHelper from "../../../helpers/permissionHelper"; import PermissionHelper from "../../../helpers/permissionHelper";
import { import {
CreateWebapiCommand, CreateWebapiCommand,
DeleteWebapiCommand, DeleteWebapiCommand,
UpdateWebapiCommand, UpdateWebapiCommand,
} from "../../../command/user/webapi/webapiCommand"; } from "../../../command/management/webapi/webapiCommand";
import WebapiCommandHandler from "../../../command/user/webapi/webapiCommandHandler"; import WebapiCommandHandler from "../../../command/management/webapi/webapiCommandHandler";
import { UpdateWebapiPermissionsCommand } from "../../../command/user/webapi/webapiPermissionCommand"; import { UpdateWebapiPermissionsCommand } from "../../../command/management/webapi/webapiPermissionCommand";
import WebapiPermissionCommandHandler from "../../../command/user/webapi/webapiPermissionCommandHandler"; import WebapiPermissionCommandHandler from "../../../command/management/webapi/webapiPermissionCommandHandler";
import { JWTHelper } from "../../../helpers/jwtHelper"; import { JWTHelper } from "../../../helpers/jwtHelper";
import { CLUB_NAME } from "../../../env.defaults"; import { CLUB_NAME } from "../../../env.defaults";
import { StringHelper } from "../../../helpers/stringHelper"; import { StringHelper } from "../../../helpers/stringHelper";

View file

@ -4,7 +4,7 @@ import { JWTToken } from "../type/jwtTypes";
import InternalException from "../exceptions/internalException"; import InternalException from "../exceptions/internalException";
import RefreshCommandHandler from "../command/refreshCommandHandler"; import RefreshCommandHandler from "../command/refreshCommandHandler";
import { CreateRefreshCommand, DeleteRefreshCommand } from "../command/refreshCommand"; import { CreateRefreshCommand, DeleteRefreshCommand } from "../command/refreshCommand";
import UserService from "../service/user/userService"; import UserService from "../service/management/userService";
import speakeasy from "speakeasy"; import speakeasy from "speakeasy";
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException"; import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
import RefreshService from "../service/refreshService"; import RefreshService from "../service/refreshService";

View file

@ -7,18 +7,18 @@ import { CreateRefreshCommand } from "../command/refreshCommand";
import speakeasy from "speakeasy"; import speakeasy from "speakeasy";
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException"; import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
import QRCode from "qrcode"; import QRCode from "qrcode";
import { CreateUserCommand } from "../command/user/user/userCommand"; import { CreateUserCommand } from "../command/management/user/userCommand";
import UserCommandHandler from "../command/user/user/userCommandHandler"; import UserCommandHandler from "../command/management/user/userCommandHandler";
import { CreateInviteCommand, DeleteInviteCommand } from "../command/user/user/inviteCommand"; import { CreateInviteCommand, DeleteInviteCommand } from "../command/management/user/inviteCommand";
import InviteCommandHandler from "../command/user/user/inviteCommandHandler"; import InviteCommandHandler from "../command/management/user/inviteCommandHandler";
import MailHelper from "../helpers/mailHelper"; import MailHelper from "../helpers/mailHelper";
import InviteService from "../service/user/inviteService"; import InviteService from "../service/management/inviteService";
import UserService from "../service/user/userService"; import UserService from "../service/management/userService";
import CustomRequestException from "../exceptions/customRequestException"; import CustomRequestException from "../exceptions/customRequestException";
import { CLUB_NAME } from "../env.defaults"; import { CLUB_NAME } from "../env.defaults";
import { CreateUserPermissionCommand } from "../command/user/user/userPermissionCommand"; import { CreateUserPermissionCommand } from "../command/management/user/userPermissionCommand";
import UserPermissionCommandHandler from "../command/user/user/userPermissionCommandHandler"; import UserPermissionCommandHandler from "../command/management/user/userPermissionCommandHandler";
import InviteFactory from "../factory/admin/user/invite"; import InviteFactory from "../factory/admin/management/invite";
/** /**
* @description get all invites * @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"); 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 = { let createInvite: CreateInviteCommand = {
username: username, username: username,
@ -92,7 +92,7 @@ export async function verifyInvite(req: Request, res: Response): Promise<any> {
let { secret, username } = await InviteService.getByMailAndToken(mail, token); 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) QRCode.toDataURL(url)
.then((result) => { .then((result) => {

View file

@ -1,6 +1,6 @@
import { Request, Response } from "express"; import { Request, Response } from "express";
import CalendarService from "../service/club/calendarService"; 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 { calendar } from "../entity/club/calendar";
import { createEvents } from "ics"; import { createEvents } from "ics";
import moment from "moment"; import moment from "moment";

View file

@ -11,13 +11,13 @@ import { CreateResetCommand, DeleteResetCommand } from "../command/resetCommand"
import ResetCommandHandler from "../command/resetCommandHandler"; import ResetCommandHandler from "../command/resetCommandHandler";
import MailHelper from "../helpers/mailHelper"; import MailHelper from "../helpers/mailHelper";
import ResetService from "../service/resetService"; import ResetService from "../service/resetService";
import UserService from "../service/user/userService"; import UserService from "../service/management/userService";
import { CLUB_NAME } from "../env.defaults"; import { CLUB_NAME } from "../env.defaults";
import PermissionHelper from "../helpers/permissionHelper"; import PermissionHelper from "../helpers/permissionHelper";
import RolePermissionService from "../service/user/rolePermissionService"; import RolePermissionService from "../service/management/rolePermissionService";
import UserPermissionService from "../service/user/userPermissionService"; import UserPermissionService from "../service/management/userPermissionService";
import { UpdateUserSecretCommand } from "../command/user/user/userCommand"; import { UpdateUserSecretCommand } from "../command/management/user/userCommand";
import UserCommandHandler from "../command/user/user/userCommandHandler"; import UserCommandHandler from "../command/management/user/userCommandHandler";
/** /**
* @description request totp reset * @description request totp reset
@ -31,7 +31,7 @@ export async function startReset(req: Request, res: Response): Promise<any> {
let { mail } = await UserService.getByUsername(username); 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 = { let createReset: CreateResetCommand = {
username: username, username: username,
@ -62,7 +62,7 @@ export async function verifyReset(req: Request, res: Response): Promise<any> {
let { secret } = await ResetService.getByMailAndToken(mail, token); 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) QRCode.toDataURL(url)
.then((result) => { .then((result) => {

View file

@ -3,10 +3,10 @@ import speakeasy from "speakeasy";
import QRCode from "qrcode"; import QRCode from "qrcode";
import InternalException from "../exceptions/internalException"; import InternalException from "../exceptions/internalException";
import { CLUB_NAME } from "../env.defaults"; import { CLUB_NAME } from "../env.defaults";
import UserService from "../service/user/userService"; import UserService from "../service/management/userService";
import UserFactory from "../factory/admin/user/user"; import UserFactory from "../factory/admin/management/user";
import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/user/user/userCommand"; import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/management/user/userCommand";
import UserCommandHandler from "../command/user/user/userCommandHandler"; import UserCommandHandler from "../command/management/user/userCommandHandler";
import ForbiddenRequestException from "../exceptions/forbiddenRequestException"; import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
/** /**
@ -16,7 +16,7 @@ import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMeById(req: Request, res: Response): Promise<any> { 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); let user = await UserService.getById(id);
res.json(UserFactory.mapToSingle(user)); res.json(UserFactory.mapToSingle(user));
@ -29,11 +29,11 @@ export async function getMeById(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function getMyTotp(req: Request, res: Response): Promise<any> { 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); 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) QRCode.toDataURL(url)
.then((result) => { .then((result) => {
@ -54,7 +54,7 @@ export async function getMyTotp(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function verifyMyTotp(req: Request, res: Response): Promise<any> { 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 totp = req.body.totp;
let { secret } = await UserService.getById(userId); let { secret } = await UserService.getById(userId);
@ -78,7 +78,7 @@ export async function verifyMyTotp(req: Request, res: Response): Promise<any> {
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function transferOwnership(req: Request, res: Response): Promise<any> { 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 toId = req.body.toId;
let { isOwner } = await UserService.getById(userId); let { isOwner } = await UserService.getById(userId);
@ -102,7 +102,7 @@ export async function transferOwnership(req: Request, res: Response): Promise<an
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function updateMe(req: Request, res: Response): Promise<any> { 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 mail = req.body.mail;
let firstname = req.body.firstname; let firstname = req.body.firstname;
let lastname = req.body.lastname; let lastname = req.body.lastname;

Some files were not shown because too many files have changed in this diff Show more