mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
202 changed files with 5364 additions and 4068 deletions
@ -1 +1 @@ |
|||||
v20 |
v22 |
||||
|
File diff suppressed because it is too large
@ -0,0 +1,23 @@ |
|||||
|
import { UserModule } from '@ghostfolio/api/app/user/user.module'; |
||||
|
import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; |
||||
|
import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; |
||||
|
import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; |
||||
|
import { DataGatheringModule } from '@ghostfolio/api/services/queues/data-gathering/data-gathering.module'; |
||||
|
import { TwitterBotModule } from '@ghostfolio/api/services/twitter-bot/twitter-bot.module'; |
||||
|
|
||||
|
import { Module } from '@nestjs/common'; |
||||
|
|
||||
|
import { CronService } from './cron.service'; |
||||
|
|
||||
|
@Module({ |
||||
|
imports: [ |
||||
|
ConfigurationModule, |
||||
|
DataGatheringModule, |
||||
|
ExchangeRateDataModule, |
||||
|
PropertyModule, |
||||
|
TwitterBotModule, |
||||
|
UserModule |
||||
|
], |
||||
|
providers: [CronService] |
||||
|
}) |
||||
|
export class CronModule {} |
@ -0,0 +1,13 @@ |
|||||
|
import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; |
||||
|
import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; |
||||
|
|
||||
|
import { Module } from '@nestjs/common'; |
||||
|
|
||||
|
import { DemoService } from './demo.service'; |
||||
|
|
||||
|
@Module({ |
||||
|
exports: [DemoService], |
||||
|
imports: [PrismaModule, PropertyModule], |
||||
|
providers: [DemoService] |
||||
|
}) |
||||
|
export class DemoModule {} |
@ -0,0 +1,59 @@ |
|||||
|
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; |
||||
|
import { PropertyService } from '@ghostfolio/api/services/property/property.service'; |
||||
|
import { |
||||
|
PROPERTY_DEMO_ACCOUNT_ID, |
||||
|
PROPERTY_DEMO_USER_ID, |
||||
|
TAG_ID_DEMO |
||||
|
} from '@ghostfolio/common/config'; |
||||
|
|
||||
|
import { Injectable } from '@nestjs/common'; |
||||
|
import { v4 as uuidv4 } from 'uuid'; |
||||
|
|
||||
|
@Injectable() |
||||
|
export class DemoService { |
||||
|
public constructor( |
||||
|
private readonly prismaService: PrismaService, |
||||
|
private readonly propertyService: PropertyService |
||||
|
) {} |
||||
|
|
||||
|
public async syncDemoUserAccount() { |
||||
|
const [demoAccountId, demoUserId] = (await Promise.all([ |
||||
|
this.propertyService.getByKey(PROPERTY_DEMO_ACCOUNT_ID), |
||||
|
this.propertyService.getByKey(PROPERTY_DEMO_USER_ID) |
||||
|
])) as [string, string]; |
||||
|
|
||||
|
let activities = await this.prismaService.order.findMany({ |
||||
|
orderBy: { |
||||
|
date: 'asc' |
||||
|
}, |
||||
|
where: { |
||||
|
tags: { |
||||
|
some: { |
||||
|
id: TAG_ID_DEMO |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
activities = activities.map((activity) => { |
||||
|
return { |
||||
|
...activity, |
||||
|
accountId: demoAccountId, |
||||
|
accountUserId: demoUserId, |
||||
|
comment: null, |
||||
|
id: uuidv4(), |
||||
|
userId: demoUserId |
||||
|
}; |
||||
|
}); |
||||
|
|
||||
|
await this.prismaService.order.deleteMany({ |
||||
|
where: { |
||||
|
userId: demoUserId |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
return this.prismaService.order.createMany({ |
||||
|
data: activities |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
import { Module } from '@nestjs/common'; |
||||
|
|
||||
|
import { I18nService } from './i18n.service'; |
||||
|
|
||||
|
@Module({ |
||||
|
exports: [I18nService], |
||||
|
providers: [I18nService] |
||||
|
}) |
||||
|
export class I18nModule {} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue