Skip to content

Commit 79d1d1d

Browse files
authored
Merge pull request #182 from topcoder-platform/feature/project_activity
Feature/project activity
2 parents ff81315 + 8b2f292 commit 79d1d1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2994
-319
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
# Created by https://www.gitignore.io/api/node
33
config/local.js
4+
# can be used locally to config some env variables and after apply them using `source .env`
5+
.env
46
### Node ###
57
# Logs
68
logs

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Microservice to manage CRUD operations for all things Projects.
1818
Copy config/sample.local.js as config/local.js, update the properties and according to your env setup
1919

2020
#### Database
21-
Once you start your PostgreSQL database through docker, it will create a projectsDB.
21+
Once you start your PostgreSQL database through docker, it will create a projectsdb.
2222
*To create tables - note this will drop tables if they already exist*
2323
```
2424
NODE_ENV=development npm run sync:db
@@ -40,6 +40,33 @@ Run `npm run sync:es` from the root of project to execute the script.
4040
4141
**NOTE**: In production these dependencies / services are hosted & managed outside tc-projects-service.
4242

43+
#### Kafka
44+
Kafka must be installed and configured prior starting the application.
45+
Following topics must be created:
46+
```
47+
notifications.connect.project.updated
48+
notifications.connect.project.files.updated
49+
notifications.connect.project.team.updated
50+
notifications.connect.project.plan.updated
51+
notifications.connect.project.topic.created
52+
notifications.connect.project.topic.updated
53+
notifications.connect.project.post.created
54+
notifications.connect.project.post.edited
55+
```
56+
57+
New Kafka related configuration options has been introduced:
58+
```
59+
"kafkaConfig": {
60+
"hosts": List of Kafka brokers. Default: localhost: 9092
61+
"clientCert": SSL certificate
62+
"clientCertKey": Certificate key
63+
}
64+
```
65+
Environment variables:
66+
KAFKA_HOSTS - same as "hosts"
67+
KAFKA_CLIENT_CERT - same as "clientCert"
68+
KAFKA_CLIENT_CERT_KEY - same as "clientCertKey"
69+
4370
### Test
4471

4572
Each of the individual modules/services are unit tested.

config/custom-environment-variables.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
"maxPoolSize": "DB_MAX_POOL_SIZE",
3030
"minPoolSize": "DB_MIN_POOL_SIZE"
3131
},
32+
"kafkaConfig": {
33+
"hosts": "KAFKA_HOSTS",
34+
"clientCert": "KAFKA_CLIENT_CERT",
35+
"clientCertKey": "KAFKA_CLIENT_CERT_KEY"
36+
},
3237
"analyticsKey": "SEGMENT_ANALYTICS_KEY",
3338
"VALID_ISSUERS": "VALID_ISSUERS",
3439
"jwksUri": "JWKS_URI",

config/default.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
"minPoolSize": 4,
3434
"idleTimeout": 1000
3535
},
36+
"kafkaConfig": {
37+
},
3638
"analyticsKey": "",
3739
"VALID_ISSUERS": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]",
3840
"validIssuers": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--
2+
-- UPDATE EXISTING TABLES:
3+
-- projects:
4+
-- added column `lastActivityAt`
5+
-- added column `lastActivityUserId`
6+
7+
--
8+
-- projects
9+
10+
-- Add new columns
11+
ALTER TABLE projects ADD COLUMN "lastActivityAt" timestamp with time zone;
12+
ALTER TABLE projects ADD COLUMN "lastActivityUserId" character varying(45);
13+
-- Update new colums
14+
UPDATE projects SET "lastActivityAt"="updatedAt" WHERE "lastActivityAt" is NULL;
15+
UPDATE projects SET "lastActivityUserId"=cast("updatedBy" as varchar) WHERE "lastActivityUserId" is NULL;
16+
-- Set not null
17+
ALTER TABLE projects ALTER COLUMN "lastActivityAt" SET NOT NULL;
18+
ALTER TABLE projects ALTER COLUMN "lastActivityUserId" SET NOT NULL;

migrations/elasticsearch_sync.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,13 @@ function getRequestBody(indexName) {
281281
updatedBy: {
282282
type: 'integer',
283283
},
284+
lastActivityAt: {
285+
type: 'date',
286+
format: 'strict_date_optional_time||epoch_millis',
287+
},
288+
lastActivityUserId: {
289+
type: 'string',
290+
},
284291
utm: {
285292
properties: {
286293
campaign: {

0 commit comments

Comments
 (0)