Skip to content

Commit

Permalink
Skills update (#169)
Browse files Browse the repository at this point in the history
* 🗃️ Add verified column to Skill table

* 🗃️ Add init scripts for referential data

* 🗃️ Adding Skill / Tag relationship init

* 🗃️ Adding unicity constraint on skill/tag combo

* 🗃️ Add init scripts for topics + type column

* 🗃️ Idempotence on Category seeding

* 🗃️ Separating local_seeding from referential seeding

* 🗃️ Created the skill to topic mapping

* 🗃️ Update skill topics

* 🗃️ Update skill topics

* 🗃️🐛 Inserting data works better when the table actually exists :)

* 🔒 overriding dep for underscore,upgrading sharp (#160)

* 🔒 overriding dep for underscore,upgrading sharp

* 🔧 upgrade node in ci

* 🔧 upgrading graphql to fix peer dependency conflict

* 🔧 Updating deps

Co-authored-by: Hugo Wood <[email protected]>

* 📦 Updating hasura engine (#165)

* 📦 Hasura update (#167)

* 📦 Updating hasura engine

* 📦 Updating node images for CI build

* 📦 Updating circleci build script

* 📦 Lowering to have matching nodes alogn the build script

* 🌐 Upodated localisations (#168)

* 🔧 This file is weirdly needed by migration generation from Hasura

Co-authored-by: Pierre Nicoli <[email protected]>
Co-authored-by: Nicolas Delsaux <[email protected]>
Co-authored-by: Hugo Wood <[email protected]>
  • Loading branch information
4 people authored Jul 17, 2022
1 parent 83c997c commit 4b47967
Show file tree
Hide file tree
Showing 24 changed files with 1,565 additions and 333 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,34 @@ Start by running `docker compose up -d` to launch the postgres database and the
Check that engine is running by going to `http://localhost:8080` (do not modify schemas through this URL).

### Run the hasura migrations

Run `npm run hasura migrate apply` (schemas setup) and `npm run hasura metadata apply` (graphql setup) to apply migrations and metadatas
In order to initialize / update the database run :
```
# npm run hasura migrate apply # Sets up the schema
# npm run hasura metadata apply # Sets up GraphQL
# npm run hasura seed apply # Optional : seeds/cleans up the database with referential data
```

Connect to the Hasura console by running `npm run hasura console` (it should open the console in your browser with the correct port (to keep track of schema changes in the hasura/migrations folder)).

Browse to the `Data` tab in the console and select the `User` table.
Create your own Zenika user (its email should match your login email).

### Develop with hasura
For hasura to generate the migration files properly the hasura console must be run apart from the "in-app" hasura engine and console.
```
# npm install --global hasura-cli # Installs the hasura console globally
# cd ./hasura # Go into the hasura folder to reuse the config.yaml
# hasura console # Runs the "other" hasura console on a different port
```

### Launch the app

Run the dev server using `npm run dev`.
The application should be available at the URL specified in your .env.local file under `NEXT_PUBLIC_BASE_URL`.

### Generate seeds
### Generate local seeds

If you want to generate random seed data, you can use the hasura console to export the Skill table to JSON
Then move it to `hasura/seeds/Skill.json`
Then move it to `hasura/local_seeds/Skill.json`
You can now run `npm run seeds:generate`
And `npm run seeds:apply` to apply the random data to the database
File renamed without changes.
24 changes: 18 additions & 6 deletions hasura/seeds/Agency.json → hasura/local_seeds/Agency.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@
{
"name": "Nantes"
},
{
"name": "Singapore"
},
{
"name": "Bordeaux"
},
{
"name": "Brest"
},
{
"name": "Montreal"
},
{
"name": "Grenoble"
},
Expand All @@ -28,5 +22,23 @@
},
{
"name": "Lille"
},
{
"name": "Niort"
},
{
"name": "Clermont-Ferrand"
},
{
"name": "Singapore"
},
{
"name": "Montreal"
},
{
"name": "Toronto"
},
{
"name": "Casablanca"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
{
"index": 1,
"color": "yellow",
"label": "languages-and-frameworks",
"label": "practices",
"x": "left",
"y": "top",
"id": "89780de3-4a4c-40c2-bcdf-b5d15a48437a"
},
{
"index": 2,
"color": "violet",
"label": "platforms",
"label": "activities",
"x": "right",
"y": "top",
"id": "06420261-3e78-4a91-bc6a-1a52cad5d6a1"
},
{
"index": 3,
"color": "blue",
"label": "tools",
"label": "knowledge",
"x": "left",
"y": "bot",
"id": "c3341edb-3c1f-4e3d-bf89-8e795eb13690"
},
{
"index": 4,
"color": "cyan",
"label": "technics-and-methods",
"label": "behaviors",
"x": "right",
"y": "bot",
"id": "89f5e9a5-5ce6-416c-bed9-dd736546aa7f"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Skill = { id: string; name: string; categoryId: string };

const agencies: Agency[] = require("./Agency.json");
const categories = require("./Category.json");
const tags: Skill[] = require("./Tag.json");
const skills: Skill[] = require("./Skill.json");
const topics = require("./Topic.json");

Expand Down Expand Up @@ -134,6 +135,6 @@ ${userAgenciesInsertQuery.query}
${userSkillsInsertQuery.query}`;

(async () => {
await writeFile("./hasura/seeds/seeds.sql", result);
console.log("Seeds succesfully generated into hasura/seeds/seeds.sql file");
await writeFile("./hasura/local_seeds/seeds.sql", result);
console.log("Seeds succesfully generated into hasura/local_seeds/seeds.sql file");
})();
1 change: 1 addition & 0 deletions hasura/metadata/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions hasura/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
- table:
schema: public
name: SkillTag
- table:
schema: public
name: SkillTopic
- table:
schema: public
name: Tag
Expand Down
Loading

0 comments on commit 4b47967

Please sign in to comment.