mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into login_call_unsecureLogin
This commit is contained in:
commit
3b79bae488
@ -27,6 +27,7 @@ import { LoginUserRepository } from '../../typeorm/repository/LoginUser'
|
||||
import { Setting } from '../enum/Setting'
|
||||
import { UserRepository } from '../../typeorm/repository/User'
|
||||
import { LoginUser } from '@entity/LoginUser'
|
||||
import { LoginElopageBuys } from '@entity/LoginElopageBuys'
|
||||
import { LoginUserBackup } from '@entity/LoginUserBackup'
|
||||
import { LoginEmailOptIn } from '@entity/LoginEmailOptIn'
|
||||
import { sendEMail } from '../../util/sendEMail'
|
||||
@ -600,12 +601,17 @@ export class UserResolver {
|
||||
return new CheckEmailResponse(result.data)
|
||||
}
|
||||
|
||||
@Authorized()
|
||||
@Query(() => Boolean)
|
||||
async hasElopage(@Ctx() context: any): Promise<boolean> {
|
||||
const result = await apiGet(CONFIG.LOGIN_API_URL + 'hasElopage?session_id=' + context.sessionId)
|
||||
if (!result.success) {
|
||||
throw new Error(result.data)
|
||||
// const result = await apiGet(CONFIG.LOGIN_API_URL + 'hasElopage?session_id=' + context.sessionId)
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const userEntity = await userRepository.findByPubkeyHex(context.pubKey).catch()
|
||||
if (!userEntity) {
|
||||
return false
|
||||
}
|
||||
return result.data.hasElopage
|
||||
|
||||
const elopageBuyCount = await LoginElopageBuys.count({ payerEmail: userEntity.email })
|
||||
return elopageBuyCount > 0
|
||||
}
|
||||
}
|
||||
|
||||
52
database/entity/0003-login_server_tables/LoginElopageBuys.ts
Normal file
52
database/entity/0003-login_server_tables/LoginElopageBuys.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
|
||||
|
||||
@Entity('login_elopage_buys')
|
||||
export class LoginElopageBuys extends BaseEntity {
|
||||
@PrimaryGeneratedColumn('increment', { unsigned: true })
|
||||
id: number
|
||||
|
||||
@Column({ name: 'elopage_user_id', nullable: false })
|
||||
elopageUserId: number
|
||||
|
||||
@Column({ name: 'affiliate_program_id', nullable: false })
|
||||
affiliateProgramId: number
|
||||
|
||||
@Column({ name: 'publisher_id', nullable: false })
|
||||
publisherId: number
|
||||
|
||||
@Column({ name: 'order_id', nullable: false })
|
||||
orderId: number
|
||||
|
||||
@Column({ name: 'product_id', nullable: false })
|
||||
productId: number
|
||||
|
||||
@Column({ name: 'product_price', nullable: false })
|
||||
productPrice: number
|
||||
|
||||
@Column({
|
||||
name: 'payer_email',
|
||||
length: 255,
|
||||
nullable: false,
|
||||
charset: 'utf8',
|
||||
collation: 'utf8_bin',
|
||||
})
|
||||
payerEmail: string
|
||||
|
||||
@Column({
|
||||
name: 'publisher_email',
|
||||
length: 255,
|
||||
nullable: false,
|
||||
charset: 'utf8',
|
||||
collation: 'utf8_bin',
|
||||
})
|
||||
publisherEmail: string
|
||||
|
||||
@Column({ nullable: false })
|
||||
payed: boolean
|
||||
|
||||
@Column({ name: 'success_date', nullable: false })
|
||||
successDate: Date
|
||||
|
||||
@Column({ length: 255, nullable: false })
|
||||
event: string
|
||||
}
|
||||
1
database/entity/LoginElopageBuys.ts
Normal file
1
database/entity/LoginElopageBuys.ts
Normal file
@ -0,0 +1 @@
|
||||
export { LoginElopageBuys } from './0003-login_server_tables/LoginElopageBuys'
|
||||
@ -1,4 +1,5 @@
|
||||
import { Balance } from './Balance'
|
||||
import { LoginElopageBuys } from './LoginElopageBuys'
|
||||
import { LoginEmailOptIn } from './LoginEmailOptIn'
|
||||
import { LoginUser } from './LoginUser'
|
||||
import { LoginUserBackup } from './LoginUserBackup'
|
||||
@ -12,9 +13,10 @@ import { UserTransaction } from './UserTransaction'
|
||||
|
||||
export const entities = [
|
||||
Balance,
|
||||
LoginElopageBuys,
|
||||
LoginEmailOptIn,
|
||||
LoginUser,
|
||||
LoginUserBackup,
|
||||
LoginEmailOptIn,
|
||||
Migration,
|
||||
Transaction,
|
||||
TransactionCreation,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user