Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade AdminJS dependency #1419

Draft
wants to merge 30 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bee8f12
replace all "require"s with import
RamRamez Mar 20, 2024
b0d2de0
Merge branch 'refs/heads/staging' into replace-all-requires-with-import
RamRamez Jul 8, 2024
658a734
add type packages
RamRamez Jul 8, 2024
f8a4ca1
add type packages
RamRamez Jul 8, 2024
79eb745
update tsconfig.json
RamRamez Jul 8, 2024
6e56708
update package.json
RamRamez Jul 8, 2024
4376427
update export
RamRamez Jul 8, 2024
6ce9124
update export
RamRamez Jul 8, 2024
066d3af
migrate all imports to esm
RamRamez Jul 15, 2024
b22bf3e
Merge branch 'refs/heads/staging' into replace-all-requires-with-import
RamRamez Jul 15, 2024
6f1ecd8
migrate all imports to esm
RamRamez Jul 15, 2024
9ce3969
fix eslint errors
RamRamez Jul 15, 2024
d9e2c8e
add lazy import for circular dependencies
RamRamez Jul 16, 2024
0585d2c
Merge branch 'refs/heads/staging' into replace-all-requires-with-import
RamRamez Jul 16, 2024
4791fa4
add Relation import for entities
RamRamez Jul 16, 2024
48333ab
disable google spreadsheet
RamRamez Jul 16, 2024
af5551c
disable google spreadsheet
RamRamez Jul 16, 2024
b12aac2
disable google spreadsheet
RamRamez Jul 16, 2024
5617658
Merge branch 'refs/heads/staging' into replace-all-requires-with-import
RamRamez Jul 28, 2024
9f60560
update branch with staging (first working commit - npm start)
RamRamez Jul 28, 2024
6e480be
fix types - only npm start is working
RamRamez Jul 28, 2024
c66d7d1
update build command
RamRamez Jul 28, 2024
1ccd4bc
update package.json to use esm instead of commonjs
RamRamez Jul 28, 2024
16e988a
fix running migrations
RamRamez Jul 28, 2024
0348222
migrate migrations to ESM
RamRamez Jul 28, 2024
63c8d4c
migrate migrations to ESM
RamRamez Jul 28, 2024
c7e3141
run tests in ESM
RamRamez Jul 28, 2024
2b6b9d4
run tests in ESM
RamRamez Jul 28, 2024
14b1c74
disable broadcastNorificationTab.test.ts donationService.test.ts draf…
RamRamez Jul 28, 2024
4f0d952
Merge branch 'refs/heads/develop' into replace-all-requires-with-import
RamRamez Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["import", "unused-imports"],
"extends": [
"eslint:recommended",
Expand Down
2 changes: 1 addition & 1 deletion migration/1643962364050-seedProjectStatusreasons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { ProjStatus } from '../src/entities/project';
import { ProjStatus } from '../src/entities/project.js';

export class seedProjectStatusreasons1643962364050
implements MigrationInterface
Expand Down
6 changes: 3 additions & 3 deletions migration/1646303882607-seedTokes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { ChainType } from '../src/types/network';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { ChainType } from '../src/types/network.js';

export class seedTokes1646303882607 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion migration/1646305490859-seedOrganizations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { ORGANIZATION_LABELS } from '../src/entities/organization';
import { ORGANIZATION_LABELS } from '../src/entities/organization.js';

const { GIVETH, TRACE, CHANGE } = ORGANIZATION_LABELS;

Expand Down
3 changes: 1 addition & 2 deletions migration/1647514950889-fixUpdatetAtOfProjects.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const moment = require('moment');
import moment from 'moment';

export class fixUpdatetAtOfProjects1647514950889 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion migration/1648066794387-addChangeAcceptedtokens.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import config from '../src/config.js';

export class addChangeAcceptedtokens1648066794387
implements MigrationInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { ORGANIZATION_LABELS } from '../src/entities/organization';
import { ORGANIZATION_LABELS } from '../src/entities/organization.js';

export class addSupportCustomTokensToOrganizations1648103938557
implements MigrationInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import config from '../src/config.js';

// validated this list names from the frontend list manually
// removed eth as this is related on another migration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Project } from '../src/entities/project';
import { NETWORK_IDS } from '../src/provider';
import { ENVIRONMENTS } from '../src/utils/utils';
import { Project } from '../src/entities/project.js';
import { NETWORK_IDS } from '../src/provider.js';
import { ENVIRONMENTS } from '../src/utils/utils.js';

const insertRelatedAddress = async (params: {
queryRunner: QueryRunner;
Expand Down
6 changes: 3 additions & 3 deletions migration/1661116436720-addGoerliTokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import config from '../src/config';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import config from '../src/config.js';

export class addGoerliTokens1661116436720 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
5 changes: 2 additions & 3 deletions migration/1672836674875-createTestAdminUser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const bcrypt = require('bcrypt');
import bcrypt from 'bcrypt';
import config from '../src/config.js';

export class createTestAdminUser1672836674875 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Project, ProjectUpdate } from '../src/entities/project';
import { getHtmlTextSummary } from '../src/utils/utils';
import { Project, ProjectUpdate } from '../src/entities/project.js';
import { getHtmlTextSummary } from '../src/utils/utils.js';

export class FillProjectDescriptionSummaryProjectUpdateContentSummary1676472760533
implements MigrationInterface
Expand Down
6 changes: 3 additions & 3 deletions migration/1677742523974-addPolygonTokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';

export class addGoerliTokens1677742523974 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import { NETWORK_IDS } from '../src/provider.js';

const polygonTokens = [
{
Expand Down
4 changes: 2 additions & 2 deletions migration/1679383446020-addOptimisticNativeToken.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import { NETWORK_IDS } from '../src/provider.js';

const optimisticTokens = [
{
Expand Down
8 changes: 4 additions & 4 deletions migration/1680014857601-addCeloTokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import config from '../src/config';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import config from '../src/config.js';
import { NETWORK_IDS } from '../src/provider.js';

export class addCeloTokens1680014857601 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions migration/1680507337701-add_some_donations_to_db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import moment from 'moment';
import config from '../src/config';
import { Donation } from '../src/entities/donation';
import { NETWORK_IDS } from '../src/provider';
import config from '../src/config.js';
import { Donation } from '../src/entities/donation.js';
import { NETWORK_IDS } from '../src/provider.js';

// For seeing donations detail you can see this message ( if you have access to channel)
// https://discord.com/channels/679428761438912522/928813033600475207/1089868809302724618
Expand Down
4 changes: 2 additions & 2 deletions migration/1680539882510-TransformBase64ImagesToIpfs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Like, MigrationInterface, QueryRunner } from 'typeorm';
import { Project, ProjectUpdate } from '../src/entities/project';
import { changeBase64ToIpfsImageInHTML } from '../src/utils/documents';
import { Project, ProjectUpdate } from '../src/entities/project.js';
import { changeBase64ToIpfsImageInHTML } from '../src/utils/documents.js';

export class TransformBase64ImagesToIpfs1680539882510
implements MigrationInterface
Expand Down
9 changes: 4 additions & 5 deletions migration/1681125863016-create_some_test_admi_users.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import { generateRandomEtheriumAddress } from '../test/testUtils';
import { UserRole } from '../src/entities/user';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const bcrypt = require('bcrypt');
import bcrypt from 'bcrypt';
import config from '../src/config.js';
import { generateRandomEtheriumAddress } from '../test/testUtils.js';
import { UserRole } from '../src/entities/user.js';

export class createSomeTestAdmiUsers1681125863016
implements MigrationInterface
Expand Down
6 changes: 3 additions & 3 deletions migration/1683008685487-AddOptimisticTokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';

export class AddOptimisticTokens1683008685487 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
18 changes: 9 additions & 9 deletions migration/1684654545845-add_some_mainnet_donations.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import moment from 'moment';
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import { Donation } from '../src/entities/donation';
import { NETWORK_IDS } from '../src/provider';
import config from '../src/config.js';
import { Donation } from '../src/entities/donation.js';
import { NETWORK_IDS } from '../src/provider.js';
import {
updateUserTotalDonated,
updateUserTotalReceived,
} from '../src/services/userService';
import { findProjectById } from '../src/repositories/projectRepository';
import { Project } from '../src/entities/project';
import { calculateGivbackFactor } from '../src/services/givbackService';
import { AppDataSource } from '../src/orm';
import { updateProjectStatistics } from '../src/services/projectService';
} from '../src/services/userService.js';
import { findProjectById } from '../src/repositories/projectRepository.js';
import { Project } from '../src/entities/project.js';
import { calculateGivbackFactor } from '../src/services/givbackService.js';
import { AppDataSource } from '../src/orm.js';
import { updateProjectStatistics } from '../src/services/projectService.js';

const fromWalletAddress = '0x6bed0ce7be8dc307b69cfdc100f87db51bc3823a';
const txHash =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import config from '../src/config.js';

export class AddEligibleNetworksToPreviousQfRounds1694635872128
implements MigrationInterface
Expand Down
6 changes: 3 additions & 3 deletions migration/1696421249294-Add_ETC_Tokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';

export class AddETCTokens1696421249294 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions migration/1696842672748-add_glo_stable_coin_token.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token';
import { NETWORK_IDS } from '../src/provider.js';
import { Token } from '../src/entities/token.js';

const newTokens = [
{
Expand Down
18 changes: 9 additions & 9 deletions migration/1696918830123-add_octant_donations_to_db.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import moment from 'moment';
import config from '../src/config';
import { AppDataSource } from '../src/orm';
import { findProjectById } from '../src/repositories/projectRepository';
import { Project } from '../src/entities/project';
import { calculateGivbackFactor } from '../src/services/givbackService';
import config from '../src/config.js';
import { AppDataSource } from '../src/orm.js';
import { findProjectById } from '../src/repositories/projectRepository.js';
import { Project } from '../src/entities/project.js';
import { calculateGivbackFactor } from '../src/services/givbackService.js';
import {
updateUserTotalDonated,
updateUserTotalReceived,
} from '../src/services/userService';
import { Donation } from '../src/entities/donation';
import { NETWORK_IDS } from '../src/provider';
import { updateProjectStatistics } from '../src/services/projectService';
} from '../src/services/userService.js';
import { Donation } from '../src/entities/donation.js';
import { NETWORK_IDS } from '../src/provider.js';
import { updateProjectStatistics } from '../src/services/projectService.js';

const octantDonationTxHash =
'0xe70a8ee39511d3c186ea53c4bdd9fcd34f658d68ca7e1bbbc2b231630ac7fa3b';
Expand Down
8 changes: 4 additions & 4 deletions migration/1697028245800-add_mordor_etc_testnet_tokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import config from '../src/config';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';
import config from '../src/config.js';

export class addMordorEtcTestnetTokens1697028245800
implements MigrationInterface
Expand Down
12 changes: 6 additions & 6 deletions migration/1703044586989-addSolanaToken.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import seedTokens from './data/seedTokens';
import { ChainType } from '../src/types/network';
import { SOLANA_SYSTEM_PROGRAM } from '../src/utils/networks';
import { ENVIRONMENTS } from '../src/utils/utils';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens.js';
import { ChainType } from '../src/types/network.js';
import { SOLANA_SYSTEM_PROGRAM } from '../src/utils/networks.js';
import { ENVIRONMENTS } from '../src/utils/utils.js';
import { NETWORK_IDS } from '../src/provider.js';
import { Token } from '../src/entities/token.js';

export class addSolanaToken1703044586989 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
20 changes: 10 additions & 10 deletions migration/1703398409668-add_missed_op_donations_to_db.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import moment from 'moment';
import config from '../src/config';
import { AppDataSource } from '../src/orm';
import { findProjectById } from '../src/repositories/projectRepository';
import { Project } from '../src/entities/project';
import { calculateGivbackFactor } from '../src/services/givbackService';
import config from '../src/config.js';
import { AppDataSource } from '../src/orm.js';
import { findProjectById } from '../src/repositories/projectRepository.js';
import { Project } from '../src/entities/project.js';
import { calculateGivbackFactor } from '../src/services/givbackService.js';
import {
updateUserTotalDonated,
updateUserTotalReceived,
} from '../src/services/userService';
import { Donation } from '../src/entities/donation';
import { NETWORK_IDS } from '../src/provider';
import { refreshProjectEstimatedMatchingView } from '../src/services/projectViewsService';
import { updateProjectStatistics } from '../src/services/projectService';
} from '../src/services/userService.js';
import { Donation } from '../src/entities/donation.js';
import { NETWORK_IDS } from '../src/provider.js';
import { refreshProjectEstimatedMatchingView } from '../src/services/projectViewsService.js';
import { updateProjectStatistics } from '../src/services/projectService.js';

const QF_ROUND_ID = 5;
const millisecondTimestampToDate = (timestamp: number): Date => {
Expand Down
12 changes: 6 additions & 6 deletions migration/1704487070444-addSolanaSplTokens.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import { ChainType } from '../src/types/network';
import { SOLANA_SYSTEM_PROGRAM } from '../src/utils/networks';
import { ENVIRONMENTS } from '../src/utils/utils';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';
import { ChainType } from '../src/types/network.js';
import { SOLANA_SYSTEM_PROGRAM } from '../src/utils/networks.js';
import { ENVIRONMENTS } from '../src/utils/utils.js';

export class addSolanaSplTokens1704487070444 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
6 changes: 3 additions & 3 deletions migration/1706820821887-addmpEthToDatabaseTokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { NETWORK_IDS } from '../src/provider';
import { ChainType } from '../src/types/network';
import { Token } from '../src/entities/token';
import { NETWORK_IDS } from '../src/provider.js';
import { ChainType } from '../src/types/network.js';
import { Token } from '../src/entities/token.js';

const mpEthTokens = [
{
Expand Down
8 changes: 4 additions & 4 deletions migration/1708279692128-addArbitrumTokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import config from '../src/config';
import { NETWORK_IDS } from '../src/provider';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import config from '../src/config.js';
import { NETWORK_IDS } from '../src/provider.js';

export class AddArbitrumTokens1708279692128 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
Expand Down
9 changes: 5 additions & 4 deletions migration/1708954413087-addOptimismSepoliaTokens.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { Token } from '../src/entities/token';
import seedTokens from './data/seedTokens';
import { NETWORK_IDS } from '../src/provider';
import config from '../src/config';
import { Token } from '../src/entities/token.js';
import seedTokens from './data/seedTokens.js';
import { NETWORK_IDS } from '../src/provider.js';
import config from '../src/config.js';

export class AddOptimismSepoliaTokens1708954413087
implements MigrationInterface
{
Expand Down
6 changes: 3 additions & 3 deletions migration/1709204568033-addCoingeckoId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import config from '../src/config';
import { Token } from '../src/entities/token';
import { ChainType } from '../src/types/network';
import config from '../src/config.js';
import { Token } from '../src/entities/token.js';
import { ChainType } from '../src/types/network.js';

type TokenData = {
networkId: number;
Expand Down
Loading