mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
rework PR-Comments
This commit is contained in:
parent
a9b84088f9
commit
0edd295dbb
@ -527,7 +527,7 @@ export class AdminResolver {
|
|||||||
logger.error(`The validFrom=${validFrom} must be before or equals the validTo=${validTo}!`)
|
logger.error(`The validFrom=${validFrom} must be before or equals the validTo=${validTo}!`)
|
||||||
throw new Error(`The validFrom=${validFrom} must be before or equals the validTo=${validTo}!`)
|
throw new Error(`The validFrom=${validFrom} must be before or equals the validTo=${validTo}!`)
|
||||||
}
|
}
|
||||||
if (name == null) {
|
if (!name) {
|
||||||
logger.error(`The name must be initialized!`)
|
logger.error(`The name must be initialized!`)
|
||||||
throw new Error(`The name must be initialized!`)
|
throw new Error(`The name must be initialized!`)
|
||||||
}
|
}
|
||||||
@ -539,6 +539,10 @@ export class AdminResolver {
|
|||||||
logger.error(`${msg}`)
|
logger.error(`${msg}`)
|
||||||
throw new Error(`${msg}`)
|
throw new Error(`${msg}`)
|
||||||
}
|
}
|
||||||
|
if (!memo) {
|
||||||
|
logger.error(`The memo must be initialized!`)
|
||||||
|
throw new Error(`The memo must be initialized!`)
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
memo.length < CONTRIBUTIONLINK_MEMO_MIN_CHARS ||
|
memo.length < CONTRIBUTIONLINK_MEMO_MIN_CHARS ||
|
||||||
memo.length > CONTRIBUTIONLINK_MEMO_MAX_CHARS
|
memo.length > CONTRIBUTIONLINK_MEMO_MAX_CHARS
|
||||||
@ -547,12 +551,11 @@ export class AdminResolver {
|
|||||||
logger.error(`${msg}`)
|
logger.error(`${msg}`)
|
||||||
throw new Error(`${msg}`)
|
throw new Error(`${msg}`)
|
||||||
}
|
}
|
||||||
if (amount == null) {
|
if (!amount) {
|
||||||
logger.error(`The amount must be initialized!`)
|
logger.error(`The amount must be initialized!`)
|
||||||
throw new Error('The amount must be initialized!')
|
throw new Error('The amount must be initialized!')
|
||||||
}
|
}
|
||||||
const amountObj = new Decimal(amount)
|
if (!new Decimal(amount).isPositive()) {
|
||||||
if (amountObj.lessThanOrEqualTo(new Decimal(0))) {
|
|
||||||
logger.error(`The amount=${amount} must be initialized with a positiv value!`)
|
logger.error(`The amount=${amount} must be initialized with a positiv value!`)
|
||||||
throw new Error(`The amount=${amount} must be initialized with a positiv value!`)
|
throw new Error(`The amount=${amount} must be initialized with a positiv value!`)
|
||||||
}
|
}
|
||||||
@ -736,24 +739,19 @@ function isStartEndDateValid(
|
|||||||
startDate: string | null | undefined,
|
startDate: string | null | undefined,
|
||||||
endDate: string | null | undefined,
|
endDate: string | null | undefined,
|
||||||
) {
|
) {
|
||||||
if (startDate == null && endDate == null) {
|
if (!startDate) {
|
||||||
logger.error('Start- and End-Date are not initialized. At least a startDate must be set!')
|
logger.error('Start-Date is not initialized. A Start-Date must be set!')
|
||||||
throw new Error('Start- and End-Date are not initialized. At least a startDate must be set!')
|
throw new Error('Start-Date is not initialized. A Start-Date must be set!')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startDate == null) {
|
if (!endDate) {
|
||||||
logger.error('StartDate is not initialized. At least a startDate must be set!')
|
logger.error('End-Date is not initialized. An End-Date must be set!')
|
||||||
throw new Error('Start-Date is not initialized. At least a startDate must be set!')
|
throw new Error('End-Date is not initialized. An End-Date must be set!')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startDate != null && endDate != null) {
|
// check if endDate is before startDate
|
||||||
const startDateObj = new Date(startDate)
|
if (new Date(endDate).getTime() - new Date(startDate).getTime() < 0) {
|
||||||
const endDateObj = new Date(endDate)
|
return false
|
||||||
|
|
||||||
// check if endDate is before startDate
|
|
||||||
if (endDateObj.getTime() - startDateObj.getTime() < 0) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user