diff --git a/admin/package.json b/admin/package.json index fd2d0bddc..d98e10209 100644 --- a/admin/package.json +++ b/admin/package.json @@ -72,6 +72,7 @@ "eslint-plugin-vue": "8.7.1", "joi": "^17.13.3", "jsdom": "^25.0.0", + "lightningcss": "^1.30.1", "mock-apollo-client": "^1.2.1", "postcss-html": "^1.8.0", "prettier": "^3.5.3", diff --git a/admin/vite.config.mjs b/admin/vite.config.mjs index 3474b2032..798e3e470 100644 --- a/admin/vite.config.mjs +++ b/admin/vite.config.mjs @@ -98,9 +98,14 @@ export default defineConfig(async ({ command }) => { vitePluginGraphqlLoader(), commonjs(), ], + css: { + extract: CONFIG.PRODUCTION === true, + transformer: 'lightningcss', + }, build: { outDir: path.resolve(__dirname, './build'), chunkSizeWarningLimit: 1600, + cssMinify: 'lightningcss', }, publicDir: '/admin', } diff --git a/bun.lock b/bun.lock index cf44149ae..2e1249299 100644 --- a/bun.lock +++ b/bun.lock @@ -15,7 +15,7 @@ }, "admin": { "name": "admin", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "@iconify/json": "^2.2.228", "@popperjs/core": "^2.11.8", @@ -67,6 +67,7 @@ "eslint-plugin-vue": "8.7.1", "joi": "^17.13.3", "jsdom": "^25.0.0", + "lightningcss": "^1.30.1", "mock-apollo-client": "^1.2.1", "postcss-html": "^1.8.0", "prettier": "^3.5.3", @@ -83,7 +84,7 @@ }, "backend": { "name": "backend", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "cross-env": "^7.0.3", "email-templates": "^10.0.1", @@ -169,7 +170,7 @@ }, "database": { "name": "database", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "@types/uuid": "^8.3.4", "cross-env": "^7.0.3", @@ -195,7 +196,7 @@ }, "dht-node": { "name": "dht-node", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "cross-env": "^7.0.3", "dht-rpc": "6.18.1", @@ -226,7 +227,7 @@ }, "federation": { "name": "federation", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "cross-env": "^7.0.3", "sodium-native": "^3.4.1", @@ -276,7 +277,7 @@ }, "frontend": { "name": "frontend", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "@morev/vue-transitions": "^3.0.2", "@types/leaflet": "^1.9.12", @@ -333,6 +334,7 @@ "@vitest/coverage-v8": "^2.0.5", "@vue/eslint-config-prettier": "^10.2.0", "@vue/test-utils": "^2.4.6", + "chokidar-cli": "^3.0.0", "concurrently": "^9.1.2", "config-schema": "*", "cross-env": "^7.0.3", @@ -350,6 +352,7 @@ "eslint-webpack-plugin": "^5.0.0", "joi": "^17.13.3", "jsdom": "^25.0.0", + "lightningcss": "^1.30.1", "mock-apollo-client": "^1.2.1", "postcss-html": "^1.8.0", "prettier": "^3.5.3", @@ -1397,6 +1400,8 @@ "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + "chokidar-cli": ["chokidar-cli@3.0.0", "", { "dependencies": { "chokidar": "^3.5.2", "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", "yargs": "^13.3.0" }, "bin": { "chokidar": "index.js" } }, "sha512-xVW+Qeh7z15uZRxHOkP93Ux8A0xbPzwK4GaqD8dQOYc34TlkqUhVSS59fK36DOp5WdJlrRzlYSy02Ht99FjZqQ=="], + "chrome-trace-event": ["chrome-trace-event@1.0.4", "", {}, "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ=="], "ci-info": ["ci-info@3.9.0", "", {}, "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ=="], @@ -1455,7 +1460,7 @@ "content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="], - "convert-source-map": ["convert-source-map@1.9.0", "", {}, "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="], + "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], "cookie": ["cookie@0.7.1", "", {}, "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w=="], @@ -1519,6 +1524,8 @@ "debugging-stream": ["debugging-stream@2.0.0", "", { "dependencies": { "streamx": "^2.12.4" } }, "sha512-xwfl6wB/3xc553uwtGnSa94jFxnGOc02C0WU2Nmzwr80gzeqn1FX4VcbvoKIhe8L/lPq4BTQttAbrTN94uN8rA=="], + "decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], + "decimal.js": ["decimal.js@10.5.0", "", {}, "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw=="], "decimal.js-light": ["decimal.js-light@2.5.1", "", {}, "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg=="], @@ -1559,7 +1566,7 @@ "detect-indent": ["detect-indent@6.1.0", "", {}, "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA=="], - "detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], + "detect-libc": ["detect-libc@2.0.4", "", {}, "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA=="], "detect-newline": ["detect-newline@3.1.0", "", {}, "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA=="], @@ -2253,6 +2260,28 @@ "libqp": ["libqp@2.1.1", "", {}, "sha512-0Wd+GPz1O134cP62YU2GTOPNA7Qgl09XwCqM5zpBv87ERCXdfDtyKXvV7c9U22yWJh44QZqBocFnXN11K96qow=="], + "lightningcss": ["lightningcss@1.30.1", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-darwin-arm64": "1.30.1", "lightningcss-darwin-x64": "1.30.1", "lightningcss-freebsd-x64": "1.30.1", "lightningcss-linux-arm-gnueabihf": "1.30.1", "lightningcss-linux-arm64-gnu": "1.30.1", "lightningcss-linux-arm64-musl": "1.30.1", "lightningcss-linux-x64-gnu": "1.30.1", "lightningcss-linux-x64-musl": "1.30.1", "lightningcss-win32-arm64-msvc": "1.30.1", "lightningcss-win32-x64-msvc": "1.30.1" } }, "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg=="], + + "lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.30.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ=="], + + "lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.30.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA=="], + + "lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.30.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig=="], + + "lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.30.1", "", { "os": "linux", "cpu": "arm" }, "sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q=="], + + "lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.30.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw=="], + + "lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.30.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ=="], + + "lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.30.1", "", { "os": "linux", "cpu": "x64" }, "sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw=="], + + "lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.30.1", "", { "os": "linux", "cpu": "x64" }, "sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ=="], + + "lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.30.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA=="], + + "lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.30.1", "", { "os": "win32", "cpu": "x64" }, "sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg=="], + "lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="], "linkify-it": ["linkify-it@5.0.0", "", { "dependencies": { "uc.micro": "^2.0.0" } }, "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ=="], @@ -2267,6 +2296,8 @@ "lodash.clonedeep": ["lodash.clonedeep@4.5.0", "", {}, "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="], + "lodash.debounce": ["lodash.debounce@4.0.8", "", {}, "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="], + "lodash.get": ["lodash.get@4.4.2", "", {}, "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ=="], "lodash.memoize": ["lodash.memoize@4.1.2", "", {}, "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="], @@ -2275,6 +2306,8 @@ "lodash.sortby": ["lodash.sortby@4.7.0", "", {}, "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA=="], + "lodash.throttle": ["lodash.throttle@4.1.1", "", {}, "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ=="], + "lodash.truncate": ["lodash.truncate@4.4.2", "", {}, "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw=="], "log4js": ["log4js@6.9.1", "", { "dependencies": { "date-format": "^4.0.14", "debug": "^4.3.4", "flatted": "^3.2.7", "rfdc": "^1.3.0", "streamroller": "^3.1.5" } }, "sha512-1somDdy9sChrr9/f4UlzhdaGfDR2c/SaD2a4T7qEkG4jTS57/B3qmnjLYePwQ8cqWnUHZI0iAKxMBpCZICiZ2g=="], @@ -2451,7 +2484,7 @@ "object.values": ["object.values@1.2.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA=="], - "ohash": ["ohash@1.1.6", "", {}, "sha512-TBu7PtV8YkAZn0tSxobKY2n2aAQva936lhRrj6957aDaCf9IEtqsKbgMzXE/F/sjqYOwmrukeORHNLe5glk7Cg=="], + "ohash": ["ohash@2.0.11", "", {}, "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ=="], "on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="], @@ -2683,6 +2716,8 @@ "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], + "require-main-filename": ["require-main-filename@2.0.0", "", {}, "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="], + "requires-port": ["requires-port@1.0.0", "", {}, "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="], "resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], @@ -2759,6 +2794,8 @@ "serve-static": ["serve-static@1.16.2", "", { "dependencies": { "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "0.19.0" } }, "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw=="], + "set-blocking": ["set-blocking@2.0.0", "", {}, "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="], + "set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="], "set-function-name": ["set-function-name@2.0.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", "has-property-descriptors": "^1.0.2" } }, "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ=="], @@ -3181,6 +3218,8 @@ "which-collection": ["which-collection@1.0.2", "", { "dependencies": { "is-map": "^2.0.3", "is-set": "^2.0.3", "is-weakmap": "^2.0.2", "is-weakset": "^2.0.3" } }, "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw=="], + "which-module": ["which-module@2.0.1", "", {}, "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ=="], + "which-runtime": ["which-runtime@1.2.1", "", {}, "sha512-8feIHccQFH/whiA1fD1b4c5+Q7T4ry1g1oHYc2mHnFh81tTQFsCvy3zhS2geUapkFAVBddUT/AM1a3rbqJweFg=="], "which-typed-array": ["which-typed-array@1.1.19", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw=="], @@ -3249,8 +3288,6 @@ "@babel/code-frame/js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "@babel/core/convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], - "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], @@ -3319,6 +3356,8 @@ "@jest/source-map/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], + "@jest/transform/convert-source-map": ["convert-source-map@1.9.0", "", {}, "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="], + "@jest/transform/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], "@jest/transform/write-file-atomic": ["write-file-atomic@3.0.3", "", { "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", "typedarray-to-buffer": "^3.1.5" } }, "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q=="], @@ -3327,18 +3366,20 @@ "@ladjs/i18n/qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="], + "@morev/utils/ohash": ["ohash@1.1.6", "", {}, "sha512-TBu7PtV8YkAZn0tSxobKY2n2aAQva936lhRrj6957aDaCf9IEtqsKbgMzXE/F/sjqYOwmrukeORHNLe5glk7Cg=="], + "@morev/utils/type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], "@nuxt/kit/consola": ["consola@3.4.2", "", {}, "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA=="], "@nuxt/kit/ignore": ["ignore@7.0.4", "", {}, "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A=="], - "@nuxt/kit/ohash": ["ohash@2.0.11", "", {}, "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ=="], - "@nuxt/kit/pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], "@nuxt/kit/pkg-types": ["pkg-types@2.1.0", "", { "dependencies": { "confbox": "^0.2.1", "exsolve": "^1.0.1", "pathe": "^2.0.3" } }, "sha512-wmJwA+8ihJixSoHKxZJRBQG1oY8Yr9pGLzRmSsNms0iNWyHHAlZCa7mmKiFR10YPZuz/2k169JiS/inOjBCZ2A=="], + "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="], + "@rollup/pluginutils/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], "@selderee/plugin-htmlparser2/domhandler": ["domhandler@4.3.1", "", { "dependencies": { "domelementtype": "^2.2.0" } }, "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ=="], @@ -3459,8 +3500,6 @@ "c12/dotenv": ["dotenv@16.5.0", "", {}, "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg=="], - "c12/ohash": ["ohash@2.0.11", "", {}, "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ=="], - "c12/pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], "c12/pkg-types": ["pkg-types@2.1.0", "", { "dependencies": { "confbox": "^0.2.1", "exsolve": "^1.0.1", "pathe": "^2.0.3" } }, "sha512-wmJwA+8ihJixSoHKxZJRBQG1oY8Yr9pGLzRmSsNms0iNWyHHAlZCa7mmKiFR10YPZuz/2k169JiS/inOjBCZ2A=="], @@ -3479,6 +3518,10 @@ "cheerio-select/domutils": ["domutils@2.8.0", "", { "dependencies": { "dom-serializer": "^1.0.1", "domelementtype": "^2.2.0", "domhandler": "^4.2.0" } }, "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A=="], + "chokidar-cli/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], + + "chokidar-cli/yargs": ["yargs@13.3.2", "", { "dependencies": { "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^13.1.2" } }, "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw=="], + "citty/consola": ["consola@3.4.2", "", {}, "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA=="], "clean-css/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], @@ -3787,6 +3830,8 @@ "unplugin-vue-components/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], + "v8-to-istanbul/convert-source-map": ["convert-source-map@1.9.0", "", {}, "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A=="], + "vee-validate/@vue/devtools-api": ["@vue/devtools-api@7.7.6", "", { "dependencies": { "@vue/devtools-kit": "^7.7.6" } }, "sha512-b2Xx0KvXZObePpXPYHvBRRJLDQn5nhKjXh7vUhMEtWxz1AYNFOVIsh5+HLP8xDGL7sy+Q7hXeUxPHB/KgbtsPw=="], "vee-validate/type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], @@ -3883,6 +3928,20 @@ "cheerio/htmlparser2/entities": ["entities@2.2.0", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="], + "chokidar-cli/chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], + + "chokidar-cli/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], + + "chokidar-cli/yargs/cliui": ["cliui@5.0.0", "", { "dependencies": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", "wrap-ansi": "^5.1.0" } }, "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA=="], + + "chokidar-cli/yargs/find-up": ["find-up@3.0.0", "", { "dependencies": { "locate-path": "^3.0.0" } }, "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg=="], + + "chokidar-cli/yargs/string-width": ["string-width@3.1.0", "", { "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } }, "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w=="], + + "chokidar-cli/yargs/y18n": ["y18n@4.0.3", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="], + + "chokidar-cli/yargs/yargs-parser": ["yargs-parser@13.1.2", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg=="], + "css-select/domutils/dom-serializer": ["dom-serializer@1.4.1", "", { "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.2.0", "entities": "^2.0.0" } }, "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag=="], "dht-rpc/sodium-universal/sodium-native": ["sodium-native@5.0.1", "", { "dependencies": { "require-addon": "^1.1.0", "which-runtime": "^1.2.1" } }, "sha512-Q305aUXc0OzK7VVRvWkeEQJQIHs6slhFwWpyqLB5iJqhpyt2lYIVu96Y6PQ7TABIlWXVF3YiWDU3xS2Snkus+g=="], @@ -4091,6 +4150,20 @@ "cheerio-select/domutils/dom-serializer/entities": ["entities@2.2.0", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="], + "chokidar-cli/yargs/cliui/strip-ansi": ["strip-ansi@5.2.0", "", { "dependencies": { "ansi-regex": "^4.1.0" } }, "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA=="], + + "chokidar-cli/yargs/cliui/wrap-ansi": ["wrap-ansi@5.1.0", "", { "dependencies": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", "strip-ansi": "^5.0.0" } }, "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q=="], + + "chokidar-cli/yargs/find-up/locate-path": ["locate-path@3.0.0", "", { "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A=="], + + "chokidar-cli/yargs/string-width/emoji-regex": ["emoji-regex@7.0.3", "", {}, "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="], + + "chokidar-cli/yargs/string-width/is-fullwidth-code-point": ["is-fullwidth-code-point@2.0.0", "", {}, "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w=="], + + "chokidar-cli/yargs/string-width/strip-ansi": ["strip-ansi@5.2.0", "", { "dependencies": { "ansi-regex": "^4.1.0" } }, "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA=="], + + "chokidar-cli/yargs/yargs-parser/camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="], + "css-select/domutils/dom-serializer/entities": ["entities@2.2.0", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="], "editorconfig/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], @@ -4145,6 +4218,16 @@ "@typescript-eslint/utils/@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "chokidar-cli/yargs/cliui/strip-ansi/ansi-regex": ["ansi-regex@4.1.1", "", {}, "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g=="], + + "chokidar-cli/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], + + "chokidar-cli/yargs/find-up/locate-path/p-locate": ["p-locate@3.0.0", "", { "dependencies": { "p-limit": "^2.0.0" } }, "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ=="], + + "chokidar-cli/yargs/find-up/locate-path/path-exists": ["path-exists@3.0.0", "", {}, "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ=="], + + "chokidar-cli/yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@4.1.1", "", {}, "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g=="], + "js-beautify/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], "pkg-dir/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], @@ -4154,5 +4237,11 @@ "typeorm/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], "vue-apollo/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], + + "chokidar-cli/yargs/cliui/wrap-ansi/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], + + "chokidar-cli/yargs/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], + + "chokidar-cli/yargs/cliui/wrap-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], } } diff --git a/database/entity/0001-init_db/Balance.ts b/database/entity/0001-init_db/Balance.ts deleted file mode 100644 index 8da3879af..000000000 --- a/database/entity/0001-init_db/Balance.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { User } from '../User' - -@Entity('state_balances') -export class Balance extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column({ name: 'state_user_id' }) - userId: number - - @Column({ type: 'datetime' }) - modified: Date - - @Column({ name: 'record_date', type: 'datetime' }) - recordDate: Date - - @Column({ type: 'bigint' }) - amount: number - - @OneToOne(() => User, { nullable: false }) - @JoinColumn({ name: 'state_user_id' }) - user: User -} diff --git a/database/entity/0001-init_db/Migration.ts b/database/entity/0001-init_db/Migration.ts deleted file mode 100644 index 13c848b07..000000000 --- a/database/entity/0001-init_db/Migration.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('migrations') -export class Migration extends BaseEntity { - @PrimaryGeneratedColumn() // This is actually not a primary column - version: number - - @Column({ type: 'varchar', length: 256, nullable: true, default: null }) - fileName: string - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - date: Date -} diff --git a/database/entity/0001-init_db/ServerUser.ts b/database/entity/0001-init_db/ServerUser.ts deleted file mode 100644 index 8d9819612..000000000 --- a/database/entity/0001-init_db/ServerUser.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('server_users') -export class ServerUser extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 50 }) - username: string - - @Column({ length: 255 }) - password: string - - @Column({ length: 50, unique: true }) - email: string - - @Column({ length: 20, default: 'admin' }) - role: string - - @Column({ default: 0 }) - activated: number - - @Column({ name: 'last_login', default: null, nullable: true }) - lastLogin: Date - - @Column({ default: () => 'CURRENT_TIMESTAMP' }) - created: Date - - @Column({ default: () => 'CURRENT_TIMESTAMP' }) - modified: Date -} diff --git a/database/entity/0001-init_db/Transaction.ts b/database/entity/0001-init_db/Transaction.ts deleted file mode 100644 index 52a07eb27..000000000 --- a/database/entity/0001-init_db/Transaction.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { BaseEntity, Column, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { TransactionCreation } from './TransactionCreation' -import { TransactionSendCoin } from './TransactionSendCoin' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column({ name: 'state_group_id', unsigned: true, default: null }) - stateGroupId: number - - @Column({ name: 'transaction_type_id', unsigned: true, nullable: false }) - transactionTypeId: number - - @Column({ name: 'tx_hash', type: 'binary', length: 48, default: null }) - txHash: Buffer - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ type: 'timestamp', nullable: false, default: () => 'CURRENT_TIMESTAMP' }) - received: Date - - @Column({ - name: 'blockchain_type_id', - type: 'bigint', - unsigned: true, - nullable: false, - default: 1, - }) - blockchainTypeId: number - - @OneToOne( - () => TransactionSendCoin, - (transactionSendCoin) => transactionSendCoin.transaction, - ) - transactionSendCoin: TransactionSendCoin - - @OneToOne( - () => TransactionCreation, - (transactionCreation) => transactionCreation.transaction, - ) - transactionCreation: TransactionCreation -} diff --git a/database/entity/0001-init_db/TransactionCreation.ts b/database/entity/0001-init_db/TransactionCreation.ts deleted file mode 100644 index 6faac82aa..000000000 --- a/database/entity/0001-init_db/TransactionCreation.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { Transaction } from '../Transaction' - -@Entity('transaction_creations') -export class TransactionCreation extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column({ name: 'transaction_id' }) - transactionId: number - - @Column({ name: 'state_user_id' }) - userId: number - - @Column() - amount: number - - @Column({ name: 'target_date', type: 'timestamp' }) - targetDate: Date - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'transaction_id' }) - transaction: Transaction -} diff --git a/database/entity/0001-init_db/TransactionSendCoin.ts b/database/entity/0001-init_db/TransactionSendCoin.ts deleted file mode 100644 index 3b9fa87a9..000000000 --- a/database/entity/0001-init_db/TransactionSendCoin.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { Transaction } from '../Transaction' - -@Entity('transaction_send_coins') -export class TransactionSendCoin extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column({ name: 'transaction_id' }) - transactionId: number - - @Column({ name: 'sender_public_key', type: 'binary', length: 32 }) - senderPublic: Buffer - - @Column({ name: 'state_user_id' }) - userId: number - - @Column({ name: 'receiver_public_key', type: 'binary', length: 32 }) - recipiantPublic: Buffer - - @Column({ name: 'receiver_user_id' }) - recipiantUserId: number - - @Column() - amount: number - - @Column({ name: 'sender_final_balance' }) - senderFinalBalance: number - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'transaction_id' }) - transaction: Transaction -} diff --git a/database/entity/0001-init_db/TransactionSignature.ts b/database/entity/0001-init_db/TransactionSignature.ts deleted file mode 100644 index b95bddd50..000000000 --- a/database/entity/0001-init_db/TransactionSignature.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { Transaction } from '../Transaction' - -@Entity('transaction_signatures') -export class TransactionSignature extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'transaction_id' }) - transactionId: number - - @Column({ type: 'binary', length: 64, nullable: false }) - signature: Buffer - - @Column({ type: 'binary', length: 32, nullable: false }) - pubkey: Buffer - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'transaction_id' }) - transaction: Transaction -} diff --git a/database/entity/0001-init_db/User.ts b/database/entity/0001-init_db/User.ts deleted file mode 100644 index fbc010ca9..000000000 --- a/database/entity/0001-init_db/User.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { BaseEntity, Column, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { Balance } from './Balance' - -// Moriz: I do not like the idea of having two user tables -@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'index_id', type: 'smallint', default: 0, nullable: false }) - indexId: number - - @Column({ name: 'group_id', default: 0, unsigned: true }) - groupId: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubkey: Buffer - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @OneToOne( - () => Balance, - (balance) => balance.user, - ) - balance: Balance -} diff --git a/database/entity/0001-init_db/UserTransaction.ts b/database/entity/0001-init_db/UserTransaction.ts deleted file mode 100644 index b0e90f7f4..000000000 --- a/database/entity/0001-init_db/UserTransaction.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('state_user_transactions') -export class UserTransaction extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column({ name: 'state_user_id' }) - userId: number - - @Column({ name: 'transaction_id' }) - transactionId: number - - @Column({ name: 'transaction_type_id' }) - transactionTypeId: number - - @Column({ name: 'balance', type: 'bigint' }) - balance: number - - @Column({ name: 'balance_date', type: 'timestamp' }) - balanceDate: Date -} diff --git a/database/entity/0002-add_settings/User.ts b/database/entity/0002-add_settings/User.ts deleted file mode 100644 index e74abe4d9..000000000 --- a/database/entity/0002-add_settings/User.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { BaseEntity, Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm' -import { UserSetting } from './UserSetting' - -// Moriz: I do not like the idea of having two user tables -@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'index_id', type: 'smallint', default: 0, nullable: false }) - indexId: number - - @Column({ name: 'group_id', default: 0, unsigned: true }) - groupId: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubkey: Buffer - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0002-add_settings/UserSetting.ts b/database/entity/0002-add_settings/UserSetting.ts deleted file mode 100644 index 7fbb36e91..000000000 --- a/database/entity/0002-add_settings/UserSetting.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm' -import { User } from '../0034-drop_server_user_table/User' - -@Entity() -export class UserSetting extends BaseEntity { - @PrimaryGeneratedColumn() - id: number - - @Column() - userId: number - - @ManyToOne( - () => User, - (user) => user.settings, - ) - user: User - - @Column() - key: string - - @Column() - value: string -} diff --git a/database/entity/0003-login_server_tables/LoginElopageBuys.ts b/database/entity/0003-login_server_tables/LoginElopageBuys.ts deleted file mode 100644 index cc9322d1d..000000000 --- a/database/entity/0003-login_server_tables/LoginElopageBuys.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('login_elopage_buys') -export class LoginElopageBuys extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'int', width: 11, name: 'elopage_user_id', nullable: true, default: null }) - elopageUserId: number | null - - @Column({ name: 'affiliate_program_id', nullable: false }) - affiliateProgramId: number - - @Column({ name: 'publisher_id', nullable: false }) - publisherId: number - - @Column({ name: 'order_id', nullable: false }) - orderId: number - - @Column({ name: 'product_id', nullable: false }) - productId: number - - @Column({ name: 'product_price', nullable: false }) - productPrice: number - - @Column({ - name: 'payer_email', - length: 255, - nullable: false, - charset: 'utf8', - collation: 'utf8_bin', - }) - payerEmail: string - - @Column({ - name: 'publisher_email', - length: 255, - nullable: false, - charset: 'utf8', - collation: 'utf8_bin', - }) - publisherEmail: string - - @Column({ nullable: false }) - payed: boolean - - @Column({ name: 'success_date', nullable: false }) - successDate: Date - - @Column({ length: 255, nullable: false }) - event: string -} diff --git a/database/entity/0003-login_server_tables/LoginEmailOptIn.ts b/database/entity/0003-login_server_tables/LoginEmailOptIn.ts deleted file mode 100644 index 46f74e7de..000000000 --- a/database/entity/0003-login_server_tables/LoginEmailOptIn.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -// Moriz: I do not like the idea of having two user tables -@Entity('login_email_opt_in') -export class LoginEmailOptIn extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @Column({ name: 'verification_code', type: 'bigint', unsigned: true, unique: true }) - verificationCode: BigInt - - @Column({ name: 'email_opt_in_type_id', type: 'int', unsigned: true, nullable: false }) - emailOptInTypeId: number - - @Column({ name: 'created', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date - - @Column({ name: 'resend_count', type: 'int', unsigned: true, default: 0 }) - resendCount: number - - @Column({ name: 'updated', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt: Date -} diff --git a/database/entity/0003-login_server_tables/LoginUser.ts b/database/entity/0003-login_server_tables/LoginUser.ts deleted file mode 100644 index c3ebf9748..000000000 --- a/database/entity/0003-login_server_tables/LoginUser.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { BaseEntity, Column, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { LoginUserBackup } from './LoginUserBackup' - -// Moriz: I do not like the idea of having two user tables -@Entity('login_users') -export class LoginUser extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 191, unique: true }) - email: string - - @Column({ name: 'first_name', length: 150 }) - firstName: string - - @Column({ name: 'last_name', length: 255, default: '' }) - lastName: string - - @Column({ length: 255, default: '' }) - username: string - - @Column({ type: 'mediumtext', default: '', nullable: true }) - description: string - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'pubkey', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ name: 'passphrase_shown', type: 'bool', nullable: false, default: false }) - passphraseShown: boolean - - @Column({ length: 4, default: 'de', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ name: 'group_id', default: 0, unsigned: true }) - groupId: number - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToOne( - () => LoginUserBackup, - (loginUserBackup) => loginUserBackup.loginUser, - ) - loginUserBackup: LoginUserBackup -} diff --git a/database/entity/0003-login_server_tables/LoginUserBackup.ts b/database/entity/0003-login_server_tables/LoginUserBackup.ts deleted file mode 100644 index a6e7f888d..000000000 --- a/database/entity/0003-login_server_tables/LoginUserBackup.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { LoginUser } from './LoginUser' - -@Entity('login_user_backups') -export class LoginUserBackup extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'text', name: 'passphrase', nullable: false }) - passphrase: string - - @Column({ name: 'user_id', nullable: false }) - userId: number - - @Column({ name: 'mnemonic_type', default: -1 }) - mnemonicType: number - - @OneToOne( - () => LoginUser, - (loginUser) => loginUser.loginUserBackup, - { nullable: false }, - ) - @JoinColumn({ name: 'user_id' }) - loginUser: LoginUser -} diff --git a/database/entity/0003-login_server_tables/LoginUserRoles.ts b/database/entity/0003-login_server_tables/LoginUserRoles.ts deleted file mode 100644 index f04892b0b..000000000 --- a/database/entity/0003-login_server_tables/LoginUserRoles.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('login_user_roles') -export class LoginUserRoles extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id' }) - userId: number - - @Column({ name: 'role_id' }) - roleId: number -} diff --git a/database/entity/0005-admin_tables/LoginPendingTasksAdmin.ts b/database/entity/0005-admin_tables/LoginPendingTasksAdmin.ts deleted file mode 100644 index 26b92f43b..000000000 --- a/database/entity/0005-admin_tables/LoginPendingTasksAdmin.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('login_pending_tasks_admin') -export class LoginPendingTasksAdmin extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - created: Date - - @Column({ type: 'datetime', nullable: false }) - date: Date - - @Column({ length: 256, nullable: true, default: null }) - memo: string - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column() - moderator: number -} diff --git a/database/entity/0006-login_users_collation/LoginUser.ts b/database/entity/0006-login_users_collation/LoginUser.ts deleted file mode 100644 index ded5b992f..000000000 --- a/database/entity/0006-login_users_collation/LoginUser.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { BaseEntity, Column, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { LoginUserBackup } from '../0003-login_server_tables/LoginUserBackup' - -// Moriz: I do not like the idea of having two user tables -@Entity('login_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class LoginUser extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 191, unique: true, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ name: 'first_name', length: 150, collation: 'utf8mb4_unicode_ci' }) - firstName: string - - @Column({ name: 'last_name', length: 255, default: '', collation: 'utf8mb4_unicode_ci' }) - lastName: string - - @Column({ length: 255, default: '', collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'mediumtext', default: '', collation: 'utf8mb4_unicode_ci', nullable: true }) - description: string - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'pubkey', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ name: 'passphrase_shown', type: 'bool', nullable: false, default: false }) - passphraseShown: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ name: 'group_id', default: 0, unsigned: true }) - groupId: number - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToOne( - () => LoginUserBackup, - (loginUserBackup) => loginUserBackup.loginUser, - ) - loginUserBackup: LoginUserBackup -} diff --git a/database/entity/0015-admin_pending_creations/AdminPendingCreation.ts b/database/entity/0015-admin_pending_creations/AdminPendingCreation.ts deleted file mode 100644 index 1c3027867..000000000 --- a/database/entity/0015-admin_pending_creations/AdminPendingCreation.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('admin_pending_creations') -export class AdminPendingCreation extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - created: Date - - @Column({ type: 'datetime', nullable: false }) - date: Date - - @Column({ length: 256, nullable: true, default: null }) - memo: string - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column() - moderator: number -} diff --git a/database/entity/0016-transaction_signatures/Transaction.ts b/database/entity/0016-transaction_signatures/Transaction.ts deleted file mode 100644 index acce97bbf..000000000 --- a/database/entity/0016-transaction_signatures/Transaction.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { BaseEntity, Column, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { TransactionCreation } from '../0001-init_db/TransactionCreation' -import { TransactionSendCoin } from '../0001-init_db/TransactionSendCoin' - -@Entity('transactions') -export class Transaction extends BaseEntity { - // TODO the id is defined as bigint(20) - there might be problems with that: https://github.com/typeorm/typeorm/issues/2400 - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'transaction_type_id', unsigned: true, nullable: false }) - transactionTypeId: number - - @Column({ name: 'tx_hash', type: 'binary', length: 48, default: null }) - txHash: Buffer - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ type: 'timestamp', nullable: false, default: () => 'CURRENT_TIMESTAMP' }) - received: Date - - @Column({ type: 'binary', length: 64, nullable: true, default: null }) - signature: Buffer - - @Column({ type: 'binary', length: 32, nullable: true, default: null }) - pubkey: Buffer - - @OneToOne( - () => TransactionSendCoin, - (transactionSendCoin) => transactionSendCoin.transaction, - ) - transactionSendCoin: TransactionSendCoin - - @OneToOne( - () => TransactionCreation, - (transactionCreation) => transactionCreation.transaction, - ) - transactionCreation: TransactionCreation -} diff --git a/database/entity/0017-combine_user_tables/LoginUserBackup.ts b/database/entity/0017-combine_user_tables/LoginUserBackup.ts deleted file mode 100644 index 7ee0fd464..000000000 --- a/database/entity/0017-combine_user_tables/LoginUserBackup.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('login_user_backups') -export class LoginUserBackup extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'text', name: 'passphrase', nullable: false }) - passphrase: string - - @Column({ name: 'user_id', nullable: false }) - userId: number - - @Column({ name: 'mnemonic_type', default: -1 }) - mnemonicType: number -} diff --git a/database/entity/0017-combine_user_tables/User.ts b/database/entity/0017-combine_user_tables/User.ts deleted file mode 100644 index 207c8ce99..000000000 --- a/database/entity/0017-combine_user_tables/User.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { BaseEntity, Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'login_user_id', default: null, unsigned: true }) - loginUserId: number - - @Column({ name: 'index_id', type: 'smallint', default: 0, nullable: false }) - indexId: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ type: 'mediumtext', default: '', collation: 'utf8mb4_unicode_ci', nullable: true }) - description: string - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ name: 'passphrase_shown', type: 'bool', nullable: false, default: false }) - passphraseShown: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0018-combine_login_user_backups_and_user_table/User.ts b/database/entity/0018-combine_login_user_backups_and_user_table/User.ts deleted file mode 100644 index f84f7418a..000000000 --- a/database/entity/0018-combine_login_user_backups_and_user_table/User.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { BaseEntity, Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'login_user_id', default: null, unsigned: true }) - loginUserId: number - - @Column({ name: 'index_id', type: 'smallint', default: 0, nullable: false }) - indexId: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ type: 'mediumtext', default: '', collation: 'utf8mb4_unicode_ci', nullable: true }) - description: string - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ name: 'passphrase_shown', type: 'bool', nullable: false, default: false }) - passphraseShown: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0019-replace_login_user_id_with_state_user_id/User.ts b/database/entity/0019-replace_login_user_id_with_state_user_id/User.ts deleted file mode 100644 index 9a54129d3..000000000 --- a/database/entity/0019-replace_login_user_id_with_state_user_id/User.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { BaseEntity, Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('state_users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'index_id', type: 'smallint', default: 0, nullable: false }) - indexId: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ length: 255, nullable: true, default: null, collation: 'utf8mb4_unicode_ci' }) - username: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ type: 'mediumtext', default: '', collation: 'utf8mb4_unicode_ci', nullable: true }) - description: string - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ name: 'passphrase_shown', type: 'bool', nullable: false, default: false }) - passphraseShown: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0020-rename_and_clean_state_users/User.ts b/database/entity/0020-rename_and_clean_state_users/User.ts deleted file mode 100644 index d37ded4f4..000000000 --- a/database/entity/0020-rename_and_clean_state_users/User.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { BaseEntity, Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ type: 'bool', default: false }) - disabled: boolean - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts b/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts deleted file mode 100644 index 18dbe7961..000000000 --- a/database/entity/0021-elopagebuys_fields_nullable/LoginElopageBuys.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('login_elopage_buys') -export class LoginElopageBuys extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'int', width: 11, name: 'elopage_user_id', nullable: true, default: null }) - elopageUserId: number | null - - @Column({ type: 'int', width: 11, name: 'affiliate_program_id', nullable: true, default: null }) - affiliateProgramId: number | null - - @Column({ type: 'int', width: 11, name: 'publisher_id', nullable: true, default: null }) - publisherId: number | null - - @Column({ type: 'int', width: 11, name: 'order_id', nullable: true, default: null }) - orderId: number | null - - @Column({ type: 'int', width: 11, name: 'product_id', nullable: true, default: null }) - productId: number | null - - @Column({ name: 'product_price', type: 'int', nullable: false }) - productPrice: number - - @Column({ - name: 'payer_email', - type: 'varchar', - length: 255, - nullable: false, - charset: 'utf8', - collation: 'utf8_bin', - }) - payerEmail: string - - @Column({ - name: 'publisher_email', - type: 'varchar', - length: 255, - nullable: false, - charset: 'utf8', - collation: 'utf8_bin', - }) - publisherEmail: string - - @Column({ type: 'bool', nullable: false }) - payed: boolean - - @Column({ name: 'success_date', type: 'datetime', nullable: false }) - successDate: Date - - @Column({ type: 'varchar', length: 255, nullable: false }) - event: string -} diff --git a/database/entity/0023-users_disabled_soft_delete/User.ts b/database/entity/0023-users_disabled_soft_delete/User.ts deleted file mode 100644 index d49abf723..000000000 --- a/database/entity/0023-users_disabled_soft_delete/User.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0024-combine_transaction_tables/Transaction.ts b/database/entity/0024-combine_transaction_tables/Transaction.ts deleted file mode 100644 index 9f2681f5a..000000000 --- a/database/entity/0024-combine_transaction_tables/Transaction.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('transactions') -export class Transaction extends BaseEntity { - // TODO the id is defined as bigint(20) - there might be problems with that: https://github.com/typeorm/typeorm/issues/2400 - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'transaction_type_id', unsigned: true, nullable: false }) - transactionTypeId: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column({ name: 'tx_hash', type: 'binary', length: 48, default: null, nullable: true }) - txHash: Buffer - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ type: 'timestamp', nullable: false, default: () => 'CURRENT_TIMESTAMP' }) - received: Date - - @Column({ type: 'binary', length: 64, nullable: true, default: null }) - signature: Buffer - - @Column({ type: 'binary', length: 32, nullable: true, default: null }) - pubkey: Buffer - - @Column({ - name: 'creation_ident_hash', - type: 'binary', - length: 32, - nullable: true, - default: null, - }) - creationIdentHash: Buffer - - @Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null }) - creationDate: Date - - @Column({ - name: 'send_receiver_public_key', - type: 'binary', - length: 32, - nullable: true, - default: null, - }) - sendReceiverPublicKey: Buffer | null - - @Column({ - name: 'send_receiver_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - sendReceiverUserId?: number | null - - @Column({ - name: 'send_sender_final_balance', - type: 'bigint', - nullable: true, - default: null, - }) - sendSenderFinalBalance: BigInt | null -} diff --git a/database/entity/0026-combine_transaction_tables2/Transaction.ts b/database/entity/0026-combine_transaction_tables2/Transaction.ts deleted file mode 100644 index 293245cc2..000000000 --- a/database/entity/0026-combine_transaction_tables2/Transaction.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ name: 'transaction_id', unsigned: true, nullable: false }) - transactionId: number - - @Column({ name: 'transaction_type_id', unsigned: true, nullable: false }) - transactionTypeId: number - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - name: 'send_sender_final_balance', - type: 'bigint', - nullable: true, - default: null, - }) - sendSenderFinalBalance: BigInt | null - - @Column({ name: 'balance', type: 'bigint', default: 0 }) - balance: BigInt - - @Column({ - name: 'balance_date', - type: 'timestamp', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - received: Date - - @Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null }) - creationDate: Date - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_state_user_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedStateUserTransactionId?: number | null - - @Column({ type: 'binary', length: 64, nullable: true, default: null }) - signature: Buffer - - @Column({ name: 'tx_hash', type: 'binary', length: 48, default: null, nullable: true }) - txHash: Buffer - - @Column({ type: 'binary', length: 32, nullable: true, default: null }) - pubkey: Buffer - - @Column({ - name: 'creation_ident_hash', - type: 'binary', - length: 32, - nullable: true, - default: null, - }) - creationIdentHash: Buffer -} diff --git a/database/entity/0027-clean_transaction_table/Transaction.ts b/database/entity/0027-clean_transaction_table/Transaction.ts deleted file mode 100644 index eb703f688..000000000 --- a/database/entity/0027-clean_transaction_table/Transaction.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - name: 'send_sender_final_balance', - type: 'bigint', - nullable: true, - default: null, - }) - sendSenderFinalBalance: BigInt | null - - @Column({ name: 'balance', type: 'bigint', default: 0 }) - balance: BigInt - - @Column({ - name: 'balance_date', - type: 'timestamp', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ name: 'creation_date', type: 'timestamp', nullable: true, default: null }) - creationDate: Date - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null -} diff --git a/database/entity/0028-decimal_types/Transaction.ts b/database/entity/0028-decimal_types/Transaction.ts deleted file mode 100644 index f9a88be36..000000000 --- a/database/entity/0028-decimal_types/Transaction.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'int', unsigned: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - name: 'dec_amount', - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decAmount: Decimal - - @Column({ - name: 'dec_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decBalance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - name: 'dec_decay', - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decDecay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ type: 'bigint', nullable: false }) - amount: BigInt - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - name: 'send_sender_final_balance', - type: 'bigint', - nullable: true, - default: null, - }) - sendSenderFinalBalance: BigInt | null - - @Column({ name: 'balance', type: 'bigint', default: 0 }) - balance: BigInt - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @Column({ - name: 'temp_dec_send_sender_final_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - tempDecSendSenderFinalBalance: Decimal - - @Column({ - name: 'temp_dec_diff_send_sender_final_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - tempDecDiffSendSenderFinalBalance: Decimal - - @Column({ - name: 'temp_dec_old_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - tempDecOldBalance: Decimal - - @Column({ - name: 'temp_dec_diff_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - tempDecDiffBalance: Decimal -} diff --git a/database/entity/0029-clean_transaction_table/Transaction.ts b/database/entity/0029-clean_transaction_table/Transaction.ts deleted file mode 100644 index 485071bd5..000000000 --- a/database/entity/0029-clean_transaction_table/Transaction.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'int', unsigned: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null -} diff --git a/database/entity/0030-transaction_link/TransactionLink.ts b/database/entity/0030-transaction_link/TransactionLink.ts deleted file mode 100644 index add06c2e1..000000000 --- a/database/entity/0030-transaction_link/TransactionLink.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('transaction_links') -export class TransactionLink extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false }) - userId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - name: 'hold_available_amount', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - holdAvailableAmount: Decimal - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) - code: string - - @Column({ - type: 'datetime', - nullable: false, - }) - createdAt: Date - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ - type: 'datetime', - nullable: false, - }) - validUntil: Date - - @Column({ - type: 'boolean', - default: () => false, - nullable: false, - }) - showEmail: boolean - - @Column({ - type: 'datetime', - nullable: true, - }) - redeemedAt: Date | null - - @Column({ type: 'int', unsigned: true, nullable: true }) - redeemedBy: number | null -} diff --git a/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts b/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts deleted file mode 100644 index 104d6e1bc..000000000 --- a/database/entity/0031-remove_sendEmail_from_transaction_link/TransactionLink.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('transaction_links') -export class TransactionLink extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - name: 'hold_available_amount', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - holdAvailableAmount: Decimal - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) - code: string - - @Column({ - type: 'datetime', - nullable: false, - }) - createdAt: Date - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ - type: 'datetime', - nullable: false, - }) - validUntil: Date - - @Column({ - type: 'datetime', - nullable: true, - }) - redeemedAt: Date | null - - @Column({ type: 'int', unsigned: true, nullable: true }) - redeemedBy: number | null -} diff --git a/database/entity/0032-add-transaction-link-to-transaction/Transaction.ts b/database/entity/0032-add-transaction-link-to-transaction/Transaction.ts deleted file mode 100644 index f45c05c67..000000000 --- a/database/entity/0032-add-transaction-link-to-transaction/Transaction.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'int', unsigned: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null -} diff --git a/database/entity/0033-add_referrer_id/User.ts b/database/entity/0033-add_referrer_id/User.ts deleted file mode 100644 index d407c4a35..000000000 --- a/database/entity/0033-add_referrer_id/User.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0034-drop_server_user_table/User.ts b/database/entity/0034-drop_server_user_table/User.ts deleted file mode 100644 index b304a5c28..000000000 --- a/database/entity/0034-drop_server_user_table/User.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { UserSetting } from '../0002-add_settings/UserSetting' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => UserSetting, - (userSetting) => userSetting.user, - ) - settings: UserSetting[] -} diff --git a/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts b/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts deleted file mode 100644 index b56b5ac47..000000000 --- a/database/entity/0035-admin_pending_creations_decimal/AdminPendingCreation.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('admin_pending_creations') -export class AdminPendingCreation extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - created: Date - - @Column({ type: 'datetime', nullable: false }) - date: Date - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column() - moderator: number -} diff --git a/database/entity/0036-unique_previous_in_transactions/Transaction.ts b/database/entity/0036-unique_previous_in_transactions/Transaction.ts deleted file mode 100644 index efa376cbe..000000000 --- a/database/entity/0036-unique_previous_in_transactions/Transaction.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* eslint-disable no-use-before-define */ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null - - @OneToOne( - () => Contribution, - (contribution) => contribution.transaction, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - contribution?: Contribution | null - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'previous' }) - previousTransaction?: Transaction | null -} diff --git a/database/entity/0037-drop_user_setting_table/User.ts b/database/entity/0037-drop_user_setting_table/User.ts deleted file mode 100644 index 2dff80d4b..000000000 --- a/database/entity/0037-drop_user_setting_table/User.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string -} diff --git a/database/entity/0038-add_contribution_links_table/ContributionLink.ts b/database/entity/0038-add_contribution_links_table/ContributionLink.ts deleted file mode 100644 index 479aff51a..000000000 --- a/database/entity/0038-add_contribution_links_table/ContributionLink.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('contribution_links') -export class ContributionLink extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) - name: string - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'valid_from', type: 'datetime', nullable: false }) - validFrom: Date - - @Column({ name: 'valid_to', type: 'datetime', nullable: true, default: null }) - validTo: Date | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - cycle: string - - @Column({ name: 'max_per_cycle', type: 'int', unsigned: true, nullable: false, default: 1 }) - maxPerCycle: number - - @Column({ - name: 'max_amount_per_month', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - maxAmountPerMonth: Decimal | null - - @Column({ - name: 'total_max_count_of_contribution', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - totalMaxCountOfContribution: number | null - - @Column({ - name: 'max_account_balance', - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - default: null, - transformer: DecimalTransformer, - }) - maxAccountBalance: Decimal | null - - @Column({ - name: 'min_gap_hours', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - minGapHours: number | null - - @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', type: 'datetime' }) - deletedAt: Date | null - - @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) - code: string - - @Column({ name: 'link_enabled', type: 'boolean', default: true }) - linkEnabled: boolean -} diff --git a/database/entity/0039-contributions_table/Contribution.ts b/database/entity/0039-contributions_table/Contribution.ts deleted file mode 100644 index 116638c54..000000000 --- a/database/entity/0039-contributions_table/Contribution.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null -} diff --git a/database/entity/0039-contributions_table/User.ts b/database/entity/0039-contributions_table/User.ts deleted file mode 100644 index 31f78cffd..000000000 --- a/database/entity/0039-contributions_table/User.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] -} diff --git a/database/entity/0040-add_contribution_link_id_to_user/User.ts b/database/entity/0040-add_contribution_link_id_to_user/User.ts deleted file mode 100644 index 79bccec0d..000000000 --- a/database/entity/0040-add_contribution_link_id_to_user/User.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] -} diff --git a/database/entity/0043-add_event_protocol_table/EventProtocol.ts b/database/entity/0043-add_event_protocol_table/EventProtocol.ts deleted file mode 100644 index df0e84de8..000000000 --- a/database/entity/0043-add_event_protocol_table/EventProtocol.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('event_protocol') -export class EventProtocol extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ name: 'x_user_id', unsigned: true, nullable: true }) - xUserId: number - - @Column({ name: 'x_community_id', unsigned: true, nullable: true }) - xCommunityId: number - - @Column({ name: 'transaction_id', unsigned: true, nullable: true }) - transactionId: number - - @Column({ name: 'contribution_id', unsigned: true, nullable: true }) - contributionId: number - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - amount: Decimal -} diff --git a/database/entity/0045-add_denied_type_and_status_to_contributions/Contribution.ts b/database/entity/0045-add_denied_type_and_status_to_contributions/Contribution.ts deleted file mode 100644 index 8d5d4cbf8..000000000 --- a/database/entity/0045-add_denied_type_and_status_to_contributions/Contribution.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null -} diff --git a/database/entity/0046-adapt_users_table_for_gradidoid/User.ts b/database/entity/0046-adapt_users_table_for_gradidoid/User.ts deleted file mode 100644 index bff248f6d..000000000 --- a/database/entity/0046-adapt_users_table_for_gradidoid/User.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - unique: true, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - unique: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] -} diff --git a/database/entity/0047-messages_tables/Contribution.ts b/database/entity/0047-messages_tables/Contribution.ts deleted file mode 100644 index 48711c531..000000000 --- a/database/entity/0047-messages_tables/Contribution.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { ContributionMessage } from '../ContributionMessage' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @OneToMany( - () => ContributionMessage, - (message) => message.contribution, - ) - @JoinColumn({ name: 'contribution_id' }) - messages?: ContributionMessage[] -} diff --git a/database/entity/0047-messages_tables/ContributionMessage.ts b/database/entity/0047-messages_tables/ContributionMessage.ts deleted file mode 100644 index 0dbaee232..000000000 --- a/database/entity/0047-messages_tables/ContributionMessage.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { User } from '../User' - -@Entity('contribution_messages', { - engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', -}) -export class ContributionMessage extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'contribution_id', unsigned: true, nullable: false }) - contributionId: number - - @ManyToOne( - () => Contribution, - (contribution) => contribution.messages, - ) - @JoinColumn({ name: 'contribution_id' }) - contribution: Contribution - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @ManyToOne( - () => User, - (user) => user.messages, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) - message: string - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @Column({ name: 'deleted_by', default: null, unsigned: true, nullable: true }) - deletedBy: number - - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string -} diff --git a/database/entity/0047-messages_tables/User.ts b/database/entity/0047-messages_tables/User.ts deleted file mode 100644 index 1ebfb0586..000000000 --- a/database/entity/0047-messages_tables/User.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - unique: true, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - unique: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - emailHash: Buffer - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] -} diff --git a/database/entity/0048-add_is_moderator_to_contribution_messages/ContributionMessage.ts b/database/entity/0048-add_is_moderator_to_contribution_messages/ContributionMessage.ts deleted file mode 100644 index a6e37729e..000000000 --- a/database/entity/0048-add_is_moderator_to_contribution_messages/ContributionMessage.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { User } from '../User' - -@Entity('contribution_messages', { - engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', -}) -export class ContributionMessage extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'contribution_id', unsigned: true, nullable: false }) - contributionId: number - - @ManyToOne( - () => Contribution, - (contribution) => contribution.messages, - ) - @JoinColumn({ name: 'contribution_id' }) - contribution: Contribution - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @ManyToOne( - () => User, - (user) => user.messages, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) - message: string - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @Column({ name: 'deleted_by', default: null, unsigned: true, nullable: true }) - deletedBy: number - - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) - isModerator: boolean -} diff --git a/database/entity/0049-add_user_contacts_table/User.ts b/database/entity/0049-add_user_contacts_table/User.ts deleted file mode 100644 index 46b65f005..000000000 --- a/database/entity/0049-add_user_contacts_table/User.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - /* - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - */ - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @DeleteDateColumn() - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - /* - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - */ - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0049-add_user_contacts_table/UserContact.ts b/database/entity/0049-add_user_contacts_table/UserContact.ts deleted file mode 100644 index 54382ec56..000000000 --- a/database/entity/0049-add_user_contacts_table/UserContact.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { User } from './User' - -@Entity('user_contacts', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class UserContact extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'type', - length: 100, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - type: string - - @OneToOne( - () => User, - (user) => user.emailContact, - ) - user: User - - @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) - userId: number - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) - emailVerificationCode: BigInt - - @Column({ name: 'email_opt_in_type_id' }) - emailOptInTypeId: number - - @Column({ name: 'email_resend_count' }) - emailResendCount: number - - // @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - // emailHash: Buffer - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 255, unique: false, nullable: true, collation: 'utf8mb4_unicode_ci' }) - phone: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'updated_at', nullable: true, default: null, type: 'datetime' }) - updatedAt: Date | null - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null -} diff --git a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts b/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts deleted file mode 100644 index 1607e9431..000000000 --- a/database/entity/0050-add_messageId_to_event_protocol/EventProtocol.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('event_protocol') -export class EventProtocol extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ name: 'x_user_id', type: 'int', unsigned: true, nullable: true }) - xUserId: number | null - - @Column({ name: 'x_community_id', type: 'int', unsigned: true, nullable: true }) - xCommunityId: number | null - - @Column({ name: 'transaction_id', type: 'int', unsigned: true, nullable: true }) - transactionId: number | null - - @Column({ name: 'contribution_id', type: 'int', unsigned: true, nullable: true }) - contributionId: number | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - amount: Decimal | null - - @Column({ name: 'message_id', type: 'int', unsigned: true, nullable: true }) - messageId: number | null -} diff --git a/database/entity/0051-add_delete_by_to_contributions/Contribution.ts b/database/entity/0051-add_delete_by_to_contributions/Contribution.ts deleted file mode 100644 index 0ebf1cf1f..000000000 --- a/database/entity/0051-add_delete_by_to_contributions/Contribution.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { ContributionMessage } from '../ContributionMessage' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @DeleteDateColumn({ unsigned: true, nullable: true, name: 'deleted_by' }) - deletedBy: number - - @OneToMany( - () => ContributionMessage, - (message) => message.contribution, - ) - @JoinColumn({ name: 'contribution_id' }) - messages?: ContributionMessage[] -} diff --git a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts b/database/entity/0052-add_updated_at_to_contributions/Contribution.ts deleted file mode 100644 index fa1f6a72c..000000000 --- a/database/entity/0052-add_updated_at_to_contributions/Contribution.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { ContributionMessage } from '../ContributionMessage' -import { Transaction } from '../Transaction' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @Column({ nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @DeleteDateColumn({ unsigned: true, nullable: true, name: 'deleted_by' }) - deletedBy: number - - @OneToMany( - () => ContributionMessage, - (message) => message.contribution, - ) - @JoinColumn({ name: 'contribution_id' }) - messages?: ContributionMessage[] - - @OneToOne( - () => Transaction, - (transaction) => transaction.contribution, - ) - @JoinColumn({ name: 'transaction_id' }) - transaction?: Transaction | null -} diff --git a/database/entity/0053-change_password_encryption/User.ts b/database/entity/0053-change_password_encryption/User.ts deleted file mode 100644 index 18b90a26f..000000000 --- a/database/entity/0053-change_password_encryption/User.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - pubKey: Buffer - - @Column({ name: 'privkey', type: 'binary', length: 80, default: null, nullable: true }) - privKey: Buffer - - @Column({ - type: 'text', - name: 'passphrase', - collation: 'utf8mb4_unicode_ci', - nullable: true, - default: null, - }) - passphrase: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0053-change_password_encryption/UserContact.ts b/database/entity/0053-change_password_encryption/UserContact.ts deleted file mode 100644 index 54382ec56..000000000 --- a/database/entity/0053-change_password_encryption/UserContact.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { User } from './User' - -@Entity('user_contacts', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class UserContact extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'type', - length: 100, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - type: string - - @OneToOne( - () => User, - (user) => user.emailContact, - ) - user: User - - @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) - userId: number - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) - emailVerificationCode: BigInt - - @Column({ name: 'email_opt_in_type_id' }) - emailOptInTypeId: number - - @Column({ name: 'email_resend_count' }) - emailResendCount: number - - // @Column({ name: 'email_hash', type: 'binary', length: 32, default: null, nullable: true }) - // emailHash: Buffer - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 255, unique: false, nullable: true, collation: 'utf8mb4_unicode_ci' }) - phone: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'updated_at', nullable: true, default: null, type: 'datetime' }) - updatedAt: Date | null - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null -} diff --git a/database/entity/0057-clear_old_password_junk/User.ts b/database/entity/0057-clear_old_password_junk/User.ts deleted file mode 100644 index f78beafd4..000000000 --- a/database/entity/0057-clear_old_password_junk/User.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0057-clear_old_password_junk/UserContact.ts b/database/entity/0057-clear_old_password_junk/UserContact.ts deleted file mode 100644 index 2e85e13e5..000000000 --- a/database/entity/0057-clear_old_password_junk/UserContact.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { User } from '../User' - -@Entity('user_contacts', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class UserContact extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'type', - length: 100, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - type: string - - @OneToOne( - () => User, - (user) => user.emailContact, - ) - user: User - - @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) - userId: number - - @Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' }) - email: string - - @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) - emailVerificationCode: string - - @Column({ name: 'email_opt_in_type_id' }) - emailOptInTypeId: number - - @Column({ name: 'email_resend_count' }) - emailResendCount: number - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ length: 255, unique: false, nullable: true, collation: 'utf8mb4_unicode_ci' }) - phone: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @Column({ name: 'updated_at', nullable: true, default: null, type: 'datetime' }) - updatedAt: Date | null - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null -} diff --git a/database/entity/0058-add_communities_table/Community.ts b/database/entity/0058-add_communities_table/Community.ts deleted file mode 100644 index 4deeb6d6d..000000000 --- a/database/entity/0058-add_communities_table/Community.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'public_key', type: 'binary', length: 64, default: null, nullable: true }) - publicKey: Buffer - - @Column({ name: 'api_version', length: 10, nullable: false }) - apiVersion: string - - @Column({ name: 'end_point', length: 255, nullable: false }) - endPoint: string - - @Column({ name: 'last_announced_at', type: 'datetime', nullable: false }) - lastAnnouncedAt: Date - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0059-add_hide_amount_to_users/User.ts b/database/entity/0059-add_hide_amount_to_users/User.ts deleted file mode 100644 index f63c6cf2f..000000000 --- a/database/entity/0059-add_hide_amount_to_users/User.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @Column({ name: 'is_admin', type: 'datetime', nullable: true, default: null }) - isAdmin: Date | null - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0060-update_communities_table/Community.ts b/database/entity/0060-update_communities_table/Community.ts deleted file mode 100644 index 68b1d6ef0..000000000 --- a/database/entity/0060-update_communities_table/Community.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'public_key', type: 'binary', length: 64, default: null, nullable: true }) - publicKey: Buffer - - @Column({ name: 'api_version', length: 10, nullable: false }) - apiVersion: string - - @Column({ name: 'end_point', length: 255, nullable: false }) - endPoint: string - - @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) - lastAnnouncedAt: Date | null - - @Column({ name: 'verified_at', type: 'datetime', nullable: true }) - verifiedAt: Date | null - - @Column({ name: 'last_error_at', type: 'datetime', nullable: true }) - lastErrorAt: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts deleted file mode 100644 index 755a4aca6..000000000 --- a/database/entity/0061-event_refactoring/Event.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { Transaction } from '../Transaction' -import { User } from '../User' - -@Entity('events') -export class Event extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) - affectedUserId: number - - @ManyToOne(() => User) - @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) - affectedUser: User - - @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) - actingUserId: number - - @ManyToOne(() => User) - @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) - actingUser: User - - @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) - involvedUserId: number | null - - @ManyToOne(() => User) - @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) - involvedUser: User | null - - @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) - involvedTransactionId: number | null - - @ManyToOne(() => Transaction) - @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) - involvedTransaction: Transaction | null - - @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) - involvedContributionId: number | null - - @ManyToOne(() => Contribution) - @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) - involvedContribution: Contribution | null - - @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) - involvedContributionMessageId: number | null - - @ManyToOne(() => ContributionMessage) - @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) - involvedContributionMessage: ContributionMessage | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - amount: Decimal | null -} diff --git a/database/entity/0063-event_link_fields/Event.ts b/database/entity/0063-event_link_fields/Event.ts deleted file mode 100644 index ce125b8df..000000000 --- a/database/entity/0063-event_link_fields/Event.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' -import { ContributionLink } from '../ContributionLink' -import { ContributionMessage } from '../ContributionMessage' -import { Transaction } from '../Transaction' -import { TransactionLink } from '../TransactionLink' -import { User } from '../User' - -@Entity('events') -export class Event extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @Column({ name: 'affected_user_id', type: 'bigint', unsigned: true, nullable: false }) - affectedUserId: number - - @ManyToOne(() => User) - @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) - affectedUser: User - - @Column({ name: 'acting_user_id', type: 'bigint', unsigned: true, nullable: false }) - actingUserId: number - - @ManyToOne(() => User) - @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) - actingUser: User - - @Column({ name: 'involved_user_id', type: 'bigint', unsigned: true, nullable: true }) - involvedUserId: number | null - - @ManyToOne(() => User) - @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) - involvedUser: User | null - - @Column({ name: 'involved_transaction_id', type: 'bigint', unsigned: true, nullable: true }) - involvedTransactionId: number | null - - @ManyToOne(() => Transaction) - @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) - involvedTransaction: Transaction | null - - @Column({ name: 'involved_contribution_id', type: 'bigint', unsigned: true, nullable: true }) - involvedContributionId: number | null - - @ManyToOne(() => Contribution) - @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) - involvedContribution: Contribution | null - - @Column({ - name: 'involved_contribution_message_id', - type: 'bigint', - unsigned: true, - nullable: true, - }) - involvedContributionMessageId: number | null - - @ManyToOne(() => ContributionMessage) - @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) - involvedContributionMessage: ContributionMessage | null - - @Column({ name: 'involved_transaction_link_id', type: 'bigint', unsigned: true, nullable: true }) - involvedTransactionLinkId: number | null - - @ManyToOne(() => TransactionLink) - @JoinColumn({ name: 'involved_transaction_link_id', referencedColumnName: 'id' }) - involvedTransactionLink: TransactionLink | null - - @Column({ name: 'involved_contribution_link_id', type: 'bigint', unsigned: true, nullable: true }) - involvedContributionLinkId: number | null - - @ManyToOne(() => ContributionLink) - @JoinColumn({ name: 'involved_contribution_link_id', referencedColumnName: 'id' }) - involvedContributionLink: ContributionLink | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: true, - transformer: DecimalTransformer, - }) - amount: Decimal | null -} diff --git a/database/entity/0065-refactor_communities_table/Community.ts b/database/entity/0065-refactor_communities_table/Community.ts deleted file mode 100644 index 52c8914f0..000000000 --- a/database/entity/0065-refactor_communities_table/Community.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 64, nullable: false }) - publicKey: Buffer - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0065-refactor_communities_table/FederatedCommunity.ts b/database/entity/0065-refactor_communities_table/FederatedCommunity.ts deleted file mode 100644 index 85f9fd038..000000000 --- a/database/entity/0065-refactor_communities_table/FederatedCommunity.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('federated_communities') -export class FederatedCommunity extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'public_key', type: 'binary', length: 64, default: null, nullable: true }) - publicKey: Buffer - - @Column({ name: 'api_version', length: 10, nullable: false }) - apiVersion: string - - @Column({ name: 'end_point', length: 255, nullable: false }) - endPoint: string - - @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) - lastAnnouncedAt: Date | null - - @Column({ name: 'verified_at', type: 'datetime', nullable: true }) - verifiedAt: Date | null - - @Column({ name: 'last_error_at', type: 'datetime', nullable: true }) - lastErrorAt: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts b/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts deleted file mode 100644 index 9c798f7c9..000000000 --- a/database/entity/0066-x-community-sendcoins-transactions_table/Transaction.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* eslint-disable no-use-before-define */ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ - name: 'user_gradido_id', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - userGradidoID: string - - @Column({ - name: 'user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - userName: string | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_user_gradido_id', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserGradidoID: string | null - - @Column({ - name: 'linked_user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserName: string | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @OneToOne( - () => Contribution, - (contribution) => contribution.transaction, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - contribution?: Contribution | null - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'previous' }) - previousTransaction?: Transaction | null -} diff --git a/database/entity/0067-private_key_in_community_table/Community.ts b/database/entity/0067-private_key_in_community_table/Community.ts deleted file mode 100644 index fedf25deb..000000000 --- a/database/entity/0067-private_key_in_community_table/Community.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 64, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0068-community_tables_public_key_length/Community.ts b/database/entity/0068-community_tables_public_key_length/Community.ts deleted file mode 100644 index ececa886f..000000000 --- a/database/entity/0068-community_tables_public_key_length/Community.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0068-community_tables_public_key_length/FederatedCommunity.ts b/database/entity/0068-community_tables_public_key_length/FederatedCommunity.ts deleted file mode 100644 index 97d1b56c0..000000000 --- a/database/entity/0068-community_tables_public_key_length/FederatedCommunity.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' - -@Entity('federated_communities') -export class FederatedCommunity extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - publicKey: Buffer - - @Column({ name: 'api_version', length: 10, nullable: false }) - apiVersion: string - - @Column({ name: 'end_point', length: 255, nullable: false }) - endPoint: string - - @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) - lastAnnouncedAt: Date | null - - @Column({ name: 'verified_at', type: 'datetime', nullable: true }) - verifiedAt: Date | null - - @Column({ name: 'last_error_at', type: 'datetime', nullable: true }) - lastErrorAt: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null -} diff --git a/database/entity/0069-add_user_roles_table/User.ts b/database/entity/0069-add_user_roles_table/User.ts deleted file mode 100644 index 55a0a64a2..000000000 --- a/database/entity/0069-add_user_roles_table/User.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' -import { UserRole } from './UserRole' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @OneToMany( - () => UserRole, - (userRole) => userRole.user, - ) - @JoinColumn({ name: 'user_id' }) - userRoles: UserRole[] - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0069-add_user_roles_table/UserRole.ts b/database/entity/0069-add_user_roles_table/UserRole.ts deleted file mode 100644 index 536248da0..000000000 --- a/database/entity/0069-add_user_roles_table/UserRole.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm' -import { User } from '../User' - -@Entity('user_roles', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class UserRole extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) - userId: number - - @Column({ type: 'varchar', length: 40, nullable: false, collation: 'utf8mb4_unicode_ci' }) - role: string - - @Column({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @Column({ name: 'updated_at', type: 'datetime', nullable: true, default: null }) - updatedAt: Date | null - - @ManyToOne( - () => User, - (user) => user.userRoles, - ) - @JoinColumn({ name: 'user_id' }) - user: User -} diff --git a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts b/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts deleted file mode 100644 index afd9ba9a1..000000000 --- a/database/entity/0070-add_dlt_transactions_table/DltTransaction.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { Transaction } from '../Transaction' - -@Entity('dlt_transactions', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class DltTransaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'transactions_id', type: 'int', unsigned: true, nullable: false }) - transactionId: number - - @Column({ - name: 'message_id', - type: 'varchar', - length: 64, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - messageId: string - - @Column({ name: 'verified', type: 'bool', nullable: false, default: false }) - verified: boolean - - @Column({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @Column({ name: 'verified_at', type: 'datetime', nullable: true, default: null }) - verifiedAt: Date | null - - @OneToOne( - () => Transaction, - (transaction) => transaction.dltTransaction, - ) - @JoinColumn({ name: 'transactions_id' }) - transaction?: Transaction | null -} diff --git a/database/entity/0070-add_dlt_transactions_table/Transaction.ts b/database/entity/0070-add_dlt_transactions_table/Transaction.ts deleted file mode 100644 index 23fcca475..000000000 --- a/database/entity/0070-add_dlt_transactions_table/Transaction.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* eslint-disable no-use-before-define */ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' -import { DltTransaction } from './DltTransaction' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', unsigned: true, nullable: false }) - typeId: number - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @Column({ - name: 'user_gradido_id', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - userGradidoID: string - - @Column({ - name: 'user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - userName: string | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_user_gradido_id', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserGradidoID: string | null - - @Column({ - name: 'linked_user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserName: string | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @OneToOne( - () => Contribution, - (contribution) => contribution.transaction, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - contribution?: Contribution | null - - @OneToOne( - () => DltTransaction, - (dlt) => dlt.transactionId, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - dltTransaction?: DltTransaction | null - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'previous' }) - previousTransaction?: Transaction | null -} diff --git a/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts b/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts deleted file mode 100644 index 7c06b173b..000000000 --- a/database/entity/0071-add-pending_transactions-table/PendingTransaction.ts +++ /dev/null @@ -1,152 +0,0 @@ -/* eslint-disable no-use-before-define */ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' - -@Entity('pending_transactions') -export class PendingTransaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'state', type: 'int', unsigned: true, nullable: false }) - state: number - - @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) - typeId: number - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @Column({ - name: 'user_gradido_id', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - userGradidoID: string - - @Column({ - name: 'user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - userName: string | null - - @Column({ - name: 'user_community_uuid', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - userCommunityUuid: string - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_user_gradido_id', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserGradidoID: string | null - - @Column({ - name: 'linked_user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserName: string | null - - @Column({ - name: 'linked_user_community_uuid', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserCommunityUuid: string - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null -} diff --git a/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts b/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts deleted file mode 100644 index 18450ba21..000000000 --- a/database/entity/0072-add_communityuuid_to_transactions_table/Transaction.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* eslint-disable no-use-before-define */ -import { Decimal } from 'decimal.js-light' -import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { Contribution } from '../Contribution' -import { DltTransaction } from '../DltTransaction' - -@Entity('transactions') -export class Transaction extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) - previous: number | null - - @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) - typeId: number - - @Column({ - name: 'transaction_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - transactionLinkId?: number | null - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - balance: Decimal - - @Column({ - name: 'balance_date', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', - nullable: false, - }) - balanceDate: Date - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - decay: Decimal - - @Column({ - name: 'decay_start', - type: 'datetime', - nullable: true, - default: null, - }) - decayStart: Date | null - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ name: 'creation_date', type: 'datetime', nullable: true, default: null }) - creationDate: Date | null - - @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @Column({ - name: 'user_community_uuid', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - userCommunityUuid: string | null - - @Column({ - name: 'user_gradido_id', - type: 'varchar', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - userGradidoID: string - - @Column({ - name: 'user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - userName: string | null - - @Column({ - name: 'linked_user_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedUserId?: number | null - - @Column({ - name: 'linked_user_community_uuid', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserCommunityUuid: string | null - - @Column({ - name: 'linked_user_gradido_id', - type: 'varchar', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserGradidoID: string | null - - @Column({ - name: 'linked_user_name', - type: 'varchar', - length: 512, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - linkedUserName: string | null - - @Column({ - name: 'linked_transaction_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - linkedTransactionId?: number | null - - @OneToOne( - () => Contribution, - (contribution) => contribution.transaction, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - contribution?: Contribution | null - - @OneToOne( - () => DltTransaction, - (dlt) => dlt.transactionId, - ) - @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) - dltTransaction?: DltTransaction | null - - @OneToOne(() => Transaction) - @JoinColumn({ name: 'previous' }) - previousTransaction?: Transaction | null -} diff --git a/database/entity/0073-introduce_foreign_user_in_users_table/User.ts b/database/entity/0073-introduce_foreign_user_in_users_table/User.ts deleted file mode 100644 index 0cc820c3f..000000000 --- a/database/entity/0073-introduce_foreign_user_in_users_table/User.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' -import { UserRole } from '../UserRole' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bool', default: false }) - foreign: boolean - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @OneToMany( - () => UserRole, - (userRole) => userRole.user, - ) - @JoinColumn({ name: 'user_id' }) - userRoles: UserRole[] - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0075-contribution_message_add_index/ContributionMessage.ts b/database/entity/0075-contribution_message_add_index/ContributionMessage.ts deleted file mode 100644 index 96c90ea24..000000000 --- a/database/entity/0075-contribution_message_add_index/ContributionMessage.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - Index, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { User } from '../User' - -@Entity('contribution_messages', { - engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', -}) -export class ContributionMessage extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Index() - @Column({ name: 'contribution_id', unsigned: true, nullable: false }) - contributionId: number - - @ManyToOne( - () => Contribution, - (contribution) => contribution.messages, - ) - @JoinColumn({ name: 'contribution_id' }) - contribution: Contribution - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @ManyToOne( - () => User, - (user) => user.messages, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) - message: string - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @Column({ name: 'deleted_by', default: null, unsigned: true, nullable: true }) - deletedBy: number - - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) - isModerator: boolean -} diff --git a/database/entity/0076-add_updated_by_contribution/Contribution.ts b/database/entity/0076-add_updated_by_contribution/Contribution.ts deleted file mode 100644 index df96da108..000000000 --- a/database/entity/0076-add_updated_by_contribution/Contribution.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { ContributionMessage } from '../ContributionMessage' -import { Transaction } from '../Transaction' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @Column({ nullable: true, name: 'updated_at' }) - updatedAt: Date - - @Column({ nullable: true, unsigned: true, name: 'updated_by', type: 'int' }) - updatedBy: number | null - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @DeleteDateColumn({ unsigned: true, nullable: true, name: 'deleted_by' }) - deletedBy: number - - @OneToMany( - () => ContributionMessage, - (message) => message.contribution, - ) - @JoinColumn({ name: 'contribution_id' }) - messages?: ContributionMessage[] - - @OneToOne( - () => Transaction, - (transaction) => transaction.contribution, - ) - @JoinColumn({ name: 'transaction_id' }) - transaction?: Transaction | null -} diff --git a/database/entity/0077-add_resubmission_date_contribution_message/ContributionMessage.ts b/database/entity/0077-add_resubmission_date_contribution_message/ContributionMessage.ts deleted file mode 100644 index e88f1d966..000000000 --- a/database/entity/0077-add_resubmission_date_contribution_message/ContributionMessage.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - DeleteDateColumn, - Entity, - Index, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { User } from '../User' - -@Entity('contribution_messages', { - engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', -}) -export class ContributionMessage extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Index() - @Column({ name: 'contribution_id', unsigned: true, nullable: false }) - contributionId: number - - @ManyToOne( - () => Contribution, - (contribution) => contribution.messages, - ) - @JoinColumn({ name: 'contribution_id' }) - contribution: Contribution - - @Column({ name: 'user_id', unsigned: true, nullable: false }) - userId: number - - @ManyToOne( - () => User, - (user) => user.messages, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) - message: string - - @CreateDateColumn() - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @UpdateDateColumn() - @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @Column({ name: 'deleted_by', default: null, unsigned: true, nullable: true }) - deletedBy: number - - @Column({ type: 'datetime', name: 'resubmission_at', default: null, nullable: true }) - resubmissionAt: Date | null - - @Column({ length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) - isModerator: boolean -} diff --git a/database/entity/0078-move_resubmission_date/Contribution.ts b/database/entity/0078-move_resubmission_date/Contribution.ts deleted file mode 100644 index 3e134a653..000000000 --- a/database/entity/0078-move_resubmission_date/Contribution.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Decimal } from 'decimal.js-light' -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -import { ContributionMessage } from '../ContributionMessage' -import { Transaction } from '../Transaction' -import { User } from '../User' - -@Entity('contributions') -export class Contribution extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bigint', unsigned: true, nullable: false, name: 'user_id' }) - userId: number - - @ManyToOne( - () => User, - (user) => user.contributions, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @Column({ type: 'datetime', name: 'resubmission_at', default: null, nullable: true }) - resubmissionAt: Date | null - - @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) - contributionDate: Date - - @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) - memo: string - - @Column({ - type: 'decimal', - precision: 40, - scale: 20, - nullable: false, - transformer: DecimalTransformer, - }) - amount: Decimal - - @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'moderator_id' }) - moderatorId: number - - @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'contribution_link_id' }) - contributionLinkId: number - - @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'confirmed_by' }) - confirmedBy: number - - @Column({ type: 'datetime', nullable: true, name: 'confirmed_at' }) - confirmedAt: Date - - @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'denied_by' }) - deniedBy: number - - @Column({ type: 'datetime', nullable: true, name: 'denied_at' }) - deniedAt: Date - - @Column({ - name: 'contribution_type', - type: 'varchar', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionType: string - - @Column({ - name: 'contribution_status', - type: 'varchar', - length: 12, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - contributionStatus: string - - @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'transaction_id' }) - transactionId: number - - @Column({ type: 'datetime', nullable: true, name: 'updated_at' }) - updatedAt: Date - - @Column({ type: 'bigint', nullable: true, unsigned: true, name: 'updated_by' }) - updatedBy: number | null - - @DeleteDateColumn({ type: 'datetime', name: 'deleted_at' }) - deletedAt: Date | null - - @DeleteDateColumn({ type: 'bigint', unsigned: true, nullable: true, name: 'deleted_by' }) - deletedBy: number - - @OneToMany( - () => ContributionMessage, - (message) => message.contribution, - ) - @JoinColumn({ name: 'contribution_id' }) - messages?: ContributionMessage[] - - @OneToOne( - () => Transaction, - (transaction) => transaction.contribution, - ) - @JoinColumn({ name: 'transaction_id' }) - transaction?: Transaction | null -} diff --git a/database/entity/0078-move_resubmission_date/ContributionMessage.ts b/database/entity/0078-move_resubmission_date/ContributionMessage.ts deleted file mode 100644 index adf60d437..000000000 --- a/database/entity/0078-move_resubmission_date/ContributionMessage.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - DeleteDateColumn, - Entity, - Index, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { Contribution } from '../Contribution' -import { User } from '../User' - -@Entity('contribution_messages', { - engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', -}) -export class ContributionMessage extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Index() - @Column({ name: 'contribution_id', type: 'bigint', unsigned: true, nullable: false }) - contributionId: number - - @ManyToOne( - () => Contribution, - (contribution) => contribution.messages, - ) - @JoinColumn({ name: 'contribution_id' }) - contribution: Contribution - - @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) - userId: number - - @ManyToOne( - () => User, - (user) => user.messages, - ) - @JoinColumn({ name: 'user_id' }) - user: User - - @Column({ type: 'varchar', length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) - message: string - - @CreateDateColumn() - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt: Date - - @UpdateDateColumn() - @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) - updatedAt: Date - - @DeleteDateColumn({ name: 'deleted_at' }) - deletedAt: Date | null - - @Column({ name: 'deleted_by', type: 'bigint', default: null, unsigned: true, nullable: true }) - deletedBy: number - - @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) - type: string - - @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) - isModerator: boolean -} diff --git a/database/entity/0081-user_join_community/Community.ts b/database/entity/0081-user_join_community/Community.ts deleted file mode 100644 index 2627c9ce9..000000000 --- a/database/entity/0081-user_join_community/Community.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { User } from '../User' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null - - @OneToMany( - () => User, - (user) => user.community, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - users: User[] -} diff --git a/database/entity/0081-user_join_community/User.ts b/database/entity/0081-user_join_community/User.ts deleted file mode 100644 index c941124da..000000000 --- a/database/entity/0081-user_join_community/User.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { Community } from '../Community' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' -import { UserRole } from '../UserRole' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bool', default: false }) - foreign: boolean - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string - - @ManyToOne( - () => Community, - (community) => community.users, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - community: Community | null - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @OneToMany( - () => UserRole, - (userRole) => userRole.user, - ) - @JoinColumn({ name: 'user_id' }) - userRoles: UserRole[] - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0082-introduce_gms_registration/Community.ts b/database/entity/0082-introduce_gms_registration/Community.ts deleted file mode 100644 index 282aca3a1..000000000 --- a/database/entity/0082-introduce_gms_registration/Community.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { User } from '../User' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @Column({ name: 'gms_api_key', type: 'varchar', length: 512, nullable: true, default: null }) - gmsApiKey: string | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null - - @OneToMany( - () => User, - (user) => user.community, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - users: User[] -} diff --git a/database/entity/0082-introduce_gms_registration/User.ts b/database/entity/0082-introduce_gms_registration/User.ts deleted file mode 100644 index 16381ae16..000000000 --- a/database/entity/0082-introduce_gms_registration/User.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - Geometry, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { GeometryTransformer } from '../../src/typeorm/GeometryTransformer' -import { Community } from '../Community' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' -import { UserRole } from '../UserRole' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bool', default: false }) - foreign: boolean - - @Column({ - name: 'gradido_id', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string - - @ManyToOne( - () => Community, - (community) => community.users, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - community: Community | null - - @Column({ - name: 'alias', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'gms_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) - gmsPublishName: number - - @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @OneToMany( - () => UserRole, - (userRole) => userRole.user, - ) - @JoinColumn({ name: 'user_id' }) - userRoles: UserRole[] - - @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'int', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', default: 0 }) - publisherId: number - - @Column({ name: 'gms_allowed', type: 'bool', default: true }) - gmsAllowed: boolean - - @Column({ - name: 'location', - type: 'geometry', - default: null, - nullable: true, - transformer: GeometryTransformer, - }) - location: Geometry | null - - @Column({ - name: 'gms_publish_location', - type: 'int', - unsigned: true, - nullable: false, - default: 2, - }) - gmsPublishLocation: number - - @Column({ name: 'gms_registered', type: 'bool', default: false }) - gmsRegistered: boolean - - @Column({ name: 'gms_registered_at', type: 'datetime', default: null, nullable: true }) - gmsRegisteredAt: Date | null - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0082-introduce_gms_registration/UserContact.ts b/database/entity/0082-introduce_gms_registration/UserContact.ts deleted file mode 100644 index eabcf89eb..000000000 --- a/database/entity/0082-introduce_gms_registration/UserContact.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - DeleteDateColumn, - Entity, - OneToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { User } from '../User' - -@Entity('user_contacts', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class UserContact extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ - name: 'type', - type: 'varchar', - length: 100, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - type: string - - @OneToOne( - () => User, - (user) => user.emailContact, - ) - user: User - - @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) - userId: number - - @Column({ - type: 'varchar', - length: 255, - unique: true, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - email: string - - @Column({ name: 'gms_publish_email', type: 'bool', nullable: false, default: false }) - gmsPublishEmail: boolean - - @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) - emailVerificationCode: string - - @Column({ - name: 'email_opt_in_type_id', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - emailOptInTypeId: number - - @Column({ - name: 'email_resend_count', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - emailResendCount: number - - @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) - emailChecked: boolean - - @Column({ - name: 'country_code', - type: 'varchar', - length: 255, - unique: false, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - countryCode: string - - @Column({ - type: 'varchar', - length: 255, - unique: false, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - phone: string - - @Column({ name: 'gms_publish_phone', type: 'int', unsigned: true, nullable: false, default: 0 }) - gmsPublishPhone: number - - @CreateDateColumn({ - name: 'created_at', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - nullable: true, - onUpdate: 'CURRENT_TIMESTAMP(3)', - }) - updatedAt: Date | null - - @DeleteDateColumn({ name: 'deleted_at', nullable: true }) - deletedAt: Date | null -} diff --git a/database/entity/0083-join_community_federated_communities/Community.ts b/database/entity/0083-join_community_federated_communities/Community.ts deleted file mode 100644 index d7d6e927f..000000000 --- a/database/entity/0083-join_community_federated_communities/Community.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { FederatedCommunity } from '../FederatedCommunity' -import { User } from '../User' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @Column({ name: 'gms_api_key', type: 'varchar', length: 512, nullable: true, default: null }) - gmsApiKey: string | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null - - @OneToMany( - () => User, - (user) => user.community, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - users: User[] - - @OneToMany( - () => FederatedCommunity, - (federatedCommunity) => federatedCommunity.community, - ) - @JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' }) - federatedCommunities?: FederatedCommunity[] -} diff --git a/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts b/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts deleted file mode 100644 index b0edfca91..000000000 --- a/database/entity/0083-join_community_federated_communities/FederatedCommunity.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { Community } from '../Community' - -@Entity('federated_communities') -export class FederatedCommunity extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) - publicKey: Buffer - - @Column({ name: 'api_version', type: 'varchar', length: 10, nullable: false }) - apiVersion: string - - @Column({ name: 'end_point', type: 'varchar', length: 255, nullable: false }) - endPoint: string - - @Column({ name: 'last_announced_at', type: 'datetime', nullable: true }) - lastAnnouncedAt: Date | null - - @Column({ name: 'verified_at', type: 'datetime', nullable: true }) - verifiedAt: Date | null - - @Column({ name: 'last_error_at', type: 'datetime', nullable: true }) - lastErrorAt: Date | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null - - @ManyToOne( - () => Community, - (community) => community.federatedCommunities, - ) - @JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' }) - community?: Community -} diff --git a/database/entity/0084-introduce_humhub_registration/User.ts b/database/entity/0084-introduce_humhub_registration/User.ts deleted file mode 100644 index c12a7dcfd..000000000 --- a/database/entity/0084-introduce_humhub_registration/User.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { - BaseEntity, - Column, - DeleteDateColumn, - Entity, - Geometry, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, -} from 'typeorm' -import { GeometryTransformer } from '../../src/typeorm/GeometryTransformer' -import { Community } from '../Community' -import { Contribution } from '../Contribution' -import { ContributionMessage } from '../ContributionMessage' -import { UserContact } from '../UserContact' -import { UserRole } from '../UserRole' - -@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) -export class User extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ type: 'bool', default: false }) - foreign: boolean - - @Column({ - name: 'gradido_id', - type: 'char', - length: 36, - nullable: false, - collation: 'utf8mb4_unicode_ci', - }) - gradidoID: string - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string - - @ManyToOne( - () => Community, - (community) => community.users, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - community: Community | null - - @Column({ - name: 'alias', - type: 'varchar', - length: 20, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - alias: string - - @OneToOne( - () => UserContact, - (emailContact: UserContact) => emailContact.user, - ) - @JoinColumn({ name: 'email_id' }) - emailContact: UserContact - - @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) - emailId: number | null - - @Column({ - name: 'first_name', - type: 'varchar', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - firstName: string - - @Column({ - name: 'last_name', - type: 'varchar', - length: 255, - nullable: true, - default: null, - collation: 'utf8mb4_unicode_ci', - }) - lastName: string - - @Column({ name: 'gms_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) - gmsPublishName: number - - @Column({ name: 'humhub_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) - humhubPublishName: number - - @Column({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @DeleteDateColumn({ name: 'deleted_at', type: 'datetime', nullable: true }) - deletedAt: Date | null - - @Column({ type: 'bigint', default: 0, unsigned: true }) - password: BigInt - - @Column({ - name: 'password_encryption_type', - type: 'int', - unsigned: true, - nullable: false, - default: 0, - }) - passwordEncryptionType: number - - @Column({ - type: 'varchar', - length: 4, - default: 'de', - collation: 'utf8mb4_unicode_ci', - nullable: false, - }) - language: string - - @Column({ type: 'bool', default: false }) - hideAmountGDD: boolean - - @Column({ type: 'bool', default: false }) - hideAmountGDT: boolean - - @OneToMany( - () => UserRole, - (userRole) => userRole.user, - ) - @JoinColumn({ name: 'user_id' }) - userRoles: UserRole[] - - @Column({ name: 'referrer_id', type: 'bigint', unsigned: true, nullable: true, default: null }) - referrerId?: number | null - - @Column({ - name: 'contribution_link_id', - type: 'bigint', - unsigned: true, - nullable: true, - default: null, - }) - contributionLinkId?: number | null - - @Column({ name: 'publisher_id', type: 'bigint', unsigned: true, default: 0 }) - publisherId: number - - @Column({ name: 'gms_allowed', type: 'bool', default: true }) - gmsAllowed: boolean - - @Column({ - name: 'location', - type: 'geometry', - default: null, - nullable: true, - transformer: GeometryTransformer, - }) - location: Geometry | null - - @Column({ - name: 'gms_publish_location', - type: 'int', - unsigned: true, - nullable: false, - default: 2, - }) - gmsPublishLocation: number - - @Column({ name: 'gms_registered', type: 'bool', default: false }) - gmsRegistered: boolean - - @Column({ name: 'gms_registered_at', type: 'datetime', default: null, nullable: true }) - gmsRegisteredAt: Date | null - - @Column({ name: 'humhub_allowed', type: 'bool', default: false }) - humhubAllowed: boolean - - @OneToMany( - () => Contribution, - (contribution) => contribution.user, - ) - @JoinColumn({ name: 'user_id' }) - contributions?: Contribution[] - - @OneToMany( - () => ContributionMessage, - (message) => message.user, - ) - @JoinColumn({ name: 'user_id' }) - messages?: ContributionMessage[] - - @OneToMany( - () => UserContact, - (userContact: UserContact) => userContact.user, - ) - @JoinColumn({ name: 'user_id' }) - userContacts?: UserContact[] -} diff --git a/database/entity/0086-add_community_location/Community.ts b/database/entity/0086-add_community_location/Community.ts deleted file mode 100644 index 8c3a5c229..000000000 --- a/database/entity/0086-add_community_location/Community.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - Geometry, - JoinColumn, - OneToMany, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm' -import { GeometryTransformer } from '../../src/typeorm/GeometryTransformer' -import { FederatedCommunity } from '../FederatedCommunity' -import { User } from '../User' - -@Entity('communities') -export class Community extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) - foreign: boolean - - @Column({ name: 'url', type: 'varchar', length: 255, nullable: false }) - url: string - - @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) - publicKey: Buffer - - @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) - privateKey: Buffer | null - - @Column({ - name: 'community_uuid', - type: 'char', - length: 36, - nullable: true, - collation: 'utf8mb4_unicode_ci', - }) - communityUuid: string | null - - @Column({ name: 'authenticated_at', type: 'datetime', nullable: true }) - authenticatedAt: Date | null - - @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) - name: string | null - - @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) - description: string | null - - @CreateDateColumn({ name: 'creation_date', type: 'datetime', nullable: true }) - creationDate: Date | null - - @Column({ name: 'gms_api_key', type: 'varchar', length: 512, nullable: true, default: null }) - gmsApiKey: string | null - - @Column({ - name: 'location', - type: 'geometry', - default: null, - nullable: true, - transformer: GeometryTransformer, - }) - location: Geometry | null - - @CreateDateColumn({ - name: 'created_at', - type: 'datetime', - default: () => 'CURRENT_TIMESTAMP(3)', - nullable: false, - }) - createdAt: Date - - @UpdateDateColumn({ - name: 'updated_at', - type: 'datetime', - onUpdate: 'CURRENT_TIMESTAMP(3)', - nullable: true, - }) - updatedAt: Date | null - - @OneToMany( - () => User, - (user) => user.community, - ) - @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) - users: User[] - - @OneToMany( - () => FederatedCommunity, - (federatedCommunity) => federatedCommunity.community, - ) - @JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' }) - federatedCommunities?: FederatedCommunity[] -} diff --git a/database/entity/0088-create_project_brandings/ProjectBranding.ts b/database/entity/0088-create_project_brandings/ProjectBranding.ts deleted file mode 100644 index f836f5824..000000000 --- a/database/entity/0088-create_project_brandings/ProjectBranding.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' - -@Entity('project_brandings') -export class ProjectBranding extends BaseEntity { - @PrimaryGeneratedColumn('increment', { unsigned: true }) - id: number - - @Column({ name: 'name', type: 'varchar', length: 255 }) - name: string - - @Column({ name: 'alias', type: 'varchar', length: 32 }) - alias: string - - @Column({ name: 'description', type: 'text', nullable: true, default: null }) - description: string | null - - @Column({ name: 'space_id', type: 'int', unsigned: true, nullable: true, default: null }) - spaceId: number | null - - @Column({ name: 'space_url', type: 'varchar', length: 255, nullable: true, default: null }) - spaceUrl: string | null - - @Column({ name: 'new_user_to_space', type: 'tinyint', width: 1, default: 0 }) - newUserToSpace: boolean - - @Column({ name: 'logo_url', type: 'varchar', length: 255, nullable: true, default: null }) - logoUrl: string | null -} diff --git a/database/entity/0089-add_openai_threads/OpenaiThreads.ts b/database/entity/0089-add_openai_threads/OpenaiThreads.ts deleted file mode 100644 index 38e4b6c33..000000000 --- a/database/entity/0089-add_openai_threads/OpenaiThreads.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm' - -@Entity('openai_threads') -export class OpenaiThreads extends BaseEntity { - @PrimaryColumn({ type: 'char', length: 30 }) - id: string - - @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date - - @Column({ name: 'user_id', type: 'int', unsigned: true }) - userId: number -} diff --git a/database/entity/AdminPendingCreation.ts b/database/entity/AdminPendingCreation.ts deleted file mode 100644 index b2b37d7c4..000000000 --- a/database/entity/AdminPendingCreation.ts +++ /dev/null @@ -1 +0,0 @@ -export { AdminPendingCreation } from './0035-admin_pending_creations_decimal/AdminPendingCreation' diff --git a/database/entity/Community.ts b/database/entity/Community.ts index 9495cc2b6..fde1f0df0 100644 --- a/database/entity/Community.ts +++ b/database/entity/Community.ts @@ -1 +1,97 @@ -export { Community } from './0086-add_community_location/Community' +import { + BaseEntity, + Column, + CreateDateColumn, + Entity, + Geometry, + JoinColumn, + OneToMany, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm' +import { GeometryTransformer } from '../src/typeorm/GeometryTransformer' +import { FederatedCommunity } from './FederatedCommunity' +import { User } from './User' + +@Entity('communities') +export class Community extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) + foreign: boolean + + @Column({ name: 'url', type: 'varchar', length: 255, nullable: false }) + url: string + + @Column({ name: 'public_key', type: 'binary', length: 32, nullable: false }) + publicKey: Buffer + + @Column({ name: 'private_key', type: 'binary', length: 64, nullable: true }) + privateKey: Buffer | null + + @Column({ + name: 'community_uuid', + type: 'char', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + communityUuid: string | null + + @Column({ name: 'authenticated_at', type: 'datetime', precision: 3, nullable: true }) + authenticatedAt: Date | null + + @Column({ name: 'name', type: 'varchar', length: 40, nullable: true }) + name: string | null + + @Column({ name: 'description', type: 'varchar', length: 255, nullable: true }) + description: string | null + + @CreateDateColumn({ name: 'creation_date', type: 'datetime', precision: 3, nullable: true }) + creationDate: Date | null + + @Column({ name: 'gms_api_key', type: 'varchar', length: 512, nullable: true, default: null }) + gmsApiKey: string | null + + @Column({ + name: 'location', + type: 'geometry', + default: null, + nullable: true, + transformer: GeometryTransformer, + }) + location: Geometry | null + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + type: 'datetime', + precision: 3, + onUpdate: 'CURRENT_TIMESTAMP(3)', + nullable: true, + }) + updatedAt: Date | null + + @OneToMany( + () => User, + (user) => user.community, + ) + @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) + users: User[] + + @OneToMany( + () => FederatedCommunity, + (federatedCommunity) => federatedCommunity.community, + ) + @JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' }) + federatedCommunities?: FederatedCommunity[] +} diff --git a/database/entity/Contribution.ts b/database/entity/Contribution.ts index 82715c0c6..c7173a79c 100644 --- a/database/entity/Contribution.ts +++ b/database/entity/Contribution.ts @@ -1 +1,118 @@ -export { Contribution } from './0078-move_resubmission_date/Contribution' +import { Decimal } from 'decimal.js-light' +import { + BaseEntity, + Column, + DeleteDateColumn, + Entity, + JoinColumn, + ManyToOne, + OneToMany, + OneToOne, + PrimaryGeneratedColumn, +} from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' +import { ContributionMessage } from './ContributionMessage' +import { Transaction } from './Transaction' +import { User } from './User' + +@Entity('contributions') +export class Contribution extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'bigint', unsigned: true, nullable: false, name: 'user_id' }) + userId: number + + @ManyToOne( + () => User, + (user) => user.contributions, + ) + @JoinColumn({ name: 'user_id' }) + user: User + + @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) + createdAt: Date + + @Column({ type: 'datetime', name: 'resubmission_at', default: null, nullable: true }) + resubmissionAt: Date | null + + @Column({ type: 'datetime', nullable: false, name: 'contribution_date' }) + contributionDate: Date + + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'moderator_id' }) + moderatorId: number + + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'contribution_link_id' }) + contributionLinkId: number + + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'confirmed_by' }) + confirmedBy: number + + @Column({ type: 'datetime', nullable: true, name: 'confirmed_at' }) + confirmedAt: Date + + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'denied_by' }) + deniedBy: number + + @Column({ type: 'datetime', nullable: true, name: 'denied_at' }) + deniedAt: Date + + @Column({ + name: 'contribution_type', + type: 'varchar', + length: 12, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + contributionType: string + + @Column({ + name: 'contribution_status', + type: 'varchar', + length: 12, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + contributionStatus: string + + @Column({ type: 'bigint', unsigned: true, nullable: true, name: 'transaction_id' }) + transactionId: number + + @Column({ type: 'datetime', nullable: true, name: 'updated_at' }) + updatedAt: Date + + @Column({ type: 'bigint', nullable: true, unsigned: true, name: 'updated_by' }) + updatedBy: number | null + + @DeleteDateColumn({ type: 'datetime', name: 'deleted_at' }) + deletedAt: Date | null + + @DeleteDateColumn({ type: 'bigint', unsigned: true, nullable: true, name: 'deleted_by' }) + deletedBy: number + + @OneToMany( + () => ContributionMessage, + (message) => message.contribution, + ) + @JoinColumn({ name: 'contribution_id' }) + messages?: ContributionMessage[] + + @OneToOne( + () => Transaction, + (transaction) => transaction.contribution, + ) + @JoinColumn({ name: 'transaction_id' }) + transaction?: Transaction | null +} diff --git a/database/entity/ContributionLink.ts b/database/entity/ContributionLink.ts index c7e4e2b7e..8f79f6b85 100644 --- a/database/entity/ContributionLink.ts +++ b/database/entity/ContributionLink.ts @@ -1 +1,88 @@ -export { ContributionLink } from './0038-add_contribution_links_table/ContributionLink' +import { Decimal } from 'decimal.js-light' +import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' + +@Entity('contribution_links') +export class ContributionLink extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) + name: string + + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ name: 'valid_from', type: 'datetime', nullable: false }) + validFrom: Date + + @Column({ name: 'valid_to', type: 'datetime', nullable: true, default: null }) + validTo: Date | null + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) + cycle: string + + @Column({ name: 'max_per_cycle', type: 'int', unsigned: true, nullable: false, default: 1 }) + maxPerCycle: number + + @Column({ + name: 'max_amount_per_month', + type: 'decimal', + precision: 40, + scale: 20, + nullable: true, + default: null, + transformer: DecimalTransformer, + }) + maxAmountPerMonth: Decimal | null + + @Column({ + name: 'total_max_count_of_contribution', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + totalMaxCountOfContribution: number | null + + @Column({ + name: 'max_account_balance', + type: 'decimal', + precision: 40, + scale: 20, + nullable: true, + default: null, + transformer: DecimalTransformer, + }) + maxAccountBalance: Decimal | null + + @Column({ + name: 'min_gap_hours', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + minGapHours: number | null + + @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + createdAt: Date + + @DeleteDateColumn({ name: 'deleted_at', type: 'datetime' }) + deletedAt: Date | null + + @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) + code: string + + @Column({ name: 'link_enabled', type: 'boolean', default: true }) + linkEnabled: boolean +} diff --git a/database/entity/ContributionMessage.ts b/database/entity/ContributionMessage.ts index b4b1180da..1b76243e8 100644 --- a/database/entity/ContributionMessage.ts +++ b/database/entity/ContributionMessage.ts @@ -1 +1,66 @@ -export { ContributionMessage } from './0078-move_resubmission_date/ContributionMessage' +import { + BaseEntity, + Column, + CreateDateColumn, + DeleteDateColumn, + Entity, + Index, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm' +import { Contribution } from './Contribution' +import { User } from './User' + +@Entity('contribution_messages', { + engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci', +}) +export class ContributionMessage extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Index() + @Column({ name: 'contribution_id', type: 'bigint', unsigned: true, nullable: false }) + contributionId: number + + @ManyToOne( + () => Contribution, + (contribution) => contribution.messages, + ) + @JoinColumn({ name: 'contribution_id' }) + contribution: Contribution + + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) + userId: number + + @ManyToOne( + () => User, + (user) => user.messages, + ) + @JoinColumn({ name: 'user_id' }) + user: User + + @Column({ type: 'varchar', length: 2000, nullable: false, collation: 'utf8mb4_unicode_ci' }) + message: string + + @CreateDateColumn() + @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) + createdAt: Date + + @UpdateDateColumn() + @Column({ type: 'datetime', default: null, nullable: true, name: 'updated_at' }) + updatedAt: Date + + @DeleteDateColumn({ name: 'deleted_at' }) + deletedAt: Date | null + + @Column({ name: 'deleted_by', type: 'bigint', default: null, unsigned: true, nullable: true }) + deletedBy: number + + @Column({ type: 'varchar', length: 12, nullable: false, collation: 'utf8mb4_unicode_ci' }) + type: string + + @Column({ name: 'is_moderator', type: 'bool', nullable: false, default: false }) + isModerator: boolean +} diff --git a/database/entity/DltTransaction.ts b/database/entity/DltTransaction.ts index d9c03306c..3a065e505 100644 --- a/database/entity/DltTransaction.ts +++ b/database/entity/DltTransaction.ts @@ -1 +1,43 @@ -export { DltTransaction } from './0070-add_dlt_transactions_table/DltTransaction' +import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' +import { Transaction } from './Transaction' + +@Entity('dlt_transactions', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class DltTransaction extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'transactions_id', type: 'int', unsigned: true, nullable: false }) + transactionId: number + + @Column({ + name: 'message_id', + type: 'varchar', + length: 64, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + messageId: string + + @Column({ name: 'verified', type: 'bool', nullable: false, default: false }) + verified: boolean + + @Column({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @Column({ name: 'verified_at', type: 'datetime', precision: 3, nullable: true, default: null }) + verifiedAt: Date | null + + @OneToOne( + () => Transaction, + (transaction) => transaction.dltTransaction, + ) + @JoinColumn({ name: 'transactions_id' }) + transaction?: Transaction | null +} diff --git a/database/entity/Event.ts b/database/entity/Event.ts index 04cbaf458..868ddaf60 100644 --- a/database/entity/Event.ts +++ b/database/entity/Event.ts @@ -1 +1,105 @@ -export { Event } from './0063-event_link_fields/Event' +import { Decimal } from 'decimal.js-light' +import { + BaseEntity, + Column, + CreateDateColumn, + Entity, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, +} from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' +import { Contribution } from './Contribution' +import { ContributionLink } from './ContributionLink' +import { ContributionMessage } from './ContributionMessage' +import { Transaction } from './Transaction' +import { TransactionLink } from './TransactionLink' +import { User } from './User' + +@Entity('events') +export class Event extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'varchar', length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) + type: string + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @Column({ name: 'affected_user_id', type: 'bigint', unsigned: true, nullable: false }) + affectedUserId: number + + @ManyToOne(() => User) + @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) + affectedUser: User + + @Column({ name: 'acting_user_id', type: 'bigint', unsigned: true, nullable: false }) + actingUserId: number + + @ManyToOne(() => User) + @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) + actingUser: User + + @Column({ name: 'involved_user_id', type: 'bigint', unsigned: true, nullable: true }) + involvedUserId: number | null + + @ManyToOne(() => User) + @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) + involvedUser: User | null + + @Column({ name: 'involved_transaction_id', type: 'bigint', unsigned: true, nullable: true }) + involvedTransactionId: number | null + + @ManyToOne(() => Transaction) + @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) + involvedTransaction: Transaction | null + + @Column({ name: 'involved_contribution_id', type: 'bigint', unsigned: true, nullable: true }) + involvedContributionId: number | null + + @ManyToOne(() => Contribution) + @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) + involvedContribution: Contribution | null + + @Column({ + name: 'involved_contribution_message_id', + type: 'bigint', + unsigned: true, + nullable: true, + }) + involvedContributionMessageId: number | null + + @ManyToOne(() => ContributionMessage) + @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) + involvedContributionMessage: ContributionMessage | null + + @Column({ name: 'involved_transaction_link_id', type: 'bigint', unsigned: true, nullable: true }) + involvedTransactionLinkId: number | null + + @ManyToOne(() => TransactionLink) + @JoinColumn({ name: 'involved_transaction_link_id', referencedColumnName: 'id' }) + involvedTransactionLink: TransactionLink | null + + @Column({ name: 'involved_contribution_link_id', type: 'bigint', unsigned: true, nullable: true }) + involvedContributionLinkId: number | null + + @ManyToOne(() => ContributionLink) + @JoinColumn({ name: 'involved_contribution_link_id', referencedColumnName: 'id' }) + involvedContributionLink: ContributionLink | null + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: true, + transformer: DecimalTransformer, + }) + amount: Decimal | null +} diff --git a/database/entity/FederatedCommunity.ts b/database/entity/FederatedCommunity.ts index 044966080..a6eaee80f 100644 --- a/database/entity/FederatedCommunity.ts +++ b/database/entity/FederatedCommunity.ts @@ -1 +1,63 @@ -export { FederatedCommunity } from './0083-join_community_federated_communities/FederatedCommunity' +import { + BaseEntity, + Column, + CreateDateColumn, + Entity, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm' +import { Community } from './Community' + +@Entity('federated_communities') +export class FederatedCommunity extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) + foreign: boolean + + @Column({ name: 'public_key', type: 'binary', length: 32, default: null, nullable: true }) + publicKey: Buffer + + @Column({ name: 'api_version', type: 'varchar', length: 10, nullable: false }) + apiVersion: string + + @Column({ name: 'end_point', type: 'varchar', length: 255, nullable: false }) + endPoint: string + + @Column({ name: 'last_announced_at', type: 'datetime', precision: 3, nullable: true }) + lastAnnouncedAt: Date | null + + @Column({ name: 'verified_at', type: 'datetime', precision: 3, nullable: true }) + verifiedAt: Date | null + + @Column({ name: 'last_error_at', type: 'datetime', precision: 3, nullable: true }) + lastErrorAt: Date | null + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + type: 'datetime', + precision: 3, + onUpdate: 'CURRENT_TIMESTAMP(3)', + nullable: true, + }) + updatedAt: Date | null + + @ManyToOne( + () => Community, + (community) => community.federatedCommunities, + ) + @JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' }) + community?: Community +} diff --git a/database/entity/LoginElopageBuys.ts b/database/entity/LoginElopageBuys.ts index cb0d212fa..18dbe7961 100644 --- a/database/entity/LoginElopageBuys.ts +++ b/database/entity/LoginElopageBuys.ts @@ -1 +1,54 @@ -export { LoginElopageBuys } from './0021-elopagebuys_fields_nullable/LoginElopageBuys' +import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' + +@Entity('login_elopage_buys') +export class LoginElopageBuys extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'int', width: 11, name: 'elopage_user_id', nullable: true, default: null }) + elopageUserId: number | null + + @Column({ type: 'int', width: 11, name: 'affiliate_program_id', nullable: true, default: null }) + affiliateProgramId: number | null + + @Column({ type: 'int', width: 11, name: 'publisher_id', nullable: true, default: null }) + publisherId: number | null + + @Column({ type: 'int', width: 11, name: 'order_id', nullable: true, default: null }) + orderId: number | null + + @Column({ type: 'int', width: 11, name: 'product_id', nullable: true, default: null }) + productId: number | null + + @Column({ name: 'product_price', type: 'int', nullable: false }) + productPrice: number + + @Column({ + name: 'payer_email', + type: 'varchar', + length: 255, + nullable: false, + charset: 'utf8', + collation: 'utf8_bin', + }) + payerEmail: string + + @Column({ + name: 'publisher_email', + type: 'varchar', + length: 255, + nullable: false, + charset: 'utf8', + collation: 'utf8_bin', + }) + publisherEmail: string + + @Column({ type: 'bool', nullable: false }) + payed: boolean + + @Column({ name: 'success_date', type: 'datetime', nullable: false }) + successDate: Date + + @Column({ type: 'varchar', length: 255, nullable: false }) + event: string +} diff --git a/database/entity/LoginEmailOptIn.ts b/database/entity/LoginEmailOptIn.ts deleted file mode 100644 index fa8717ed3..000000000 --- a/database/entity/LoginEmailOptIn.ts +++ /dev/null @@ -1 +0,0 @@ -export { LoginEmailOptIn } from './0003-login_server_tables/LoginEmailOptIn' diff --git a/database/entity/Migration.ts b/database/entity/Migration.ts index 9f1e743d0..13c848b07 100644 --- a/database/entity/Migration.ts +++ b/database/entity/Migration.ts @@ -1 +1,13 @@ -export { Migration } from './0001-init_db/Migration' +import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' + +@Entity('migrations') +export class Migration extends BaseEntity { + @PrimaryGeneratedColumn() // This is actually not a primary column + version: number + + @Column({ type: 'varchar', length: 256, nullable: true, default: null }) + fileName: string + + @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + date: Date +} diff --git a/database/entity/OpenaiThreads.ts b/database/entity/OpenaiThreads.ts index d0590811f..38e4b6c33 100644 --- a/database/entity/OpenaiThreads.ts +++ b/database/entity/OpenaiThreads.ts @@ -1 +1,13 @@ -export { OpenaiThreads } from './0089-add_openai_threads/OpenaiThreads' +import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm' + +@Entity('openai_threads') +export class OpenaiThreads extends BaseEntity { + @PrimaryColumn({ type: 'char', length: 30 }) + id: string + + @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + createdAt: Date + + @Column({ name: 'user_id', type: 'int', unsigned: true }) + userId: number +} diff --git a/database/entity/PendingTransaction.ts b/database/entity/PendingTransaction.ts index dbd6f0c74..5281e38ff 100644 --- a/database/entity/PendingTransaction.ts +++ b/database/entity/PendingTransaction.ts @@ -1 +1,154 @@ -export { PendingTransaction } from './0071-add-pending_transactions-table/PendingTransaction' +/* eslint-disable no-use-before-define */ +import { Decimal } from 'decimal.js-light' +import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' + +@Entity('pending_transactions') +export class PendingTransaction extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'state', type: 'int', unsigned: true, nullable: false }) + state: number + + @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) + previous: number | null + + @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) + typeId: number + + @Column({ + name: 'transaction_link_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + transactionLinkId?: number | null + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + balance: Decimal + + @Column({ + name: 'balance_date', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + balanceDate: Date + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + decay: Decimal + + @Column({ + name: 'decay_start', + type: 'datetime', + precision: 3, + nullable: true, + default: null, + }) + decayStart: Date | null + + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ name: 'creation_date', type: 'datetime', precision: 3, nullable: true, default: null }) + creationDate: Date | null + + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) + userId: number + + @Column({ + name: 'user_gradido_id', + type: 'varchar', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + userGradidoID: string + + @Column({ + name: 'user_name', + type: 'varchar', + length: 512, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + userName: string | null + + @Column({ + name: 'user_community_uuid', + type: 'varchar', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + userCommunityUuid: string + + @Column({ + name: 'linked_user_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedUserId?: number | null + + @Column({ + name: 'linked_user_gradido_id', + type: 'varchar', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserGradidoID: string | null + + @Column({ + name: 'linked_user_name', + type: 'varchar', + length: 512, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserName: string | null + + @Column({ + name: 'linked_user_community_uuid', + type: 'varchar', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserCommunityUuid: string + + @Column({ + name: 'linked_transaction_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedTransactionId?: number | null +} diff --git a/database/entity/ProjectBranding.ts b/database/entity/ProjectBranding.ts index 0622d00ef..f836f5824 100644 --- a/database/entity/ProjectBranding.ts +++ b/database/entity/ProjectBranding.ts @@ -1 +1,28 @@ -export { ProjectBranding } from './0088-create_project_brandings/ProjectBranding' +import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm' + +@Entity('project_brandings') +export class ProjectBranding extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'name', type: 'varchar', length: 255 }) + name: string + + @Column({ name: 'alias', type: 'varchar', length: 32 }) + alias: string + + @Column({ name: 'description', type: 'text', nullable: true, default: null }) + description: string | null + + @Column({ name: 'space_id', type: 'int', unsigned: true, nullable: true, default: null }) + spaceId: number | null + + @Column({ name: 'space_url', type: 'varchar', length: 255, nullable: true, default: null }) + spaceUrl: string | null + + @Column({ name: 'new_user_to_space', type: 'tinyint', width: 1, default: 0 }) + newUserToSpace: boolean + + @Column({ name: 'logo_url', type: 'varchar', length: 255, nullable: true, default: null }) + logoUrl: string | null +} diff --git a/database/entity/Transaction.ts b/database/entity/Transaction.ts index d1d7075a9..196005ef6 100644 --- a/database/entity/Transaction.ts +++ b/database/entity/Transaction.ts @@ -1 +1,171 @@ -export { Transaction } from './0072-add_communityuuid_to_transactions_table/Transaction' +/* eslint-disable no-use-before-define */ +import { Decimal } from 'decimal.js-light' +import { BaseEntity, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' +import { Contribution } from './Contribution' +import { DltTransaction } from './DltTransaction' + +@Entity('transactions') +export class Transaction extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'int', unsigned: true, unique: true, nullable: true, default: null }) + previous: number | null + + @Column({ name: 'type_id', type: 'int', unsigned: true, nullable: false }) + typeId: number + + @Column({ + name: 'transaction_link_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + transactionLinkId?: number | null + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + balance: Decimal + + @Column({ + name: 'balance_date', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + balanceDate: Date + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + decay: Decimal + + @Column({ + name: 'decay_start', + type: 'datetime', + precision: 3, + nullable: true, + default: null, + }) + decayStart: Date | null + + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ name: 'creation_date', type: 'datetime', precision: 3, nullable: true, default: null }) + creationDate: Date | null + + @Column({ name: 'user_id', type: 'bigint', unsigned: true, nullable: false }) + userId: number + + @Column({ + name: 'user_community_uuid', + type: 'varchar', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + userCommunityUuid: string | null + + @Column({ + name: 'user_gradido_id', + type: 'varchar', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + userGradidoID: string + + @Column({ + name: 'user_name', + type: 'varchar', + length: 512, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + userName: string | null + + @Column({ + name: 'linked_user_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedUserId?: number | null + + @Column({ + name: 'linked_user_community_uuid', + type: 'varchar', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserCommunityUuid: string | null + + @Column({ + name: 'linked_user_gradido_id', + type: 'varchar', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserGradidoID: string | null + + @Column({ + name: 'linked_user_name', + type: 'varchar', + length: 512, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + linkedUserName: string | null + + @Column({ + name: 'linked_transaction_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + linkedTransactionId?: number | null + + @OneToOne( + () => Contribution, + (contribution) => contribution.transaction, + ) + @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) + contribution?: Contribution | null + + @OneToOne( + () => DltTransaction, + (dlt) => dlt.transactionId, + ) + @JoinColumn({ name: 'id', referencedColumnName: 'transactionId' }) + dltTransaction?: DltTransaction | null + + @OneToOne(() => Transaction) + @JoinColumn({ name: 'previous' }) + previousTransaction?: Transaction | null +} diff --git a/database/entity/TransactionLink.ts b/database/entity/TransactionLink.ts index a483f0171..68e8c4b68 100644 --- a/database/entity/TransactionLink.ts +++ b/database/entity/TransactionLink.ts @@ -1 +1,61 @@ -export { TransactionLink } from './0031-remove_sendEmail_from_transaction_link/TransactionLink' +import { Decimal } from 'decimal.js-light' +import { BaseEntity, Column, DeleteDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm' +import { DecimalTransformer } from '../src/typeorm/DecimalTransformer' + +@Entity('transaction_links') +export class TransactionLink extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'bigint', unsigned: true, nullable: false }) + userId: number + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + amount: Decimal + + @Column({ + type: 'decimal', + name: 'hold_available_amount', + precision: 40, + scale: 20, + nullable: false, + transformer: DecimalTransformer, + }) + holdAvailableAmount: Decimal + + @Column({ type: 'varchar', length: 255, nullable: false, collation: 'utf8mb4_unicode_ci' }) + memo: string + + @Column({ type: 'varchar', length: 24, nullable: false, collation: 'utf8mb4_unicode_ci' }) + code: string + + @Column({ + type: 'datetime', + nullable: false, + }) + createdAt: Date + + @DeleteDateColumn() + deletedAt: Date | null + + @Column({ + type: 'datetime', + nullable: false, + }) + validUntil: Date + + @Column({ + type: 'datetime', + nullable: true, + }) + redeemedAt: Date | null + + @Column({ type: 'int', unsigned: true, nullable: true }) + redeemedBy: number | null +} diff --git a/database/entity/User.ts b/database/entity/User.ts index 993d983ef..9ff7d50f8 100644 --- a/database/entity/User.ts +++ b/database/entity/User.ts @@ -1 +1,216 @@ -export { User } from './0084-introduce_humhub_registration/User' +import { + BaseEntity, + Column, + DeleteDateColumn, + Entity, + Geometry, + JoinColumn, + ManyToOne, + OneToMany, + OneToOne, + PrimaryGeneratedColumn, +} from 'typeorm' +import { GeometryTransformer } from '../src/typeorm/GeometryTransformer' +import { Community } from './Community' +import { Contribution } from './Contribution' +import { ContributionMessage } from './ContributionMessage' +import { UserContact } from './UserContact' +import { UserRole } from './UserRole' + +@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class User extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'bool', default: false }) + foreign: boolean + + @Column({ + name: 'gradido_id', + type: 'char', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + gradidoID: string + + @Column({ + name: 'community_uuid', + type: 'char', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + communityUuid: string + + @ManyToOne( + () => Community, + (community) => community.users, + ) + @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) + community: Community | null + + @Column({ + name: 'alias', + type: 'varchar', + length: 20, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + alias: string + + @OneToOne( + () => UserContact, + (emailContact: UserContact) => emailContact.user, + ) + @JoinColumn({ name: 'email_id' }) + emailContact: UserContact + + @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) + emailId: number | null + + @Column({ + name: 'first_name', + type: 'varchar', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + firstName: string + + @Column({ + name: 'last_name', + type: 'varchar', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + lastName: string + + @Column({ name: 'gms_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) + gmsPublishName: number + + @Column({ name: 'humhub_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) + humhubPublishName: number + + @Column({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @DeleteDateColumn({ name: 'deleted_at', type: 'datetime', precision: 3, nullable: true }) + deletedAt: Date | null + + @Column({ type: 'bigint', default: 0, unsigned: true }) + password: BigInt + + @Column({ + name: 'password_encryption_type', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) + passwordEncryptionType: number + + @Column({ + type: 'varchar', + length: 4, + default: 'de', + collation: 'utf8mb4_unicode_ci', + nullable: false, + }) + language: string + + @Column({ type: 'bool', default: false }) + hideAmountGDD: boolean + + @Column({ type: 'bool', default: false }) + hideAmountGDT: boolean + + @OneToMany( + () => UserRole, + (userRole) => userRole.user, + ) + @JoinColumn({ name: 'user_id' }) + userRoles: UserRole[] + + @Column({ name: 'referrer_id', type: 'bigint', unsigned: true, nullable: true, default: null }) + referrerId?: number | null + + @Column({ + name: 'contribution_link_id', + type: 'bigint', + unsigned: true, + nullable: true, + default: null, + }) + contributionLinkId?: number | null + + @Column({ name: 'publisher_id', type: 'bigint', unsigned: true, default: 0 }) + publisherId: number + + @Column({ name: 'gms_allowed', type: 'bool', default: true }) + gmsAllowed: boolean + + @Column({ + name: 'location', + type: 'geometry', + default: null, + nullable: true, + transformer: GeometryTransformer, + }) + location: Geometry | null + + @Column({ + name: 'gms_publish_location', + type: 'int', + unsigned: true, + nullable: false, + default: 2, + }) + gmsPublishLocation: number + + @Column({ name: 'gms_registered', type: 'bool', default: false }) + gmsRegistered: boolean + + @Column({ + name: 'gms_registered_at', + type: 'datetime', + precision: 3, + default: null, + nullable: true, + }) + gmsRegisteredAt: Date | null + + @Column({ name: 'humhub_allowed', type: 'bool', default: false }) + humhubAllowed: boolean + + @OneToMany( + () => Contribution, + (contribution) => contribution.user, + ) + @JoinColumn({ name: 'user_id' }) + contributions?: Contribution[] + + @OneToMany( + () => ContributionMessage, + (message) => message.user, + ) + @JoinColumn({ name: 'user_id' }) + messages?: ContributionMessage[] + + @OneToMany( + () => UserContact, + (userContact: UserContact) => userContact.user, + ) + @JoinColumn({ name: 'user_id' }) + userContacts?: UserContact[] +} diff --git a/database/entity/UserContact.ts b/database/entity/UserContact.ts index e91e9a9d3..6af26ea39 100644 --- a/database/entity/UserContact.ts +++ b/database/entity/UserContact.ts @@ -1 +1,113 @@ -export { UserContact } from './0082-introduce_gms_registration/UserContact' +import { + BaseEntity, + Column, + CreateDateColumn, + DeleteDateColumn, + Entity, + OneToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm' +import { User } from './User' + +@Entity('user_contacts', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class UserContact extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ + name: 'type', + type: 'varchar', + length: 100, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + type: string + + @OneToOne( + () => User, + (user) => user.emailContact, + ) + user: User + + @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) + userId: number + + @Column({ + type: 'varchar', + length: 255, + unique: true, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + email: string + + @Column({ name: 'gms_publish_email', type: 'bool', nullable: false, default: false }) + gmsPublishEmail: boolean + + @Column({ name: 'email_verification_code', type: 'bigint', unsigned: true, unique: true }) + emailVerificationCode: string + + @Column({ + name: 'email_opt_in_type_id', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) + emailOptInTypeId: number + + @Column({ + name: 'email_resend_count', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) + emailResendCount: number + + @Column({ name: 'email_checked', type: 'bool', nullable: false, default: false }) + emailChecked: boolean + + @Column({ + name: 'country_code', + type: 'varchar', + length: 255, + unique: false, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + countryCode: string + + @Column({ + type: 'varchar', + length: 255, + unique: false, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + phone: string + + @Column({ name: 'gms_publish_phone', type: 'int', unsigned: true, nullable: false, default: 0 }) + gmsPublishPhone: number + + @CreateDateColumn({ + name: 'created_at', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + precision: 3, + nullable: true, + onUpdate: 'CURRENT_TIMESTAMP(3)', + }) + updatedAt: Date | null + + @DeleteDateColumn({ name: 'deleted_at', precision: 3, nullable: true }) + deletedAt: Date | null +} diff --git a/database/entity/UserRole.ts b/database/entity/UserRole.ts index 1ef9a08b2..e063fc66e 100644 --- a/database/entity/UserRole.ts +++ b/database/entity/UserRole.ts @@ -1 +1,33 @@ -export { UserRole } from './0069-add_user_roles_table/UserRole' +import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm' +import { User } from './User' + +@Entity('user_roles', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class UserRole extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'user_id', type: 'int', unsigned: true, nullable: false }) + userId: number + + @Column({ type: 'varchar', length: 40, nullable: false, collation: 'utf8mb4_unicode_ci' }) + role: string + + @Column({ + name: 'created_at', + type: 'datetime', + precision: 3, + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @Column({ name: 'updated_at', type: 'datetime', precision: 3, nullable: true, default: null }) + updatedAt: Date | null + + @ManyToOne( + () => User, + (user) => user.userRoles, + ) + @JoinColumn({ name: 'user_id' }) + user: User +} diff --git a/database/entity/index.ts b/database/entity/index.ts index 71329b6ee..b6ecd8f6c 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -7,7 +7,6 @@ import { DltTransaction } from './DltTransaction' import { Event } from './Event' import { FederatedCommunity } from './FederatedCommunity' import { LoginElopageBuys } from './LoginElopageBuys' -import { LoginEmailOptIn } from './LoginEmailOptIn' import { Migration } from './Migration' import { OpenaiThreads } from './OpenaiThreads' import { PendingTransaction } from './PendingTransaction' @@ -27,7 +26,6 @@ export { Event, FederatedCommunity, LoginElopageBuys, - LoginEmailOptIn, Migration, ProjectBranding, OpenaiThreads, @@ -50,7 +48,6 @@ export const entities = [ Event, FederatedCommunity, LoginElopageBuys, - LoginEmailOptIn, Migration, ProjectBranding, OpenaiThreads, diff --git a/database/migrations/0090-drop_unused_tables.ts b/database/migrations/0090-drop_unused_tables.ts new file mode 100644 index 000000000..f44be5f57 --- /dev/null +++ b/database/migrations/0090-drop_unused_tables.ts @@ -0,0 +1,19 @@ +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn(`DROP TABLE login_email_opt_in;`) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn(` + CREATE TABLE IF NOT EXISTS \`login_email_opt_in\` ( + \`id\` int(10) unsigned NOT NULL AUTO_INCREMENT, + \`user_id\` int(11) NOT NULL, + \`verification_code\` bigint(20) unsigned NOT NULL, + \`email_opt_in_type_id\` int(11) NOT NULL, + \`created\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + \`resend_count\` int(11) DEFAULT '0', + \`updated\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (\`id\`), + UNIQUE KEY \`verification_code\` (\`verification_code\`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `) +} diff --git a/database/src/config/detectLastDBVersion.ts b/database/src/config/detectLastDBVersion.ts index 2dd2d9ace..b91ac2949 100644 --- a/database/src/config/detectLastDBVersion.ts +++ b/database/src/config/detectLastDBVersion.ts @@ -1,12 +1,11 @@ -import fs from 'fs' -import path from 'path' +import fs from 'node:fs' +import path from 'node:path' // Define the regular expression pattern once const DB_VERSION_PATTERN = /^(\d{4}-[a-z0-9-_]+)/ // Define the paths to check const migrationsDir = path.join(__dirname, '..', '..', 'migrations') -const entitiesDir = path.join(__dirname, '..', '..', 'entity') // Helper function to get the highest version number from the directory function getLatestDbVersion(dir: string): string { @@ -34,10 +33,6 @@ function getLatestDbVersion(dir: string): string { // Get the latest version from migrations and entities const latestMigrationVersion = getLatestDbVersion(migrationsDir) -const latestEntityVersion = getLatestDbVersion(entitiesDir) // Determine which directory has the latest version and return it -export const latestDbVersion = - latestMigrationVersion && (!latestEntityVersion || latestMigrationVersion > latestEntityVersion) - ? latestMigrationVersion - : latestEntityVersion +export const latestDbVersion = latestMigrationVersion diff --git a/deployment/bare_metal/Dockerfile b/deployment/bare_metal/Dockerfile index c617c4cc3..521dabb6c 100644 --- a/deployment/bare_metal/Dockerfile +++ b/deployment/bare_metal/Dockerfile @@ -24,7 +24,8 @@ RUN apt update && apt install -y \ mariadb-server \ nginx \ gettext \ - curl + curl \ + gcc ##### Install Image ####################################################################### ## Simulate parts from install script to get a minimal configuration to test start script # diff --git a/deployment/bare_metal/install-missing-deps.sh b/deployment/bare_metal/install-missing-deps.sh index c543bd4dc..52c1f7fab 100644 --- a/deployment/bare_metal/install-missing-deps.sh +++ b/deployment/bare_metal/install-missing-deps.sh @@ -39,3 +39,17 @@ then echo "'turbo' is missing, will be installed now!" bun install --global turbo fi + +# rust and grass +if ! command -v cargo &> /dev/null +then + echo "'cargo' is missing, will be installed now!" + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + export CARGO_HOME="$HOME/.cargo" + export PATH="$CARGO_HOME/bin:$PATH" +fi +if ! command -v grass &> /dev/null +then + echo "'grass' is missing, will be installed now!" + cargo install grass +fi diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index a812588ba..62406f7a0 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -2,8 +2,6 @@ # stop if something fails set -euo pipefail -source ./install-missing-deps.sh - # check for parameter FAST_MODE=false POSITIONAL_ARGS=() @@ -44,18 +42,6 @@ PROJECT_ROOT=$SCRIPT_DIR/../.. NGINX_CONFIG_DIR=$SCRIPT_DIR/nginx/sites-available set +o allexport -# enable nvm -export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" -install_nvm() { - nvm install - nvm use - nvm alias default - npm i -g yarn pm2 - pm2 startup -} -# make sure correct node version is installed -nvm use || install_nvm - # NOTE: all config values will be in process.env when starting # the services and will therefore take precedence over the .env @@ -187,6 +173,10 @@ git checkout $BRANCH_NAME git pull export BUILD_COMMIT="$(git rev-parse HEAD)" +# install missing dependencies +log_step "Install missing dependencies (nvm, correct nodejs version, bun, rust, grass)" +source ./deployment/bare_metal/install-missing-deps.sh + # Generate gradido.conf from template # *** 1st prepare for each apiversion the federation conf for nginx from federation-template # *** set FEDERATION_PORT from FEDERATION_COMMUNITY_APIS and create gradido-federation.conf file diff --git a/frontend/README.md b/frontend/README.md index f7c60552c..e53aec1f8 100755 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,6 +1,14 @@ # Vue Gradido Wallet - +## install grass, a faster sass compiler written in rust +First install [rust](https://www.rust-lang.org/) if not already installed. + +Then install grass, it need some time, because it will be compiled. +```bash +cargo install grass +``` +Now with using yarn compile-sass or turbo compile-sass grass will be used. + ## install mit yarn ```bash cd frontend diff --git a/frontend/package.json b/frontend/package.json index 429f14a11..258e00b33 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -18,8 +18,10 @@ "test:watch": "cross-env TZ=UTC vitest", "locales": "scripts/sort.sh", "locales:fix": "scripts/sort.sh --fix", - "compile-scss": "sass --load-path=../node_modules --load-path=src/assets/scss src/assets/scss/gradido.scss src/assets/css/gradido.css", - "watch-scss": "sass --watch --load-path=../node_modules --load-path=src/assets/scss src/assets/scss/gradido.scss src/assets/css/gradido.css" + "compile-scss": "node ./scripts/scss.mjs compile", + "watch-scss": "node ./scripts/scss.mjs watch", + "compile-scss-sass": "node ./scripts/scss.mjs compile sass", + "watch-scss-sass": "node ./scripts/scss.mjs watch sass" }, "dependencies": { "@morev/vue-transitions": "^3.0.2", @@ -77,6 +79,7 @@ "@vitest/coverage-v8": "^2.0.5", "@vue/eslint-config-prettier": "^10.2.0", "@vue/test-utils": "^2.4.6", + "chokidar-cli": "^3.0.0", "concurrently": "^9.1.2", "config-schema": "*", "cross-env": "^7.0.3", @@ -94,6 +97,7 @@ "eslint-webpack-plugin": "^5.0.0", "joi": "^17.13.3", "jsdom": "^25.0.0", + "lightningcss": "^1.30.1", "mock-apollo-client": "^1.2.1", "postcss-html": "^1.8.0", "prettier": "^3.5.3", diff --git a/frontend/scripts/scss.mjs b/frontend/scripts/scss.mjs new file mode 100644 index 000000000..c611f4945 --- /dev/null +++ b/frontend/scripts/scss.mjs @@ -0,0 +1,101 @@ +#!/usr/bin/env node +/* eslint-disable no-console */ + +import { mkdirSync } from 'node:fs' +import { join } from 'node:path' +import { execSync, spawn } from 'node:child_process' +import { watch as _watch } from 'chokidar' + +// Create css directory if it doesn't exist +const cssDir = join('src', 'assets', 'css') +mkdirSync(cssDir, { recursive: true }) + +// Paths configuration +const config = { + src: join('src', 'assets', 'scss', 'gradido.scss'), + dest: join('src', 'assets', 'css', 'gradido.css'), + nodePath: join('..', 'node_modules'), + scssPath: join('src', 'assets', 'scss'), +} + +// Parse command line arguments +const mode = process.argv[2] === 'watch' ? 'watch' : 'compile' +const preferredCompiler = process.argv[3] + +// Determine which compiler to use +// if sass was preferred, use it, else use grass if available +function determineCompiler() { + if (preferredCompiler !== 'sass') { + try { + execSync('grass --version', { stdio: 'ignore' }) + return 'grass' + } catch (e) { + // grass not found, fallback to sass + } + } + return 'sass' +} + +const compiler = determineCompiler() + +function runGrass(compressed = false) { + const commonGrassArgs = [ + '--load-path', + config.nodePath, + '--load-path', + config.scssPath, + config.src, + config.dest, + ] + if (compressed) { + commonGrassArgs.unshift('-s', 'compressed') + } + try { + execSync(`grass ${commonGrassArgs.join(' ')}`) + console.log('SCSS compiled successfully') + } catch (error) { + console.error('Error compiling SCSS:', error.message) + } +} + +// Compile SCSS function +function compileScss(mode, compiler) { + if (compiler === 'grass') { + console.log(`Use Grass for ${mode} SCSS`) + if (mode === 'watch') { + const watcher = _watch(config.scssPath) + watcher.on('change', () => runGrass(false)) + } else { + runGrass(true) + } + } else { + console.log(`Use Sass for ${mode} SCSS`) + const commonSassArgs = [ + '--silence-deprecation=import', + '--silence-deprecation=global-builtin', + '--silence-deprecation=color-functions', + `--load-path=${config.nodePath}`, + `--load-path=${config.scssPath}`, + `${config.src}:${config.dest}`, + ] + if (mode === 'watch') { + // for process running in background + // we could also use chokidar but sass --watch is better, because it can trigger partly recompiling + const sassProcess = spawn('sass', ['--watch', ...commonSassArgs], { stdio: 'inherit' }) + sassProcess.on('error', (error) => { + console.error('Error starting sass process:', error) + }) + } else { + try { + // for one time running process + execSync(`sass --style=compressed ${commonSassArgs.join(' ')}`) + console.log('SCSS compiled successfully') + } catch (error) { + console.error('Error compiling SCSS:', error.message) + } + } + } +} + +// Run the compiler +compileScss(mode, compiler) diff --git a/frontend/src/components/Template/ContentHeader/NavCommunity.vue b/frontend/src/components/Contributions/NavContributions.vue similarity index 56% rename from frontend/src/components/Template/ContentHeader/NavCommunity.vue rename to frontend/src/components/Contributions/NavContributions.vue index d2c706cf6..3f119897c 100644 --- a/frontend/src/components/Template/ContentHeader/NavCommunity.vue +++ b/frontend/src/components/Contributions/NavContributions.vue @@ -1,34 +1,34 @@