Merge branch 'develop' into docs/cherrypickHistory

This commit is contained in:
David Mehren 2021-01-10 17:52:49 +01:00 committed by GitHub
commit ffce2de2db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
107 changed files with 2051 additions and 2365 deletions

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) # SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
# #
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0

View file

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) /* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: CC0-1.0 * SPDX-License-Identifier: CC0-1.0
*/ */
@ -8,9 +8,9 @@ module.exports = {
project: 'tsconfig.json', project: 'tsconfig.json',
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['@typescript-eslint/eslint-plugin'], plugins: ['@typescript-eslint'],
extends: [ extends: [
'plugin:@typescript-eslint/eslint-recommended', 'eslint:recommended',
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'prettier', 'prettier',
'prettier/@typescript-eslint', 'prettier/@typescript-eslint',
@ -24,7 +24,10 @@ module.exports = {
'@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { "argsIgnorePattern": "^_+$" }], '@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_+$' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
}, },
}; };

116
.github/workflows/nest.js.yml vendored Normal file
View file

@ -0,0 +1,116 @@
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: AGPL-3.0-only
name: Nest.JS CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
command:
- yarn run lint
- yarn run format:check
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: ${{matrix.command}}
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: yarn run build
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: yarn run test:cov
- uses: codecov/codecov-action@v1
with:
directory: coverage
flags: integration-tests
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile --prefer-offline
- run: yarn run test:e2e:cov
- uses: codecov/codecov-action@v1
with:
directory: coverage-e2e
flags: e2e-tests

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) # SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
# #
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
@ -6,9 +6,9 @@ name: REUSE Compliance Check
on: on:
push: push:
branches: [main] branches: [develop]
pull_request: pull_request:
branches: [main] branches: [develop]
jobs: jobs:
reuse: reuse:

4
.gitignore vendored
View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) # SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
# #
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
@ -35,7 +35,9 @@ dist
# Tests # Tests
/coverage /coverage
/coverage-e2e
/.nyc_output /.nyc_output
public/uploads/* public/uploads/*
!public/uploads/.gitkeep !public/uploads/.gitkeep
uploads

View file

@ -1,6 +1,6 @@
<component name="CopyrightManager"> <component name="CopyrightManager">
<copyright> <copyright>
<option name="notice" value="SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)&#10;&#10;&#83;PDX-License-Identifier: AGPL-3.0-only" /> <option name="notice" value="SPDX-FileCopyrightText: $today.year The HedgeDoc developers (see AUTHORS file)&#10;&#10;&#83;PDX-License-Identifier: AGPL-3.0-only" />
<option name="myName" value="hedgedoc" /> <option name="myName" value="hedgedoc" />
</copyright> </copyright>
</component> </component>

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -4,49 +4,53 @@ Upstream-Contact: The HedgeDoc developers <license@hedgedoc.org>
Source: https://github.com/hedgedoc/hedgedoc Source: https://github.com/hedgedoc/hedgedoc
Files: .idea/** Files: .idea/**
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC0-1.0 License: CC0-1.0
Files: .github/ISSUE_TEMPLATE/*.md Files: .github/ISSUE_TEMPLATE/*.md
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: .github/pull_request_template.md Files: .github/pull_request_template.md
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: docs/**/*.md Files: docs/**/*.md
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: docs/mkdocs.yml Files: docs/mkdocs.yml
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC0-1.0 License: CC0-1.0
Files: docs/requirements.txt Files: docs/requirements.txt
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC0-1.0 License: CC0-1.0
Files: docs/**/*.png Files: docs/**/*.png
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: docs/content/dev/db-schema.plantuml Files: docs/content/dev/db-schema.plantuml
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: docs/content/dev/*api.yml Files: docs/content/dev/*api.yml
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0
Files: docs/content/images/logo.svg Files: docs/content/images/logo.svg
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: LicenseRef-HedgeDoc-Icon-Usgae-Guidelines License: LicenseRef-HedgeDoc-Icon-Usgae-Guidelines
Files: docs/content/images/hedgedoc_logo_horizontal.svg Files: docs/content/images/hedgedoc_logo_horizontal.svg
Copyright: 2020 The HedgeDoc developers (see AUTHORS file) Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
License: LicenseRef-HedgeDoc-Icon-Usgae-Guidelines License: LicenseRef-HedgeDoc-Icon-Usgae-Guidelines
Files: docs/content/legal/developer-certificate-of-origin.txt Files: docs/content/legal/developer-certificate-of-origin.txt
Copyright: 2004, 2006 The Linux Foundation and its contributors. Copyright: 2004, 2006 The Linux Foundation and its contributors.
License: LicenseRef-DCO License: LicenseRef-DCO
Files: docs/content/theme/styles/Roboto/*
Copyright: 2011 Christian Robertson
License: Apache-2.0

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->

201
LICENSES/Apache-2.0.txt Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->
@ -11,6 +11,9 @@ HedgeDoc 2
[![version][github-version-badge]][github-release-page] [![version][github-version-badge]][github-release-page]
[![POEditor][poeditor-image]][poeditor-url] [![POEditor][poeditor-image]][poeditor-url]
[![Mastodon][social-mastodon-image]][social-mastodon] [![Mastodon][social-mastodon-image]][social-mastodon]
![REUSE Compliance Check][reuse-workflow-badge]
![Nest.JS CI][nestjs-workflow-badge]
[![codecov][codecov-badge]][codecov-url]
HedgeDoc lets you create real-time collaborative markdown notes. Have a look at [our website](https://hedgedoc.org) for HedgeDoc lets you create real-time collaborative markdown notes. Have a look at [our website](https://hedgedoc.org) for
more details. more details.
@ -60,9 +63,23 @@ the [github repository](https://github.com/hedgedoc/hedgedoc-logo).
[poeditor-image]: https://img.shields.io/badge/POEditor-translate-blue.svg [poeditor-image]: https://img.shields.io/badge/POEditor-translate-blue.svg
[poeditor-url]: https://poeditor.com/join/project/1OpGjF2Jir [poeditor-url]: https://poeditor.com/join/project/1OpGjF2Jir
[hedgedoc-demo]: https://demo.hedgedoc.org [hedgedoc-demo]: https://demo.hedgedoc.org
[hedgedoc-demo-features]: https://demo.hedgedoc.org/features [hedgedoc-demo-features]: https://demo.hedgedoc.org/features
[hedgedoc-community]: https://community.hedgedoc.org [hedgedoc-community]: https://community.hedgedoc.org
[hedgedoc-community-calls]: https://community.hedgedoc.org/t/codimd-community-call/19 [hedgedoc-community-calls]: https://community.hedgedoc.org/t/codimd-community-call/19
[social-mastodon]: https://social.hedgedoc.org/mastodon [social-mastodon]: https://social.hedgedoc.org/mastodon
[social-mastodon-image]: https://img.shields.io/mastodon/follow/49593?domain=https%3A%2F%2Fsocial.snopyta.org&style=social [social-mastodon-image]: https://img.shields.io/mastodon/follow/49593?domain=https%3A%2F%2Fsocial.snopyta.org&style=social
[reuse-workflow-badge]: https://github.com/hedgedoc/hedgedoc/workflows/REUSE%20Compliance%20Check/badge.svg
[nestjs-workflow-badge]: https://github.com/hedgedoc/hedgedoc/workflows/Nest.JS%20CI/badge.svg
[codecov-badge]: https://codecov.io/gh/hedgedoc/hedgedoc/branch/develop/graph/badge.svg?token=pdaRF4qjNQ
[codecov-url]: https://codecov.io/gh/hedgedoc/hedgedoc

View file

@ -1,5 +1,5 @@
<!-- <!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0 SPDX-License-Identifier: CC-BY-SA-4.0
--> -->

View file

@ -1,24 +0,0 @@
#!/bin/bash
set -e
cat << EOF > .sequelizerc
var path = require('path');
module.exports = {
'config': path.resolve('config.json'),
'migrations-path': path.resolve('lib', 'migrations'),
'models-path': path.resolve('lib', 'models'),
'url': process.env.DATABASE_URL
}
EOF
cat << EOF > config.json
{
"production": {
}
}
EOF

View file

@ -1,119 +0,0 @@
#!/usr/bin/env node
// First configure the logger so it does not spam the console
const logger = require("../lib/logger");
logger.transports.forEach((transport) => transport.level = "warning")
const models = require("../lib/models/");
const readline = require("readline-sync");
const minimist = require("minimist");
function showUsage(tips) {
console.log(`${tips}
Command-line utility to create users for email-signin.
Usage: bin/manage_users [--pass password] (--add | --del) user-email
Options:
--add Add user with the specified user-email
--del Delete user with specified user-email
--reset Reset user password with specified user-email
--pass Use password from cmdline rather than prompting
`);
process.exit(1);
}
function getPass(argv, action) {
// Find whether we use cmdline or prompt password
if(typeof argv["pass"] !== 'string') {
return readline.question(`Password for ${argv[action]}:`, {hideEchoBack: true});
}
console.log("Using password from commandline...");
return argv["pass"];
}
// Using an async function to be able to use await inside
async function createUser(argv) {
const existing_user = await models.User.findOne({where: {email: argv["add"]}});
// Cannot create already-existing users
if(existing_user) {
console.log(`User with e-mail ${existing_user.email} already exists! Aborting ...`);
process.exit(2);
}
const pass = getPass(argv, "add");
// Lets try to create, and check success
const ref = await models.User.create({email: argv["add"], password: pass});
if(ref == undefined) {
console.log(`Could not create user with email ${argv["add"]}`);
process.exit(1);
} else
console.log(`Created user with email ${argv["add"]}`);
}
// Using an async function to be able to use await inside
async function deleteUser(argv) {
// Cannot delete non-existing users
const existing_user = await models.User.findOne({where: {email: argv["del"]}});
if(!existing_user) {
console.log(`User with e-mail ${argv["del"]} does not exist, cannot delete`);
process.exit(1);
}
// Sadly .destroy() does not return any success value with all
// backends. See sequelize #4124
await existing_user.destroy();
console.log(`Deleted user ${argv["del"]} ...`);
}
// Using an async function to be able to use await inside
async function resetUser(argv) {
const existing_user = await models.User.findOne({where: {email: argv["reset"]}});
// Cannot reset non-existing users
if(!existing_user) {
console.log(`User with e-mail ${argv["reset"]} does not exist, cannot reset`);
process.exit(1);
}
const pass = getPass(argv, "reset");
// set password and save
existing_user.password = pass;
await existing_user.save();
console.log(`User with email ${argv["reset"]} password has been reset`);
}
const options = {
add: createUser,
del: deleteUser,
reset: resetUser,
};
// Perform commandline-parsing
const argv = minimist(process.argv.slice(2));
const keys = Object.keys(options);
const opts = keys.filter((key) => argv[key] !== undefined);
const action = opts[0];
// Check for options missing
if (opts.length === 0) {
showUsage(`You did not specify either ${keys.map((key) => `--${key}`).join(' or ')}!`);
}
// Check if both are specified
if (opts.length > 1) {
showUsage(`You cannot ${action.join(' and ')} at the same time!`);
}
// Check if not string
if (typeof argv[action] !== 'string') {
showUsage(`You must follow an email after --${action}`);
}
// Call respective processing functions
options[action](argv).then(function() {
process.exit(0);
});

View file

@ -1,47 +0,0 @@
#!/bin/bash
set -e
# run command at repo root
CURRENT_PATH=$PWD
if [ -d .git ]; then
cd "$(git rev-parse --show-toplevel)"
fi
if ! type yarn > /dev/null
then
cat << EOF
yarn is not installed, please install Node.js, npm and yarn.
Read more on Node.js official website: https://nodejs.org
And for yarn package manager at: https://yarnpkg.com/en/
Setup will not be run
EOF
exit 0
fi
echo "copy config files"
if [ ! -f config.json ]; then
cp config.json.example config.json
fi
if [ ! -f .sequelizerc ]; then
cp .sequelizerc.example .sequelizerc
fi
echo "install packages"
yarn install --pure-lockfile
yarn install --production=false --pure-lockfile
cat << EOF
Edit the following config file to setup CodiMD server and client.
Read more info at https://github.com/codimd/server#configuration-files
* config.json -- CodiMD config
* .sequelizerc -- db config
EOF
# change directory back
cd "$CURRENT_PATH"

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -18,3 +18,6 @@
--md-accent-bg-color: hsla(0, 0%, 100%, 1); --md-accent-bg-color: hsla(0, 0%, 100%, 1);
--md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7); --md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7);
} }
.md-grid {
max-width: 1440px;
}

View file

@ -0,0 +1,33 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
body, input {
font-family: "Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;
}
code, kbd, pre {
font-family: "Roboto Mono",SFMono-Regular,Consolas,Menlo,monospace;
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: local('Roboto'),
url('./Roboto/roboto-latin-regular.woff2') format('woff2'),
url('./Roboto/roboto-latin-regular.woff') format('woff'),
}
@font-face {
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: local('Roboto Mono'),
url('./Roboto/roboto-mono-latin-regular.woff2') format('woff2'),
url('./Roboto/roboto-mono-latin-regular.woff') format('woff'),
}

View file

@ -4,6 +4,7 @@ repo_url: https://github.com/hedgedoc/hedgedoc
site_description: 'HedgeDoc Documentation' site_description: 'HedgeDoc Documentation'
site_author: 'HedgeDoc Developers' site_author: 'HedgeDoc Developers'
docs_dir: content docs_dir: content
edit_uri: https://github.com/hedgedoc/hedgedoc/edit/master/docs/content/
nav: nav:
- Home: index.md - Home: index.md
- Installation: - Installation:
@ -56,6 +57,8 @@ theme:
- navigation.tabs - navigation.tabs
- navigation.sections - navigation.sections
- toc.integrate - toc.integrate
font: false
extra_css: extra_css:
- theme/styles/hedgedoc-color.css - theme/styles/hedgedoc-custom.css
- theme/styles/roboto.css

View file

@ -12,5 +12,7 @@
"transform": { "transform": {
"^.+\\.(t|j)s$": "ts-jest" "^.+\\.(t|j)s$": "ts-jest"
}, },
"coverageDirectory": "./coverage-e2e" "coverageDirectory": "./coverage-e2e",
"testTimeout": 10000,
"maxConcurrency": 1
} }

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -9,6 +9,7 @@
"prebuild": "rimraf dist", "prebuild": "rimraf dist",
"build": "nest build", "build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start", "start": "nest start",
"start:dev": "nest start --watch", "start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch", "start:debug": "nest start --debug --watch",
@ -19,48 +20,50 @@
"test:watch": "jest --watch", "test:watch": "jest --watch",
"test:cov": "jest --coverage", "test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config jest-e2e.json" "test:e2e": "jest --config jest-e2e.json",
"test:e2e:cov": "jest --config jest-e2e.json --coverage"
}, },
"dependencies": { "dependencies": {
"@nestjs/common": "7.4.4", "@nestjs/common": "7.6.5",
"@nestjs/core": "7.4.4", "@nestjs/core": "7.6.5",
"@nestjs/platform-express": "7.4.4", "@nestjs/platform-express": "7.6.5",
"@nestjs/swagger": "4.6.1", "@nestjs/swagger": "4.7.9",
"@nestjs/typeorm": "7.1.4", "@nestjs/typeorm": "7.1.5",
"class-transformer": "^0.2.3", "class-transformer": "0.3.1",
"class-validator": "0.12.2", "class-validator": "0.12.2",
"cli-color": "2.0.0",
"connect-typeorm": "1.1.4", "connect-typeorm": "1.1.4",
"file-type": "15.0.1", "file-type": "16.1.0",
"raw-body": "2.4.1", "raw-body": "2.4.1",
"reflect-metadata": "0.1.13", "reflect-metadata": "0.1.13",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rxjs": "6.6.3", "rxjs": "6.6.3",
"shortid": "2.2.16", "shortid": "2.2.16",
"sqlite3": "5.0.0", "sqlite3": "5.0.1",
"swagger-ui-express": "4.1.4", "swagger-ui-express": "4.1.6",
"typeorm": "0.2.28" "typeorm": "0.2.29"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "7.5.1", "@nestjs/cli": "7.5.4",
"@nestjs/schematics": "7.1.2", "@nestjs/schematics": "7.2.6",
"@nestjs/testing": "7.4.4", "@nestjs/testing": "7.6.5",
"@types/express": "4.17.8", "@types/express": "4.17.9",
"@types/jest": "25.2.3", "@types/jest": "26.0.20",
"@types/node": "13.13.28", "@types/node": "13.13.39",
"@types/supertest": "2.0.10", "@types/supertest": "2.0.10",
"@typescript-eslint/eslint-plugin": "3.0.2", "@typescript-eslint/eslint-plugin": "4.12.0",
"@typescript-eslint/parser": "3.0.2", "@typescript-eslint/parser": "4.12.0",
"eslint": "7.1.0", "eslint": "7.17.0",
"eslint-config-prettier": "6.14.0", "eslint-config-prettier": "7.1.0",
"eslint-plugin-import": "2.22.1", "eslint-plugin-import": "2.22.1",
"jest": "26.0.1", "jest": "26.6.3",
"prettier": "1.19.1", "prettier": "2.2.1",
"supertest": "4.0.2", "supertest": "6.0.1",
"ts-jest": "26.1.0", "ts-jest": "26.4.4",
"ts-loader": "6.2.2", "ts-loader": "8.0.14",
"ts-node": "8.10.2", "ts-node": "9.1.1",
"tsconfig-paths": "3.9.0", "tsconfig-paths": "3.9.0",
"typescript": "3.9.7" "typescript": "4.1.3"
}, },
"jest": { "jest": {
"moduleFileExtensions": [ "moduleFileExtensions": [

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only SPDX-License-Identifier: AGPL-3.0-only

View file

@ -5,11 +5,21 @@
"group:socketio", "group:socketio",
"group:linters", "group:linters",
"group:test", "group:test",
"group:nextjsMonorepo", ":gitSignOff",
":disableMajorUpdates", ":prHourlyLimitNone",
":gitSignOff" ":dependencyDashboard",
":rebaseStalePrs",
":maintainLockFilesWeekly"
], ],
"labels": [ "labels": [
"type: maintenance" "type: maintenance"
],
"packageRules": [
{
"groupName": "NestJS packages",
"packagePatterns": [
"^@nestjs/"
]
}
] ]
} }

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -10,12 +10,13 @@ import {
Delete, Delete,
Get, Get,
Header, Header,
NotFoundException,
Param, Param,
Post, Post,
Put, Put,
} from '@nestjs/common'; } from '@nestjs/common';
import { NotInDBError } from '../../../errors/errors';
import { ConsoleLoggerService } from '../../../logger/console-logger.service'; import { ConsoleLoggerService } from '../../../logger/console-logger.service';
import { NoteMetadataUpdateDto } from '../../../notes/note-metadata.dto';
import { NotePermissionsUpdateDto } from '../../../notes/note-permissions.dto'; import { NotePermissionsUpdateDto } from '../../../notes/note-permissions.dto';
import { NotesService } from '../../../notes/notes.service'; import { NotesService } from '../../../notes/notes.service';
import { RevisionsService } from '../../../revisions/revisions.service'; import { RevisionsService } from '../../../revisions/revisions.service';
@ -38,8 +39,15 @@ export class NotesController {
} }
@Get(':noteIdOrAlias') @Get(':noteIdOrAlias')
getNote(@Param('noteIdOrAlias') noteIdOrAlias: string) { async getNote(@Param('noteIdOrAlias') noteIdOrAlias: string) {
return this.noteService.getNoteDtoByIdOrAlias(noteIdOrAlias); try {
return await this.noteService.getNoteDtoByIdOrAlias(noteIdOrAlias);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Post(':noteAlias') @Post(':noteAlias')
@ -54,7 +62,14 @@ export class NotesController {
@Delete(':noteIdOrAlias') @Delete(':noteIdOrAlias')
async deleteNote(@Param('noteIdOrAlias') noteIdOrAlias: string) { async deleteNote(@Param('noteIdOrAlias') noteIdOrAlias: string) {
this.logger.debug('Deleting note: ' + noteIdOrAlias); this.logger.debug('Deleting note: ' + noteIdOrAlias);
try {
await this.noteService.deleteNoteByIdOrAlias(noteIdOrAlias); await this.noteService.deleteNoteByIdOrAlias(noteIdOrAlias);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
this.logger.debug('Successfully deleted ' + noteIdOrAlias); this.logger.debug('Successfully deleted ' + noteIdOrAlias);
return; return;
} }
@ -65,38 +80,88 @@ export class NotesController {
@MarkdownBody() text: string, @MarkdownBody() text: string,
) { ) {
this.logger.debug('Got raw markdown:\n' + text); this.logger.debug('Got raw markdown:\n' + text);
return this.noteService.updateNoteByIdOrAlias(noteIdOrAlias, text); try {
return await this.noteService.updateNoteByIdOrAlias(noteIdOrAlias, text);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Get(':noteIdOrAlias/content') @Get(':noteIdOrAlias/content')
@Header('content-type', 'text/markdown') @Header('content-type', 'text/markdown')
getNoteContent(@Param('noteIdOrAlias') noteIdOrAlias: string) { async getNoteContent(@Param('noteIdOrAlias') noteIdOrAlias: string) {
return this.noteService.getNoteContent(noteIdOrAlias); try {
return await this.noteService.getNoteContent(noteIdOrAlias);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Get(':noteIdOrAlias/metadata') @Get(':noteIdOrAlias/metadata')
getNoteMetadata(@Param('noteIdOrAlias') noteIdOrAlias: string) { async getNoteMetadata(@Param('noteIdOrAlias') noteIdOrAlias: string) {
return this.noteService.getNoteMetadata(noteIdOrAlias); try {
return await this.noteService.getNoteMetadata(noteIdOrAlias);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Put(':noteIdOrAlias/permissions') @Put(':noteIdOrAlias/permissions')
updateNotePermissions( async updateNotePermissions(
@Param('noteIdOrAlias') noteIdOrAlias: string, @Param('noteIdOrAlias') noteIdOrAlias: string,
@Body() updateDto: NotePermissionsUpdateDto, @Body() updateDto: NotePermissionsUpdateDto,
) { ) {
return this.noteService.updateNotePermissions(noteIdOrAlias, updateDto); try {
return await this.noteService.updateNotePermissions(
noteIdOrAlias,
updateDto,
);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Get(':noteIdOrAlias/revisions') @Get(':noteIdOrAlias/revisions')
getNoteRevisions(@Param('noteIdOrAlias') noteIdOrAlias: string) { async getNoteRevisions(@Param('noteIdOrAlias') noteIdOrAlias: string) {
return this.revisionsService.getNoteRevisionMetadatas(noteIdOrAlias); try {
return await this.revisionsService.getNoteRevisionMetadatas(
noteIdOrAlias,
);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
@Get(':noteIdOrAlias/revisions/:revisionId') @Get(':noteIdOrAlias/revisions/:revisionId')
getNoteRevision( async getNoteRevision(
@Param('noteIdOrAlias') noteIdOrAlias: string, @Param('noteIdOrAlias') noteIdOrAlias: string,
@Param('revisionId') revisionId: number, @Param('revisionId') revisionId: number,
) { ) {
return this.revisionsService.getNoteRevision(noteIdOrAlias, revisionId); try {
return await this.revisionsService.getNoteRevision(
noteIdOrAlias,
revisionId,
);
} catch (e) {
if (e instanceof NotInDBError) {
throw new NotFoundException(e.message);
}
throw e;
}
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -17,7 +17,8 @@ import * as getRawBody from 'raw-body';
* *
* Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs * Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs
*/ */
export const MarkdownBody = createParamDecorator(async (_, context: ExecutionContext) => { export const MarkdownBody = createParamDecorator(
async (_, context: ExecutionContext) => {
// we have to check req.readable because of raw-body issue #57 // we have to check req.readable because of raw-body issue #57
// https://github.com/stream-utils/raw-body/issues/57 // https://github.com/stream-utils/raw-body/issues/57
const req = context.switchToHttp().getRequest<import('express').Request>(); const req = context.switchToHttp().getRequest<import('express').Request>();
@ -31,7 +32,9 @@ export const MarkdownBody = createParamDecorator(async (_, context: ExecutionCon
throw new InternalServerErrorException('Failed to parse request body!'); throw new InternalServerErrorException('Failed to parse request body!');
} }
} else { } else {
throw new BadRequestException('Body Content-Type has to be text/markdown!'); throw new BadRequestException(
'Body Content-Type has to be text/markdown!',
);
} }
},
}); );

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -23,10 +23,10 @@ export class MediaUpload {
@PrimaryColumn() @PrimaryColumn()
id: string; id: string;
@ManyToOne(_ => Note, { nullable: false }) @ManyToOne((_) => Note, { nullable: false })
note: Note; note: Note;
@ManyToOne(_ => User, { nullable: false }) @ManyToOne((_) => User, { nullable: false })
user: User; user: User;
@Column({ @Column({

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -10,16 +10,12 @@ import { Note } from './note.entity';
@Entity() @Entity()
export class AuthorColor { export class AuthorColor {
@ManyToOne( @ManyToOne((_) => Note, (note) => note.authorColors, {
_ => Note,
note => note.authorColors,
{
primary: true, primary: true,
}, })
)
note: Note; note: Note;
@ManyToOne(_ => User, { @ManyToOne((_) => User, {
primary: true, primary: true,
}) })
user: User; user: User;

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -36,36 +36,22 @@ export class Note {
}) })
alias?: string; alias?: string;
@OneToMany( @OneToMany(
_ => NoteGroupPermission, (_) => NoteGroupPermission,
groupPermission => groupPermission.note, (groupPermission) => groupPermission.note,
) )
groupPermissions: NoteGroupPermission[]; groupPermissions: NoteGroupPermission[];
@OneToMany( @OneToMany((_) => NoteUserPermission, (userPermission) => userPermission.note)
_ => NoteUserPermission,
userPermission => userPermission.note,
)
userPermissions: NoteUserPermission[]; userPermissions: NoteUserPermission[];
@Column({ @Column({
nullable: false, nullable: false,
default: 0, default: 0,
}) })
viewcount: number; viewcount: number;
@ManyToOne( @ManyToOne((_) => User, (user) => user.ownedNotes, { onDelete: 'CASCADE' })
_ => User,
user => user.ownedNotes,
{ onDelete: 'CASCADE' },
)
owner: User; owner: User;
@OneToMany( @OneToMany((_) => Revision, (revision) => revision.note, { cascade: true })
_ => Revision,
revision => revision.note,
{ cascade: true },
)
revisions: Promise<Revision[]>; revisions: Promise<Revision[]>;
@OneToMany( @OneToMany((_) => AuthorColor, (authorColor) => authorColor.note)
_ => AuthorColor,
authorColor => authorColor.note,
)
authorColors: AuthorColor[]; authorColors: AuthorColor[];
@Column({ @Column({
@ -77,11 +63,7 @@ export class Note {
}) })
title?: string; title?: string;
@ManyToMany( @ManyToMany((_) => Tag, (tag) => tag.notes, { eager: true, cascade: true })
_ => Tag,
tag => tag.notes,
{ eager: true, cascade: true },
)
@JoinTable() @JoinTable()
tags: Tag[]; tags: Tag[];

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -113,20 +113,22 @@ export class NotesService {
// TODO: Get actual createTime // TODO: Get actual createTime
createTime: new Date(), createTime: new Date(),
description: note.description, description: note.description,
editedBy: note.authorColors.map(authorColor => authorColor.user.userName), editedBy: note.authorColors.map(
(authorColor) => authorColor.user.userName,
),
// TODO: Extract into method // TODO: Extract into method
permissions: { permissions: {
owner: this.usersService.toUserDto(note.owner), owner: this.usersService.toUserDto(note.owner),
sharedToUsers: note.userPermissions.map(noteUserPermission => ({ sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
user: this.usersService.toUserDto(noteUserPermission.user), user: this.usersService.toUserDto(noteUserPermission.user),
canEdit: noteUserPermission.canEdit, canEdit: noteUserPermission.canEdit,
})), })),
sharedToGroups: note.groupPermissions.map(noteGroupPermission => ({ sharedToGroups: note.groupPermissions.map((noteGroupPermission) => ({
group: noteGroupPermission.group, group: noteGroupPermission.group,
canEdit: noteGroupPermission.canEdit, canEdit: noteGroupPermission.canEdit,
})), })),
}, },
tags: note.tags.map(tag => tag.name), tags: note.tags.map((tag) => tag.name),
updateTime: (await this.getLastRevision(note)).createdAt, updateTime: (await this.getLastRevision(note)).createdAt,
// TODO: Get actual updateUser // TODO: Get actual updateUser
updateUser: { updateUser: {

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -17,9 +17,6 @@ export class Tag {
}) })
name: string; name: string;
@ManyToMany( @ManyToMany((_) => Note, (note) => note.tags)
_ => Note,
note => note.tags,
)
notes: Note[]; notes: Note[];
} }

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -10,14 +10,10 @@ import { Note } from '../notes/note.entity';
@Entity() @Entity()
export class NoteGroupPermission { export class NoteGroupPermission {
@ManyToOne(_ => Group, { primary: true }) @ManyToOne((_) => Group, { primary: true })
group: Group; group: Group;
@ManyToOne( @ManyToOne((_) => Note, (note) => note.groupPermissions, { primary: true })
_ => Note,
note => note.groupPermissions,
{ primary: true },
)
note: Note; note: Note;
@Column() @Column()

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -10,14 +10,10 @@ import { User } from '../users/user.entity';
@Entity() @Entity()
export class NoteUserPermission { export class NoteUserPermission {
@ManyToOne(_ => User, { primary: true }) @ManyToOne((_) => User, { primary: true })
user: User; user: User;
@ManyToOne( @ManyToOne((_) => Note, (note) => note.userPermissions, { primary: true })
_ => Note,
note => note.userPermissions,
{ primary: true },
)
note: Note; note: Note;
@Column() @Column()

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,15 +1,17 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { import {
Column, CreateDateColumn, Column,
CreateDateColumn,
Entity, Entity,
ManyToMany, ManyToMany,
ManyToOne, ManyToOne,
PrimaryGeneratedColumn, UpdateDateColumn, PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm/index'; } from 'typeorm/index';
import { User } from '../users/user.entity'; import { User } from '../users/user.entity';
import { Revision } from './revision.entity'; import { Revision } from './revision.entity';
@ -25,27 +27,24 @@ export class Authorship {
/** /**
* Revisions this authorship appears in * Revisions this authorship appears in
*/ */
@ManyToMany( @ManyToMany((_) => Revision, (revision) => revision.authorships)
_ => Revision,
revision => revision.authorships,
)
revisions: Revision[]; revisions: Revision[];
/** /**
* User this authorship represents * User this authorship represents
*/ */
@ManyToOne(_ => User) @ManyToOne((_) => User)
user: User; user: User;
@Column() @Column()
startPos: number startPos: number;
@Column() @Column()
endPos: number endPos: number;
@CreateDateColumn() @CreateDateColumn()
createdAt: Date createdAt: Date;
@UpdateDateColumn() @UpdateDateColumn()
updatedAt: Date updatedAt: Date;
} }

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -56,19 +56,12 @@ export class Revision {
/** /**
* Note this revision belongs to. * Note this revision belongs to.
*/ */
@ManyToOne( @ManyToOne((_) => Note, (note) => note.revisions, { onDelete: 'CASCADE' })
_ => Note,
note => note.revisions,
{ onDelete: 'CASCADE' },
)
note: Note; note: Note;
/** /**
* All authorship objects which are used in the revision. * All authorship objects which are used in the revision.
*/ */
@ManyToMany( @ManyToMany((_) => Authorship, (authorship) => authorship.revisions)
_ => Authorship,
authorship => authorship.revisions,
)
@JoinTable() @JoinTable()
authorships: Authorship[]; authorships: Authorship[];

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -33,7 +33,7 @@ export class RevisionsService {
note: note.id, note: note.id,
}, },
}); });
return revisions.map(revision => this.toMetadataDto(revision)); return revisions.map((revision) => this.toMetadataDto(revision));
} }
async getNoteRevision( async getNoteRevision(

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -17,10 +17,7 @@ export class AuthToken {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
id: number; id: number;
@ManyToOne( @ManyToOne((_) => User, (user) => user.authToken)
_ => User,
user => user.authToken,
)
user: User; user: User;
@Column() @Column()

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -19,10 +19,7 @@ export class Identity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
id: number; id: number;
@ManyToOne( @ManyToOne((_) => User, (user) => user.identities)
_ => User,
user => user.identities,
)
user: User; user: User;
@Column() @Column()

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@ -42,22 +42,13 @@ export class User {
}) })
email?: string; email?: string;
@OneToMany( @OneToMany((_) => Note, (note) => note.owner)
_ => Note,
note => note.owner,
)
ownedNotes: Note[]; ownedNotes: Note[];
@OneToMany( @OneToMany((_) => AuthToken, (authToken) => authToken.user)
_ => AuthToken,
authToken => authToken.user,
)
authToken: AuthToken[]; authToken: AuthToken[];
@OneToMany( @OneToMany((_) => Identity, (identity) => identity.user)
_ => Identity,
identity => identity.user,
)
identities: Identity[]; identities: Identity[];
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */

View file

@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0 SPDX-License-Identifier: CC0-1.0

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