mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
Merge branch 'master' into 2049-remove-image-entries-in-docker-compose-files
This commit is contained in:
commit
3e259b049a
@ -1,60 +1,60 @@
|
|||||||
CONFIG_VERSION=v9.2022-07-07
|
CONFIG_VERSION=v9.2022-07-07
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
PORT=4000
|
PORT=4000
|
||||||
JWT_SECRET=secret123
|
JWT_SECRET=secret123
|
||||||
JWT_EXPIRES_IN=10m
|
JWT_EXPIRES_IN=10m
|
||||||
GRAPHIQL=false
|
GRAPHIQL=false
|
||||||
GDT_API_URL=https://gdt.gradido.net
|
GDT_API_URL=https://gdt.gradido.net
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_HOST=localhost
|
DB_HOST=localhost
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_USER=root
|
DB_USER=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
DB_DATABASE=gradido_community
|
DB_DATABASE=gradido_community
|
||||||
TYPEORM_LOGGING_RELATIVE_PATH=typeorm.backend.log
|
TYPEORM_LOGGING_RELATIVE_PATH=typeorm.backend.log
|
||||||
|
|
||||||
# Klicktipp
|
# Klicktipp
|
||||||
KLICKTIPP=false
|
KLICKTIPP=false
|
||||||
KLICKTTIPP_API_URL=https://api.klicktipp.com
|
KLICKTTIPP_API_URL=https://api.klicktipp.com
|
||||||
KLICKTIPP_USER=gradido_test
|
KLICKTIPP_USER=gradido_test
|
||||||
KLICKTIPP_PASSWORD=secret321
|
KLICKTIPP_PASSWORD=secret321
|
||||||
KLICKTIPP_APIKEY_DE=SomeFakeKeyDE
|
KLICKTIPP_APIKEY_DE=SomeFakeKeyDE
|
||||||
KLICKTIPP_APIKEY_EN=SomeFakeKeyEN
|
KLICKTIPP_APIKEY_EN=SomeFakeKeyEN
|
||||||
|
|
||||||
# Community
|
# Community
|
||||||
COMMUNITY_NAME=Gradido Entwicklung
|
COMMUNITY_NAME=Gradido Entwicklung
|
||||||
COMMUNITY_URL=http://localhost/
|
COMMUNITY_URL=http://localhost/
|
||||||
COMMUNITY_REGISTER_URL=http://localhost/register
|
COMMUNITY_REGISTER_URL=http://localhost/register
|
||||||
COMMUNITY_REDEEM_URL=http://localhost/redeem/{code}
|
COMMUNITY_REDEEM_URL=http://localhost/redeem/{code}
|
||||||
COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code}
|
COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code}
|
||||||
COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido.
|
COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido.
|
||||||
|
|
||||||
# Login Server
|
# Login Server
|
||||||
LOGIN_APP_SECRET=21ffbbc616fe
|
LOGIN_APP_SECRET=21ffbbc616fe
|
||||||
LOGIN_SERVER_KEY=a51ef8ac7ef1abf162fb7a65261acd7a
|
LOGIN_SERVER_KEY=a51ef8ac7ef1abf162fb7a65261acd7a
|
||||||
|
|
||||||
# EMail
|
# EMail
|
||||||
EMAIL=false
|
EMAIL=false
|
||||||
EMAIL_USERNAME=gradido_email
|
EMAIL_USERNAME=gradido_email
|
||||||
EMAIL_SENDER=info@gradido.net
|
EMAIL_SENDER=info@gradido.net
|
||||||
EMAIL_PASSWORD=xxx
|
EMAIL_PASSWORD=xxx
|
||||||
EMAIL_SMTP_URL=gmail.com
|
EMAIL_SMTP_URL=gmail.com
|
||||||
EMAIL_SMTP_PORT=587
|
EMAIL_SMTP_PORT=587
|
||||||
EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/{optin}{code}
|
EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/{optin}{code}
|
||||||
EMAIL_LINK_SETPASSWORD=http://localhost/reset-password/{optin}
|
EMAIL_LINK_SETPASSWORD=http://localhost/reset-password/{optin}
|
||||||
EMAIL_LINK_FORGOTPASSWORD=http://localhost/forgot-password
|
EMAIL_LINK_FORGOTPASSWORD=http://localhost/forgot-password
|
||||||
EMAIL_LINK_OVERVIEW=http://localhost/overview
|
EMAIL_LINK_OVERVIEW=http://localhost/overview
|
||||||
EMAIL_CODE_VALID_TIME=1440
|
EMAIL_CODE_VALID_TIME=1440
|
||||||
EMAIL_CODE_REQUEST_TIME=10
|
EMAIL_CODE_REQUEST_TIME=10
|
||||||
|
|
||||||
# Webhook
|
# Webhook
|
||||||
WEBHOOK_ELOPAGE_SECRET=secret
|
WEBHOOK_ELOPAGE_SECRET=secret
|
||||||
|
|
||||||
# EventProtocol
|
# EventProtocol
|
||||||
EVENT_PROTOCOL_DISABLED=false
|
EVENT_PROTOCOL_DISABLED=false
|
||||||
|
|
||||||
# SET LOG LEVEL AS NEEDED IN YOUR .ENV
|
# SET LOG LEVEL AS NEEDED IN YOUR .ENV
|
||||||
# POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal
|
# POSSIBLE VALUES: all | trace | debug | info | warn | error | fatal
|
||||||
# LOG_LEVEL=info
|
# LOG_LEVEL=info
|
||||||
|
|||||||
@ -26,6 +26,7 @@ export enum RIGHTS {
|
|||||||
LIST_TRANSACTION_LINKS = 'LIST_TRANSACTION_LINKS',
|
LIST_TRANSACTION_LINKS = 'LIST_TRANSACTION_LINKS',
|
||||||
GDT_BALANCE = 'GDT_BALANCE',
|
GDT_BALANCE = 'GDT_BALANCE',
|
||||||
CREATE_CONTRIBUTION = 'CREATE_CONTRIBUTION',
|
CREATE_CONTRIBUTION = 'CREATE_CONTRIBUTION',
|
||||||
|
DELETE_CONTRIBUTION = 'DELETE_CONTRIBUTION',
|
||||||
LIST_CONTRIBUTIONS = 'LIST_CONTRIBUTIONS',
|
LIST_CONTRIBUTIONS = 'LIST_CONTRIBUTIONS',
|
||||||
LIST_ALL_CONTRIBUTIONS = 'LIST_ALL_CONTRIBUTIONS',
|
LIST_ALL_CONTRIBUTIONS = 'LIST_ALL_CONTRIBUTIONS',
|
||||||
UPDATE_CONTRIBUTION = 'UPDATE_CONTRIBUTION',
|
UPDATE_CONTRIBUTION = 'UPDATE_CONTRIBUTION',
|
||||||
|
|||||||
@ -24,6 +24,7 @@ export const ROLE_USER = new Role('user', [
|
|||||||
RIGHTS.LIST_TRANSACTION_LINKS,
|
RIGHTS.LIST_TRANSACTION_LINKS,
|
||||||
RIGHTS.GDT_BALANCE,
|
RIGHTS.GDT_BALANCE,
|
||||||
RIGHTS.CREATE_CONTRIBUTION,
|
RIGHTS.CREATE_CONTRIBUTION,
|
||||||
|
RIGHTS.DELETE_CONTRIBUTION,
|
||||||
RIGHTS.LIST_CONTRIBUTIONS,
|
RIGHTS.LIST_CONTRIBUTIONS,
|
||||||
RIGHTS.LIST_ALL_CONTRIBUTIONS,
|
RIGHTS.LIST_ALL_CONTRIBUTIONS,
|
||||||
RIGHTS.UPDATE_CONTRIBUTION,
|
RIGHTS.UPDATE_CONTRIBUTION,
|
||||||
|
|||||||
@ -1,129 +1,129 @@
|
|||||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||||
|
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
Decimal.set({
|
Decimal.set({
|
||||||
precision: 25,
|
precision: 25,
|
||||||
rounding: Decimal.ROUND_HALF_UP,
|
rounding: Decimal.ROUND_HALF_UP,
|
||||||
})
|
})
|
||||||
|
|
||||||
const constants = {
|
const constants = {
|
||||||
DB_VERSION: '0043-add_event_protocol_table',
|
DB_VERSION: '0043-add_event_protocol_table',
|
||||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||||
LOG4JS_CONFIG: 'log4js-config.json',
|
LOG4JS_CONFIG: 'log4js-config.json',
|
||||||
// default log level on production should be info
|
// default log level on production should be info
|
||||||
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
|
LOG_LEVEL: process.env.LOG_LEVEL || 'info',
|
||||||
CONFIG_VERSION: {
|
CONFIG_VERSION: {
|
||||||
DEFAULT: 'DEFAULT',
|
DEFAULT: 'DEFAULT',
|
||||||
EXPECTED: 'v9.2022-07-07',
|
EXPECTED: 'v9.2022-07-07',
|
||||||
CURRENT: '',
|
CURRENT: '',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = {
|
const server = {
|
||||||
PORT: process.env.PORT || 4000,
|
PORT: process.env.PORT || 4000,
|
||||||
JWT_SECRET: process.env.JWT_SECRET || 'secret123',
|
JWT_SECRET: process.env.JWT_SECRET || 'secret123',
|
||||||
JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN || '10m',
|
JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN || '10m',
|
||||||
GRAPHIQL: process.env.GRAPHIQL === 'true' || false,
|
GRAPHIQL: process.env.GRAPHIQL === 'true' || false,
|
||||||
GDT_API_URL: process.env.GDT_API_URL || 'https://gdt.gradido.net',
|
GDT_API_URL: process.env.GDT_API_URL || 'https://gdt.gradido.net',
|
||||||
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const database = {
|
const database = {
|
||||||
DB_HOST: process.env.DB_HOST || 'localhost',
|
DB_HOST: process.env.DB_HOST || 'localhost',
|
||||||
DB_PORT: process.env.DB_PORT ? parseInt(process.env.DB_PORT) : 3306,
|
DB_PORT: process.env.DB_PORT ? parseInt(process.env.DB_PORT) : 3306,
|
||||||
DB_USER: process.env.DB_USER || 'root',
|
DB_USER: process.env.DB_USER || 'root',
|
||||||
DB_PASSWORD: process.env.DB_PASSWORD || '',
|
DB_PASSWORD: process.env.DB_PASSWORD || '',
|
||||||
DB_DATABASE: process.env.DB_DATABASE || 'gradido_community',
|
DB_DATABASE: process.env.DB_DATABASE || 'gradido_community',
|
||||||
TYPEORM_LOGGING_RELATIVE_PATH: process.env.TYPEORM_LOGGING_RELATIVE_PATH || 'typeorm.backend.log',
|
TYPEORM_LOGGING_RELATIVE_PATH: process.env.TYPEORM_LOGGING_RELATIVE_PATH || 'typeorm.backend.log',
|
||||||
}
|
}
|
||||||
|
|
||||||
const klicktipp = {
|
const klicktipp = {
|
||||||
KLICKTIPP: process.env.KLICKTIPP === 'true' || false,
|
KLICKTIPP: process.env.KLICKTIPP === 'true' || false,
|
||||||
KLICKTTIPP_API_URL: process.env.KLICKTIPP_API_URL || 'https://api.klicktipp.com',
|
KLICKTTIPP_API_URL: process.env.KLICKTIPP_API_URL || 'https://api.klicktipp.com',
|
||||||
KLICKTIPP_USER: process.env.KLICKTIPP_USER || 'gradido_test',
|
KLICKTIPP_USER: process.env.KLICKTIPP_USER || 'gradido_test',
|
||||||
KLICKTIPP_PASSWORD: process.env.KLICKTIPP_PASSWORD || 'secret321',
|
KLICKTIPP_PASSWORD: process.env.KLICKTIPP_PASSWORD || 'secret321',
|
||||||
KLICKTIPP_APIKEY_DE: process.env.KLICKTIPP_APIKEY_DE || 'SomeFakeKeyDE',
|
KLICKTIPP_APIKEY_DE: process.env.KLICKTIPP_APIKEY_DE || 'SomeFakeKeyDE',
|
||||||
KLICKTIPP_APIKEY_EN: process.env.KLICKTIPP_APIKEY_EN || 'SomeFakeKeyEN',
|
KLICKTIPP_APIKEY_EN: process.env.KLICKTIPP_APIKEY_EN || 'SomeFakeKeyEN',
|
||||||
}
|
}
|
||||||
|
|
||||||
const community = {
|
const community = {
|
||||||
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung',
|
COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung',
|
||||||
COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/',
|
COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/',
|
||||||
COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register',
|
COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register',
|
||||||
COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}',
|
COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}',
|
||||||
COMMUNITY_REDEEM_CONTRIBUTION_URL:
|
COMMUNITY_REDEEM_CONTRIBUTION_URL:
|
||||||
process.env.COMMUNITY_REDEEM_CONTRIBUTION_URL || 'http://localhost/redeem/CL-{code}',
|
process.env.COMMUNITY_REDEEM_CONTRIBUTION_URL || 'http://localhost/redeem/CL-{code}',
|
||||||
COMMUNITY_DESCRIPTION:
|
COMMUNITY_DESCRIPTION:
|
||||||
process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.',
|
process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.',
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginServer = {
|
const loginServer = {
|
||||||
LOGIN_APP_SECRET: process.env.LOGIN_APP_SECRET || '21ffbbc616fe',
|
LOGIN_APP_SECRET: process.env.LOGIN_APP_SECRET || '21ffbbc616fe',
|
||||||
LOGIN_SERVER_KEY: process.env.LOGIN_SERVER_KEY || 'a51ef8ac7ef1abf162fb7a65261acd7a',
|
LOGIN_SERVER_KEY: process.env.LOGIN_SERVER_KEY || 'a51ef8ac7ef1abf162fb7a65261acd7a',
|
||||||
}
|
}
|
||||||
|
|
||||||
const email = {
|
const email = {
|
||||||
EMAIL: process.env.EMAIL === 'true' || false,
|
EMAIL: process.env.EMAIL === 'true' || false,
|
||||||
EMAIL_USERNAME: process.env.EMAIL_USERNAME || 'gradido_email',
|
EMAIL_USERNAME: process.env.EMAIL_USERNAME || 'gradido_email',
|
||||||
EMAIL_SENDER: process.env.EMAIL_SENDER || 'info@gradido.net',
|
EMAIL_SENDER: process.env.EMAIL_SENDER || 'info@gradido.net',
|
||||||
EMAIL_PASSWORD: process.env.EMAIL_PASSWORD || 'xxx',
|
EMAIL_PASSWORD: process.env.EMAIL_PASSWORD || 'xxx',
|
||||||
EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'gmail.com',
|
EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'gmail.com',
|
||||||
EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587',
|
EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587',
|
||||||
EMAIL_LINK_VERIFICATION:
|
EMAIL_LINK_VERIFICATION:
|
||||||
process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/{optin}{code}',
|
process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/{optin}{code}',
|
||||||
EMAIL_LINK_SETPASSWORD:
|
EMAIL_LINK_SETPASSWORD:
|
||||||
process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset-password/{optin}',
|
process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset-password/{optin}',
|
||||||
EMAIL_LINK_FORGOTPASSWORD:
|
EMAIL_LINK_FORGOTPASSWORD:
|
||||||
process.env.EMAIL_LINK_FORGOTPASSWORD || 'http://localhost/forgot-password',
|
process.env.EMAIL_LINK_FORGOTPASSWORD || 'http://localhost/forgot-password',
|
||||||
EMAIL_LINK_OVERVIEW: process.env.EMAIL_LINK_OVERVIEW || 'http://localhost/overview',
|
EMAIL_LINK_OVERVIEW: process.env.EMAIL_LINK_OVERVIEW || 'http://localhost/overview',
|
||||||
// time in minutes a optin code is valid
|
// time in minutes a optin code is valid
|
||||||
EMAIL_CODE_VALID_TIME: process.env.EMAIL_CODE_VALID_TIME
|
EMAIL_CODE_VALID_TIME: process.env.EMAIL_CODE_VALID_TIME
|
||||||
? parseInt(process.env.EMAIL_CODE_VALID_TIME) || 1440
|
? parseInt(process.env.EMAIL_CODE_VALID_TIME) || 1440
|
||||||
: 1440,
|
: 1440,
|
||||||
// time in minutes that must pass to request a new optin code
|
// time in minutes that must pass to request a new optin code
|
||||||
EMAIL_CODE_REQUEST_TIME: process.env.EMAIL_CODE_REQUEST_TIME
|
EMAIL_CODE_REQUEST_TIME: process.env.EMAIL_CODE_REQUEST_TIME
|
||||||
? parseInt(process.env.EMAIL_CODE_REQUEST_TIME) || 10
|
? parseInt(process.env.EMAIL_CODE_REQUEST_TIME) || 10
|
||||||
: 10,
|
: 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
const webhook = {
|
const webhook = {
|
||||||
// Elopage
|
// Elopage
|
||||||
WEBHOOK_ELOPAGE_SECRET: process.env.WEBHOOK_ELOPAGE_SECRET || 'secret',
|
WEBHOOK_ELOPAGE_SECRET: process.env.WEBHOOK_ELOPAGE_SECRET || 'secret',
|
||||||
}
|
}
|
||||||
|
|
||||||
const eventProtocol = {
|
const eventProtocol = {
|
||||||
// global switch to enable writing of EventProtocol-Entries
|
// global switch to enable writing of EventProtocol-Entries
|
||||||
EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false,
|
EVENT_PROTOCOL_DISABLED: process.env.EVENT_PROTOCOL_DISABLED === 'true' || false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is needed by graphql-directive-auth
|
// This is needed by graphql-directive-auth
|
||||||
process.env.APP_SECRET = server.JWT_SECRET
|
process.env.APP_SECRET = server.JWT_SECRET
|
||||||
|
|
||||||
// Check config version
|
// Check config version
|
||||||
constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT
|
constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION || constants.CONFIG_VERSION.DEFAULT
|
||||||
if (
|
if (
|
||||||
![constants.CONFIG_VERSION.EXPECTED, constants.CONFIG_VERSION.DEFAULT].includes(
|
![constants.CONFIG_VERSION.EXPECTED, constants.CONFIG_VERSION.DEFAULT].includes(
|
||||||
constants.CONFIG_VERSION.CURRENT,
|
constants.CONFIG_VERSION.CURRENT,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Fatal: Config Version incorrect - expected "${constants.CONFIG_VERSION.EXPECTED}" or "${constants.CONFIG_VERSION.DEFAULT}", but found "${constants.CONFIG_VERSION.CURRENT}"`,
|
`Fatal: Config Version incorrect - expected "${constants.CONFIG_VERSION.EXPECTED}" or "${constants.CONFIG_VERSION.DEFAULT}", but found "${constants.CONFIG_VERSION.CURRENT}"`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
...constants,
|
...constants,
|
||||||
...server,
|
...server,
|
||||||
...database,
|
...database,
|
||||||
...klicktipp,
|
...klicktipp,
|
||||||
...community,
|
...community,
|
||||||
...email,
|
...email,
|
||||||
...loginServer,
|
...loginServer,
|
||||||
...webhook,
|
...webhook,
|
||||||
...eventProtocol,
|
...eventProtocol,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CONFIG
|
export default CONFIG
|
||||||
|
|||||||
@ -15,6 +15,7 @@ export class Contribution {
|
|||||||
this.deletedAt = contribution.deletedAt
|
this.deletedAt = contribution.deletedAt
|
||||||
this.confirmedAt = contribution.confirmedAt
|
this.confirmedAt = contribution.confirmedAt
|
||||||
this.confirmedBy = contribution.confirmedBy
|
this.confirmedBy = contribution.confirmedBy
|
||||||
|
this.contributionDate = contribution.contributionDate
|
||||||
}
|
}
|
||||||
|
|
||||||
@Field(() => Number)
|
@Field(() => Number)
|
||||||
@ -43,6 +44,9 @@ export class Contribution {
|
|||||||
|
|
||||||
@Field(() => Number, { nullable: true })
|
@Field(() => Number, { nullable: true })
|
||||||
confirmedBy: number | null
|
confirmedBy: number | null
|
||||||
|
|
||||||
|
@Field(() => Date)
|
||||||
|
contributionDate: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
|
|||||||
@ -4,7 +4,9 @@
|
|||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import {
|
import {
|
||||||
adminUpdateContribution,
|
adminUpdateContribution,
|
||||||
|
confirmContribution,
|
||||||
createContribution,
|
createContribution,
|
||||||
|
deleteContribution,
|
||||||
updateContribution,
|
updateContribution,
|
||||||
} from '@/seeds/graphql/mutations'
|
} from '@/seeds/graphql/mutations'
|
||||||
import { listAllContributions, listContributions, login } from '@/seeds/graphql/queries'
|
import { listAllContributions, listContributions, login } from '@/seeds/graphql/queries'
|
||||||
@ -487,6 +489,11 @@ describe('ContributionResolver', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await cleanDB()
|
||||||
|
resetToken()
|
||||||
|
})
|
||||||
|
|
||||||
it('returns allCreation', async () => {
|
it('returns allCreation', async () => {
|
||||||
await expect(
|
await expect(
|
||||||
query({
|
query({
|
||||||
@ -522,4 +529,129 @@ describe('ContributionResolver', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('deleteContribution', () => {
|
||||||
|
describe('unauthenticated', () => {
|
||||||
|
it('returns an error', async () => {
|
||||||
|
await expect(
|
||||||
|
query({
|
||||||
|
query: deleteContribution,
|
||||||
|
variables: {
|
||||||
|
id: -1,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('401 Unauthorized')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('authenticated', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await userFactory(testEnv, bibiBloxberg)
|
||||||
|
await userFactory(testEnv, peterLustig)
|
||||||
|
await query({
|
||||||
|
query: login,
|
||||||
|
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
result = await mutate({
|
||||||
|
mutation: createContribution,
|
||||||
|
variables: {
|
||||||
|
amount: 100.0,
|
||||||
|
memo: 'Test env contribution',
|
||||||
|
creationDate: new Date().toString(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await cleanDB()
|
||||||
|
resetToken()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('wrong contribution id', () => {
|
||||||
|
it('returns an error', async () => {
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: deleteContribution,
|
||||||
|
variables: {
|
||||||
|
id: -1,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('Contribution not found for given id.')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('other user sends a deleteContribtuion', () => {
|
||||||
|
it('returns an error', async () => {
|
||||||
|
await query({
|
||||||
|
query: login,
|
||||||
|
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: deleteContribution,
|
||||||
|
variables: {
|
||||||
|
id: result.data.createContribution.id,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('Can not delete contribution of another user')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('User deletes own contribution', () => {
|
||||||
|
it('deletes successfully', async () => {
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: deleteContribution,
|
||||||
|
variables: {
|
||||||
|
id: result.data.createContribution.id,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('User deletes already confirmed contribution', () => {
|
||||||
|
it('throws an error', async () => {
|
||||||
|
await query({
|
||||||
|
query: login,
|
||||||
|
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
await mutate({
|
||||||
|
mutation: confirmContribution,
|
||||||
|
variables: {
|
||||||
|
id: result.data.createContribution.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await query({
|
||||||
|
query: login,
|
||||||
|
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: deleteContribution,
|
||||||
|
variables: {
|
||||||
|
id: result.data.createContribution.id,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
errors: [new GraphQLError('A confirmed contribution can not be deleted')],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -38,6 +38,27 @@ export class ContributionResolver {
|
|||||||
return new UnconfirmedContribution(contribution, user, creations)
|
return new UnconfirmedContribution(contribution, user, creations)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Authorized([RIGHTS.DELETE_CONTRIBUTION])
|
||||||
|
@Mutation(() => Boolean)
|
||||||
|
async deleteContribution(
|
||||||
|
@Arg('id', () => Int) id: number,
|
||||||
|
@Ctx() context: Context,
|
||||||
|
): Promise<boolean> {
|
||||||
|
const user = getUser(context)
|
||||||
|
const contribution = await dbContribution.findOne(id)
|
||||||
|
if (!contribution) {
|
||||||
|
throw new Error('Contribution not found for given id.')
|
||||||
|
}
|
||||||
|
if (contribution.userId !== user.id) {
|
||||||
|
throw new Error('Can not delete contribution of another user')
|
||||||
|
}
|
||||||
|
if (contribution.confirmedAt) {
|
||||||
|
throw new Error('A confirmed contribution can not be deleted')
|
||||||
|
}
|
||||||
|
const res = await contribution.softRemove()
|
||||||
|
return !!res
|
||||||
|
}
|
||||||
|
|
||||||
@Authorized([RIGHTS.LIST_CONTRIBUTIONS])
|
@Authorized([RIGHTS.LIST_CONTRIBUTIONS])
|
||||||
@Query(() => ContributionListResult)
|
@Query(() => ContributionListResult)
|
||||||
async listContributions(
|
async listContributions(
|
||||||
|
|||||||
@ -255,3 +255,9 @@ export const updateContribution = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
export const deleteContribution = gql`
|
||||||
|
mutation ($id: Int!) {
|
||||||
|
deleteContribution(id: $id)
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|||||||
83
database/entity/0039-contributions_table/User.ts
Normal file
83
database/entity/0039-contributions_table/User.ts
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
import {
|
||||||
|
BaseEntity,
|
||||||
|
Entity,
|
||||||
|
PrimaryGeneratedColumn,
|
||||||
|
Column,
|
||||||
|
DeleteDateColumn,
|
||||||
|
OneToMany,
|
||||||
|
JoinColumn,
|
||||||
|
} 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[]
|
||||||
|
}
|
||||||
@ -1,84 +1,84 @@
|
|||||||
GRADIDO_LOG_PATH=/home/gradido/gradido/deployment/bare_metal/log
|
GRADIDO_LOG_PATH=/home/gradido/gradido/deployment/bare_metal/log
|
||||||
|
|
||||||
# start script
|
# start script
|
||||||
DEPLOY_SEED_DATA=false
|
DEPLOY_SEED_DATA=false
|
||||||
|
|
||||||
# nginx
|
# nginx
|
||||||
NGINX_REWRITE_LEGACY_URLS=true
|
NGINX_REWRITE_LEGACY_URLS=true
|
||||||
NGINX_SSL=true
|
NGINX_SSL=true
|
||||||
NGINX_SERVER_NAME=stage1.gradido.net
|
NGINX_SERVER_NAME=stage1.gradido.net
|
||||||
NGINX_SSL_CERTIFICATE=/etc/letsencrypt/live/stage1.gradido.net/fullchain.pem
|
NGINX_SSL_CERTIFICATE=/etc/letsencrypt/live/stage1.gradido.net/fullchain.pem
|
||||||
NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem
|
NGINX_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/stage1.gradido.net/privkey.pem
|
||||||
NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem
|
NGINX_SSL_DHPARAM=/etc/letsencrypt/ssl-dhparams.pem
|
||||||
NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf
|
NGINX_SSL_INCLUDE=/etc/letsencrypt/options-ssl-nginx.conf
|
||||||
NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page
|
NGINX_UPDATE_PAGE_ROOT=/home/gradido/gradido/deployment/bare_metal/nginx/update-page
|
||||||
|
|
||||||
# webhook
|
# webhook
|
||||||
WEBHOOK_GITHUB_SECRET=secret
|
WEBHOOK_GITHUB_SECRET=secret
|
||||||
WEBHOOK_GITHUB_BRANCH=master
|
WEBHOOK_GITHUB_BRANCH=master
|
||||||
|
|
||||||
# community
|
# community
|
||||||
COMMUNITY_NAME="Gradido Development Stage1"
|
COMMUNITY_NAME="Gradido Development Stage1"
|
||||||
COMMUNITY_URL=https://stage1.gradido.net/
|
COMMUNITY_URL=https://stage1.gradido.net/
|
||||||
COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
|
COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register
|
||||||
COMMUNITY_REDEEM_URL=https://stage1.gradido.net/redeem/{code}
|
COMMUNITY_REDEEM_URL=https://stage1.gradido.net/redeem/{code}
|
||||||
COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code}
|
COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code}
|
||||||
COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community"
|
COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community"
|
||||||
|
|
||||||
# backend
|
# backend
|
||||||
BACKEND_CONFIG_VERSION=v9.2022-07-07
|
BACKEND_CONFIG_VERSION=v9.2022-07-07
|
||||||
|
|
||||||
JWT_EXPIRES_IN=10m
|
JWT_EXPIRES_IN=10m
|
||||||
GDT_API_URL=https://gdt.gradido.net
|
GDT_API_URL=https://gdt.gradido.net
|
||||||
|
|
||||||
TYPEORM_LOGGING_RELATIVE_PATH=../deployment/bare_metal/log/typeorm.backend.log
|
TYPEORM_LOGGING_RELATIVE_PATH=../deployment/bare_metal/log/typeorm.backend.log
|
||||||
|
|
||||||
KLICKTIPP=false
|
KLICKTIPP=false
|
||||||
KLICKTIPP_USER=
|
KLICKTIPP_USER=
|
||||||
KLICKTIPP_PASSWORD=
|
KLICKTIPP_PASSWORD=
|
||||||
KLICKTIPP_APIKEY_DE=
|
KLICKTIPP_APIKEY_DE=
|
||||||
KLICKTIPP_APIKEY_EN=
|
KLICKTIPP_APIKEY_EN=
|
||||||
|
|
||||||
EMAIL=true
|
EMAIL=true
|
||||||
EMAIL_USERNAME=peter@lustig.de
|
EMAIL_USERNAME=peter@lustig.de
|
||||||
EMAIL_SENDER=peter@lustig.de
|
EMAIL_SENDER=peter@lustig.de
|
||||||
EMAIL_PASSWORD=1234
|
EMAIL_PASSWORD=1234
|
||||||
EMAIL_SMTP_URL=smtp.lustig.de
|
EMAIL_SMTP_URL=smtp.lustig.de
|
||||||
EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/{optin}{code}
|
EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/{optin}{code}
|
||||||
EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset-password/{optin}
|
EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset-password/{optin}
|
||||||
EMAIL_LINK_FORGOTPASSWORD=https://stage1.gradido.net/forgot-password
|
EMAIL_LINK_FORGOTPASSWORD=https://stage1.gradido.net/forgot-password
|
||||||
EMAIL_LINK_OVERVIEW=https://stage1.gradido.net/overview
|
EMAIL_LINK_OVERVIEW=https://stage1.gradido.net/overview
|
||||||
EMAIL_CODE_VALID_TIME=1440
|
EMAIL_CODE_VALID_TIME=1440
|
||||||
EMAIL_CODE_REQUEST_TIME=10
|
EMAIL_CODE_REQUEST_TIME=10
|
||||||
|
|
||||||
WEBHOOK_ELOPAGE_SECRET=secret
|
WEBHOOK_ELOPAGE_SECRET=secret
|
||||||
|
|
||||||
# EventProtocol
|
# EventProtocol
|
||||||
EVENT_PROTOCOL_DISABLED=false
|
EVENT_PROTOCOL_DISABLED=false
|
||||||
|
|
||||||
|
|
||||||
# database
|
# database
|
||||||
DATABASE_CONFIG_VERSION=v1.2022-03-18
|
DATABASE_CONFIG_VERSION=v1.2022-03-18
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
FRONTEND_CONFIG_VERSION=v2.2022-04-07
|
FRONTEND_CONFIG_VERSION=v2.2022-04-07
|
||||||
|
|
||||||
GRAPHQL_URI=https://stage1.gradido.net/graphql
|
GRAPHQL_URI=https://stage1.gradido.net/graphql
|
||||||
ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token}
|
ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token={token}
|
||||||
|
|
||||||
DEFAULT_PUBLISHER_ID=2896
|
DEFAULT_PUBLISHER_ID=2896
|
||||||
|
|
||||||
META_URL=http://localhost
|
META_URL=http://localhost
|
||||||
META_TITLE_DE="Gradido – Dein Dankbarkeitskonto"
|
META_TITLE_DE="Gradido – Dein Dankbarkeitskonto"
|
||||||
META_TITLE_EN="Gradido - Your gratitude account"
|
META_TITLE_EN="Gradido - Your gratitude account"
|
||||||
META_DESCRIPTION_DE="Dankbarkeit ist die Währung der neuen Zeit. Immer mehr Menschen entfalten ihr Potenzial und gestalten eine gute Zukunft für alle."
|
META_DESCRIPTION_DE="Dankbarkeit ist die Währung der neuen Zeit. Immer mehr Menschen entfalten ihr Potenzial und gestalten eine gute Zukunft für alle."
|
||||||
META_DESCRIPTION_EN="Gratitude is the currency of the new age. More and more people are unleashing their potential and shaping a good future for all."
|
META_DESCRIPTION_EN="Gratitude is the currency of the new age. More and more people are unleashing their potential and shaping a good future for all."
|
||||||
META_KEYWORDS_DE="Grundeinkommen, Währung, Dankbarkeit, Schenk-Ökonomie, Natürliche Ökonomie des Lebens, Ökonomie, Ökologie, Potenzialentfaltung, Schenken und Danken, Kreislauf des Lebens, Geldsystem"
|
META_KEYWORDS_DE="Grundeinkommen, Währung, Dankbarkeit, Schenk-Ökonomie, Natürliche Ökonomie des Lebens, Ökonomie, Ökologie, Potenzialentfaltung, Schenken und Danken, Kreislauf des Lebens, Geldsystem"
|
||||||
META_KEYWORDS_EN="Basic Income, Currency, Gratitude, Gift Economy, Natural Economy of Life, Economy, Ecology, Potential Development, Giving and Thanking, Cycle of Life, Monetary System"
|
META_KEYWORDS_EN="Basic Income, Currency, Gratitude, Gift Economy, Natural Economy of Life, Economy, Ecology, Potential Development, Giving and Thanking, Cycle of Life, Monetary System"
|
||||||
META_AUTHOR="Bernd Hückstädt - Gradido-Akademie"
|
META_AUTHOR="Bernd Hückstädt - Gradido-Akademie"
|
||||||
|
|
||||||
# admin
|
# admin
|
||||||
ADMIN_CONFIG_VERSION=v1.2022-03-18
|
ADMIN_CONFIG_VERSION=v1.2022-03-18
|
||||||
|
|
||||||
WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token={token}
|
WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token={token}
|
||||||
WALLET_URL=https://stage1.gradido.net/login
|
WALLET_URL=https://stage1.gradido.net/login
|
||||||
Loading…
x
Reference in New Issue
Block a user