Skip to content

Commit deab0d3

Browse files
committed
Topcoder Project Service - Import and Export Data version 1.0
1 parent 23b9374 commit deab0d3

21 files changed

+2674
-1186
lines changed

README.md

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ Microservice to manage CRUD operations for all things Projects.
44

55
**Note : Steps mentioned below are best to our capability as guide for local deployment, however, we expect from contributor, being a developer, to resolve run-time issues (e.g. OS and node version issues etc), if any.**
66

7-
- [Local Development](#local-development)
8-
- [Requirements](#requirements)
9-
- [Steps to run locally](#steps-to-run-locally)
10-
- [Import sample metadata projects](#import-sample-metadata-projects)
11-
- [Run Connect App with Project Service locally](#run-connect-app-with-project-service-locally)
12-
- [Test](#test)
13-
- [JWT Authentication](#jwt-authentication)
14-
- [Deploying with docker (might need updates)](#deploying-with-docker-might-need-updates)
15-
- [Kafka commands](#kafka-commands)
16-
- [Create Topic](#create-topic)
17-
- [List Topics](#list-topics)
18-
- [Watch Topic](#watch-topic)
19-
- [Post Message to Topic (from stdin)](#post-message-to-topic-from-stdin)
20-
- [References](#references)
7+
- [Topcoder Projects Service](#topcoder-projects-service)
8+
- [Local Development](#local-development)
9+
- [Requirements](#requirements)
10+
- [Steps to run locally](#steps-to-run-locally)
11+
- [Export database to json file](#export-database-to-json-file)
12+
- [Import database from json file, and index it](#import-database-from-json-file-and-index-it)
13+
- [Import sample metadata projects(Using projects service apis)](#import-sample-metadata-projectsusing-projects-service-apis)
14+
- [Run Connect App with Project Service locally](#run-connect-app-with-project-service-locally)
15+
- [Test](#test)
16+
- [JWT Authentication](#jwt-authentication)
17+
- [Deploying with docker (might need updates)](#deploying-with-docker-might-need-updates)
18+
- [Kafka commands](#kafka-commands)
19+
- [Create Topic](#create-topic)
20+
- [List Topics](#list-topics)
21+
- [Watch Topic](#watch-topic)
22+
- [Post Message to Topic (from stdin)](#post-message-to-topic-from-stdin)
23+
- [References](#references)
2124

2225
## Local Development
2326

@@ -180,7 +183,34 @@ Local setup should work good on **Linux** and **macOS**. But **Windows** is not
180183
npm run startKafkaConsumers:dev
181184
```
182185
183-
### Import sample metadata projects
186+
### Export database to json file
187+
188+
To export data of certain models from database to json file.
189+
190+
`npm run data:export -- --file path/to-file.json`
191+
192+
List of models that will be exported is defined in `scripts/data/dataModels.js`. You can add new models to this list,
193+
but make sure that new models are added to list such that each model comes after its dependencies.
194+
195+
When we run `npm run data:export` without specifying json file , data will be exported to `data/demo-data.json`.
196+
197+
### Import database from json file, and index it
198+
199+
To import data of certain models from file to database, and create ES indices.
200+
201+
`npm run data:import -- --file path/to-file.json`
202+
203+
List of models that will be imported is defined in `scripts/data/dataModels.js`. You can add new models to this list,
204+
but make sure that new models are added to list such that each model comes after its dependencies.
205+
206+
When we run `npm run data:import` without specifying json file , data will be imported from `data/demo-data.json`.
207+
There is sample file located at `data/demo-data.json` that can used to import and index sample data.
208+
209+
Because this commands calls topcoder services to get data like members details, so you have to set environment variables AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, AUTH0_URL, AUTH0_AUDIENCE, AUTH0_PROXY_SERVER_URL
210+
211+
If you encounter conflicts errors, you may need to clear database using `npm run sync:db`, and clear ES (Elasticsearch) indices using `NODE_ENV=development npm run sync:es`
212+
213+
### Import sample metadata projects(Using projects service apis)
184214
185215
```bash
186216
CONNECT_USER_TOKEN=<connect user token> npm run demo-data

data/demo-data.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)