Skip to content

Commit

Permalink
Merge pull request #190 from sotatek-dev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Sotatek-TanHoang authored Oct 17, 2024
2 parents d7a7018 + fad74ad commit a2fde80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/database/seeds/common_config.seed.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import * as dotenv from 'dotenv';
import { DataSource } from 'typeorm';
import { Seeder, SeederFactoryManager } from 'typeorm-extension';
import { Seeder } from 'typeorm-extension';

import { COMMOM_CONFIG_TIP, COMMON__CONFIG_DAILY_QUOTA, EAsset } from '../../constants/api.constant.js';
import { CommonConfig } from '../../modules/crawler/entities/common-config.entity.js';

export default class CommonConfigSeeder implements Seeder {
public async run(dataSource: DataSource, factoryManager: SeederFactoryManager): Promise<any> {
public async run(dataSource: DataSource): Promise<any> {
dotenv.config();
const repository = dataSource.getRepository(CommonConfig);
await repository.delete({});
await repository.insert(
new CommonConfig({
tip: COMMOM_CONFIG_TIP,
dailyQuota: COMMON__CONFIG_DAILY_QUOTA,
feeUnlockEth: '0.0001',
feeUnlockMina: '0.00001',
asset: EAsset.ETH,
}),
);
Expand Down
6 changes: 3 additions & 3 deletions src/database/seeds/super_admin.seed.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as dotenv from 'dotenv';
import { DataSource } from 'typeorm';
import { Seeder, SeederFactoryManager } from 'typeorm-extension';
import { Seeder } from 'typeorm-extension';

import { ERole } from '../../constants/api.constant.js';
import { User } from '../../modules/users/entities/user.entity.js';

export default class SuperAdminSeeder implements Seeder {
public async run(dataSource: DataSource, factoryManager: SeederFactoryManager): Promise<any> {
public async run(dataSource: DataSource): Promise<any> {
dotenv.config();
const repository = dataSource.getRepository(User);
const listAdmin = [
Expand All @@ -19,7 +19,7 @@ export default class SuperAdminSeeder implements Seeder {
name: ERole.MINA_ADMIN,
},
];

await repository.delete({});
for (const admin of listAdmin) {
const newUser = new User({
walletAddress: admin.walletAddress,
Expand Down
5 changes: 3 additions & 2 deletions src/database/seeds/token_pairs.seed.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as dotenv from 'dotenv';
import { DataSource } from 'typeorm';
import { Seeder, SeederFactoryManager } from 'typeorm-extension';
import { Seeder } from 'typeorm-extension';

import { EAsset } from '../../constants/api.constant.js';
import { ENetworkName, ETokenPairStatus } from '../../constants/blockchain.constant.js';
import { TokenPair } from '../../modules/users/entities/tokenpair.entity.js';

export default class TokenPairsSeeder implements Seeder {
public async run(dataSource: DataSource, factoryManager: SeederFactoryManager): Promise<any> {
public async run(dataSource: DataSource): Promise<any> {
dotenv.config();
const repository = dataSource.getRepository(TokenPair);
const listToken = [
Expand Down Expand Up @@ -36,6 +36,7 @@ export default class TokenPairsSeeder implements Seeder {
toScAddress: process.env.ETH_BRIDGE_CONTRACT_ADDRESS,
},
];
await repository.delete({});
for (const token of listToken) {
const newToken = new TokenPair({
fromChain: token.fromChain,
Expand Down

0 comments on commit a2fde80

Please sign in to comment.