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

Next Release Aug 2024 #122

Merged
merged 52 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d95526b
add eslint
RamRamez Jul 2, 2024
5a7e13c
add eslint
RamRamez Jul 2, 2024
007f753
add eslint
RamRamez Jul 2, 2024
18976dd
add eslint
RamRamez Jul 2, 2024
8c0aac4
fix eslint errors
RamRamez Jul 2, 2024
16b0e81
remove lock file
RamRamez Jul 2, 2024
8a6ab3a
Merge branch 'refs/heads/staging' into eslint
RamRamez Jul 17, 2024
966fd17
fix eslint errors
RamRamez Jul 17, 2024
10fe752
Change date schema to be compatible with ortto schema
ae2079 Jul 22, 2024
1a469c7
Merge pull request #105 from Giveth/eslint
RamRamez Jul 22, 2024
fe1c9f9
Fix unit test based on changes
ae2079 Jul 22, 2024
c548c78
Pull staging and resolve conflicts
ae2079 Jul 22, 2024
90528ac
Fix lint errors
ae2079 Jul 22, 2024
5eab9eb
Fix lint errors
ae2079 Jul 22, 2024
3a8e70b
change main-pipeline
RamRamez Jul 22, 2024
b530e65
feat: change GivethNotificationTypes seed
Reshzera Jul 22, 2024
c8fe8a6
fix: remove brake line
Reshzera Jul 22, 2024
aa3423a
Merge pull request #108 from Giveth/4194-make-orto-schema-compatible
ae2079 Jul 22, 2024
1922f6e
change Dockerfile
RamRamez Jul 23, 2024
385dd19
change Dockerfile to use yarn
RamRamez Jul 23, 2024
5e2fb97
Merge pull request #111 from Giveth/change-Dockerfile
RamRamez Jul 23, 2024
14a0d7f
remove userId from notify reward amount ortto request
ae2079 Jul 23, 2024
e45646a
Merge pull request #112 from Giveth/4194-make-notification-compatible…
ae2079 Jul 23, 2024
d779dfb
add email to payload for notify reward
ae2079 Jul 24, 2024
c36d275
Fix tests for notify reward
ae2079 Jul 24, 2024
37cfa70
fix: create migration to change givbacks notification
Reshzera Jul 24, 2024
42428dc
Merge pull request #110 from Giveth/feat/issue-2527
Reshzera Jul 24, 2024
64ebbfd
Change scripts to use ts-node for running migrations
ae2079 Jul 30, 2024
9d3823e
Add tsconfig-paths module to application
ae2079 Jul 30, 2024
b2678d6
ensure dataSource initialize before running migrations
ae2079 Jul 31, 2024
4618870
Update packages
ae2079 Jul 31, 2024
c1d245d
Use the previous version of ts
ae2079 Jul 31, 2024
c0e9ce3
Allow ts to resolve json modules
ae2079 Jul 31, 2024
ed56844
Run pretest scripts before test migrations
ae2079 Jul 31, 2024
9c6662d
Make pretest scripts stand alone
ae2079 Jul 31, 2024
6186262
Revert changes on pre-test-scripts.ts
ae2079 Jul 31, 2024
45f2075
remove pre-test-scripts from migration commands
ae2079 Jul 31, 2024
a02e696
downgrade typeorm version to fix migration execution
ae2079 Jul 31, 2024
0b6839d
run migrations using scripts
ae2079 Jul 31, 2024
5018277
Upgrade typeorm version again
ae2079 Jul 31, 2024
db16aa0
add create test database step to the staging-pipeline.yml
ae2079 Aug 1, 2024
5ed076b
add wait for database step to the staging-pipeline.yml
ae2079 Aug 1, 2024
a805727
change database port in the staging-pipeline.yml
ae2079 Aug 1, 2024
135f6d1
change database name in the staging-pipeline.yml and remove redundant…
ae2079 Aug 1, 2024
5a290b8
change database name in the main-pipeline.yml
ae2079 Aug 1, 2024
1436576
Merge pull request #113 from Giveth/fix-migrations-execution-issue
ae2079 Aug 1, 2024
28d21a2
add migration for create Qacc third party
ae2079 Aug 12, 2024
0a22290
Merge pull request #117 from Giveth/addQaccThirdParty
aminlatifi Aug 12, 2024
ede15cf
support Qacc on Ortto
ae2079 Aug 20, 2024
9ba9425
Add Qacc to microServices
ae2079 Aug 20, 2024
6d73ff7
Merge pull request #119 from Giveth/supportQaccOnOrtto
ae2079 Aug 20, 2024
b452f6b
Resolve merge conflicts
mohammadranjbarz Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

16 changes: 10 additions & 6 deletions .github/workflows/main-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: givethio
POSTGRES_DB: notification-center
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -43,15 +43,15 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.14.0
node-version: 20.14.0
- name: Install dependencies
run: npm ci
run: yarn install
- name: Run linter
run: npm run lint
run: yarn lint
- name: Run migrations
run: npm run db:migrate:run:test
run: yarn db:migrate:run:test
- name: Run tests
run: npm run test
run: yarn test

publish:
needs: test
Expand All @@ -60,6 +60,10 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Install Yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install
- name: Build image and push to GitHub Packages
uses: docker/build-push-action@v1
with:
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/staging-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: givethio
POSTGRES_DB: notification-center
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -41,15 +41,17 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.14.0
node-version: 20.14.0
- name: Install Yarn
run: npm install -g yarn
- name: Install dependencies
run: npm ci
run: yarn install
- name: Run linter
run: npm run lint
run: yarn lint
- name: Run migrations
run: npm run db:migrate:run:test
run: yarn db:migrate:run:test
- name: Run tests
run: npm run test
run: yarn test

publish:
needs: test
Expand All @@ -58,6 +60,13 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Install Yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn install

- name: Build image and push to GitHub Packages
uses: docker/build-push-action@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#https://hub.docker.com/_/node?tab=tags&page=1
FROM node:18.14.0
FROM node:20.14.0

WORKDIR /usr/src/app

Expand All @@ -10,7 +10,7 @@ COPY src ./src
COPY migrations ./migrations
COPY test ./test

RUN npm ci
RUN npm i -g pm2
RUN npm run build #It will run prebuild script for generating swagger spec by tsoa as well
RUN yarn install --frozen-lockfile
RUN yarn build #It will run prebuild script for generating swagger spec by tsoa as well
RUN cp -rv public ./dist
1 change: 1 addition & 0 deletions config/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ REDIS_PASSWORD=

SEGMENT_API_KEY=FAKE_API_KEY
ORTTO_API_KEY=FAKE_API_KEY
QACC_ORTTO_API_KEY=FAKE_API_KEY
ORTTO_ACTIVITY_API=https://api-us.ortto.app/v1/activities/create

#JWT_AUTHORIZATION_ADAPTER=siweMicroservice
Expand Down
76 changes: 76 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import _import from 'eslint-plugin-import';
import unusedImports from 'eslint-plugin-unused-imports';
import { fixupPluginRules } from '@eslint/compat';
import tsParser from '@typescript-eslint/parser';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['node_modules/*', 'dist/*'],
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
),
{
plugins: {
import: fixupPluginRules(_import),
'unused-imports': unusedImports,
},

languageOptions: {
parser: tsParser,
},

rules: {
'@typescript-eslint/no-explicit-any': 'off',
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],

'prettier/prettier': [
'error',
{
arrowParens: 'avoid',
singleQuote: true,
semi: true,
tabWidth: 2,
useTabs: false,
trailingComma: 'all',
'jsdoc-format': false,
endOfLine: 'auto',
},
],

'import/order': [
'error',
{
groups: [
'builtin',
'external',
['internal', 'parent', 'sibling'],
'index',
'object',
'type',
],
},
],
},
},
];
6 changes: 3 additions & 3 deletions migrations/1678175596807-changeNotificationCopies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { MigrationInterface } from 'typeorm';
import { getNotificationTypeByEventName } from '../src/repositories/notificationTypeRepository';
import { NOTIFICATION_TYPE_NAMES } from '../src/types/general';

Expand All @@ -24,7 +24,7 @@ export class changeNotificationCopies1678175596807
await notificationType.save();
}

public async up(queryRunner: QueryRunner): Promise<void> {
public async up(): Promise<void> {
if (
process.env.NODE_ENV === 'test' ||
process.env.NODE_ENV === 'development'
Expand Down Expand Up @@ -339,7 +339,7 @@ export class changeNotificationCopies1678175596807
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
//
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { MigrationInterface } from 'typeorm';
import { getNotificationTypeByEventName } from '../src/repositories/notificationTypeRepository';
import { NOTIFICATION_TYPE_NAMES } from '../src/types/general';

Expand All @@ -21,7 +21,7 @@ export class changeCancelProjectNotificationCopies1681206838965
await notificationType.save();
}

public async up(queryRunner: QueryRunner): Promise<void> {
public async up(): Promise<void> {
if (
process.env.NODE_ENV === 'test' ||
process.env.NODE_ENV === 'development'
Expand Down Expand Up @@ -84,7 +84,7 @@ export class changeCancelProjectNotificationCopies1681206838965
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
//
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import {
NotificationType,
SCHEMA_VALIDATORS_NAMES,
} from '../src/entities/notificationType';
import { MICRO_SERVICES, THIRD_PARTY_EMAIL_SERVICES } from '../src/utils/utils';
import { MICRO_SERVICES } from '../src/utils/utils';
import {
NOTIFICATION_CATEGORY,
NOTIFICATION_TYPE_NAMES,
} from '../src/types/general';
import { NOTIFICATION_CATEGORY_GROUPS } from '../src/entities/notificationSetting';
import { SegmentEvents } from '../src/services/segment/segmentAnalyticsSingleton';

// https://github.com/Giveth/notification-center/issues/6 , https://gist.github.com/MohammadPCh/24434d50bc9ccd9b74905c271ee05482
// icons https://gist.github.com/MohammadPCh/31e2b750dd9aa54edb21dcc6e7332efb
Expand Down
6 changes: 3 additions & 3 deletions migrations/1692698983844-changeNotificationCopies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { MigrationInterface } from 'typeorm';
import { getNotificationTypeByEventName } from '../src/repositories/notificationTypeRepository';
import { NOTIFICATION_TYPE_NAMES } from '../src/types/general';

Expand All @@ -21,7 +21,7 @@ export class changeNotificationCopies1692698983844
await notificationType.save();
}

public async up(queryRunner: QueryRunner): Promise<void> {
public async up(): Promise<void> {
if (
process.env.NODE_ENV === 'test' ||
process.env.NODE_ENV === 'development'
Expand Down Expand Up @@ -85,7 +85,7 @@ export class changeNotificationCopies1692698983844
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
public async down(): Promise<void> {
//
}
}
44 changes: 23 additions & 21 deletions migrations/1712683625687-addSuperFluidNotificationForAllUsers.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm"
import { MigrationInterface, QueryRunner } from 'typeorm';

export class addSuperFluidNotificationForAllUsers1712683625687 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
// Fetch the notificationTypeIds for the "superfluid" categoryGroup
const notificationTypeIds = await queryRunner.query(`
export class addSuperFluidNotificationForAllUsers1712683625687
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
// Fetch the notificationTypeIds for the "superfluid" categoryGroup
const notificationTypeIds = await queryRunner.query(`
SELECT "id" FROM "notification_type" WHERE "categoryGroup" = 'superfluid';
`);

// Fetch all unique userAddressIds
const userAddressIds = await queryRunner.query(`
// Fetch all unique userAddressIds
const userAddressIds = await queryRunner.query(`
SELECT DISTINCT "userAddressId" FROM "notification_setting";
`);

// For each userAddressId, insert a new row for each notificationTypeId
for (const { userAddressId } of userAddressIds) {
for (const { id: notificationTypeId } of notificationTypeIds) {
await queryRunner.query(`
// For each userAddressId, insert a new row for each notificationTypeId
for (const { userAddressId } of userAddressIds) {
for (const { id: notificationTypeId } of notificationTypeIds) {
await queryRunner.query(`
INSERT INTO "notification_setting" (
"allowNotifications",
"allowEmailNotification",
Expand All @@ -24,22 +26,22 @@ export class addSuperFluidNotificationForAllUsers1712683625687 implements Migrat
"userAddressId"
) VALUES (true, true, true, ${notificationTypeId}, ${userAddressId});
`);
}
}
}
}
}

public async down(queryRunner: QueryRunner): Promise<void> {
// Fetch the notificationTypeIds for the "superfluid" categoryGroup
const notificationTypeIds = await queryRunner.query(`
public async down(queryRunner: QueryRunner): Promise<void> {
// Fetch the notificationTypeIds for the "superfluid" categoryGroup
const notificationTypeIds = await queryRunner.query(`
SELECT "id" FROM "notification_type" WHERE "categoryGroup" = 'superfluid';
`);

// Convert fetched rows to a list of IDs for the IN clause
const ids = notificationTypeIds.map((nt: { id: any; }) => nt.id).join(', ');
// Convert fetched rows to a list of IDs for the IN clause
const ids = notificationTypeIds.map((nt: { id: any }) => nt.id).join(', ');

// Delete the rows with the fetched notificationTypeIds for all userAddressIds
await queryRunner.query(`
// Delete the rows with the fetched notificationTypeIds for all userAddressIds
await queryRunner.query(`
DELETE FROM "notification_setting" WHERE "notificationTypeId" IN (${ids});
`);
}
}
}
Loading
Loading