mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
try with nginx, add Balance Model
This commit is contained in:
parent
36c97b9089
commit
b018ae894b
@ -1,4 +1,4 @@
|
||||
PORT=4000
|
||||
GRAPHIQL=false
|
||||
// LOGIN_API_URL=http://login-server:1201/
|
||||
// COMMUNITY_API_URL=http://localhost/api/
|
||||
// COMMUNITY_API_URL=http://nginx/api/
|
||||
@ -8,7 +8,7 @@ const server = {
|
||||
JWT_SECRET: process.env.JWT_SECRET || 'secret123',
|
||||
JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN || '10m',
|
||||
GRAPHIQL: process.env.GRAPHIQL === 'true' || false,
|
||||
LOGIN_API_URL: process.env.LOGIN_API_URL || 'http://localhost/', // login_api/',
|
||||
LOGIN_API_URL: process.env.LOGIN_API_URL || 'http://login-server:1201/',
|
||||
COMMUNITY_API_URL: process.env.COMMUNITY_API_URL || 'http://ngninx/api/',
|
||||
}
|
||||
|
||||
|
||||
26
backend/src/graphql/models/Balance.ts
Normal file
26
backend/src/graphql/models/Balance.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Entity, BaseEntity, Column } from 'typeorm'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
|
||||
@Entity()
|
||||
@ObjectType()
|
||||
export class Balance extends BaseEntity {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(json: any) {
|
||||
super()
|
||||
this.balance = json.balance
|
||||
this.decay = json.decay
|
||||
this.decayDate = json.decay_date
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Column()
|
||||
balance: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Column()
|
||||
decay: number
|
||||
|
||||
@Field(() => String)
|
||||
@Column()
|
||||
decayDate: string
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
import { Resolver, Query, /* Mutation, */ Args, Arg } from 'type-graphql'
|
||||
import CONFIG from '../../config'
|
||||
import {} from '../models/Transaction'
|
||||
import { Balance } from '../models/Balance'
|
||||
import {
|
||||
TransactionCreateArgs,
|
||||
TransactionInput,
|
||||
@ -10,11 +11,12 @@ import { apiPost, apiGet } from '../../apis/loginAPI'
|
||||
|
||||
@Resolver()
|
||||
export class CommunityTransactionResolver {
|
||||
@Query(() => String)
|
||||
async balance(@Arg('sessionId') sessionId: number): Promise<any> {
|
||||
@Query(() => Balance)
|
||||
async balance(@Arg('sessionId') sessionId: number): Promise<Balance> {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('IN BALANCE: URL: ' + CONFIG.COMMUNITY_API_URL + 'getBalance/' + sessionId)
|
||||
return apiGet(CONFIG.COMMUNITY_API_URL + 'getBalance/' + sessionId)
|
||||
const result = await apiGet(CONFIG.COMMUNITY_API_URL + 'getBalance/' + sessionId)
|
||||
return new Balance(result.result.data)
|
||||
}
|
||||
|
||||
@Query(() => String)
|
||||
|
||||
@ -30,6 +30,7 @@ services:
|
||||
target: development
|
||||
networks:
|
||||
- external-net
|
||||
- internal-net
|
||||
environment:
|
||||
- NODE_ENV="development"
|
||||
volumes:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user