Unverified Commit a5e8cd11 authored by yannickjacqueline's avatar yannickjacqueline Committed by GitHub
Browse files

feat: intégration de la lib métier (#750)

parent 6eef2025
name: Publish library
on:
push:
branches:
- 'develop'
paths:
- 'lib/**'
- '.github/workflows/lib-publish.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: yarn
- name: Installing
run: yarn --frozen-lockfile --link-duplicates --perfer-offline
- name: Yarn build
run: yarn build
release:
needs:
- build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: yarn
- name: Installing
run: yarn --frozen-lockfile --link-duplicates --perfer-offline
- name: Semantic Release
if: |
github.event_name == 'push'
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/exec
@semantic-release/git
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}
{
"eslint.workingDirectories": ["front", "back"],
"eslint.workingDirectories": ["front", "back", "lib"],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
......
{
"extends": ["@socialgouv/eslint-config-typescript"],
"rules": {
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-duplicate-imports": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/comma-dangle": "off"
},
"ignorePatterns": [".eslintrc.js"]
}
# OSX
#
.DS_Store
# Visual Studio Code
#
.vscode/
# node.js
#
node_modules/
# Build package
#
/lib
# Env
#
.env
# Sonar & Coverage
#
test-report.xml
coverage
.scannerwork
image: node:latest
before_script:
- yarn install
cache:
paths:
- node_modules/
build:
stage: build
script:
- yarn build
# Nos 1000 jours Lib package
Cette librairie est utilisée pour regrouper le code métier du projet 1000 jours, et est utilisée par l'application mobile ainsi que le site web pro.
{
"name": "@socialgouv/nos1000jours-lib",
"version": "0.0.1",
"description": "Librairie partagé pour l'application Nos 1000 premiers jours",
"files": [
"lib/**/*"
],
"publishConfig": {
"access": "public"
},
"license": "Apache-2.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc",
"format": "prettier --write \"./src/**/*.ts\" \"./__tests__/**/*.ts\"",
"lint": "eslint .",
"lint-fix": "eslint --fix .",
"prepare": "yarn build"
},
"repository": {
"type": "git",
"url": "https://github.com/SocialGouv/nos1000jours-lib.git"
},
"keywords": [],
"author": "Incubateur des Ministères Sociaux <dsi-incubateur@sg.social.gouv.fr> (https://incubateur.social.gouv.fr)",
"devDependencies": {
"@socialgouv/eslint-config-typescript": "^1.85.4",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"prettier": "^2.3.2",
"typescript": "^4.4.2",
"jest": "^27.1.0"
}
}
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>SocialGouv/renovate-config"
]
}
export const EPDS_GET_SURVEY = `
query QuestionsReponses {
questionnaireEpds(sort: "ordre") {
ordre
libelle
reponse_1_libelle
reponse_1_points
reponse_2_libelle
reponse_2_points
reponse_3_libelle
reponse_3_points
reponse_4_libelle
reponse_4_points
}
}
`;
export const EPDS_ADD_SURVEY_RESULTS = `
mutation (
$genre: ENUM_REPONSESEPDS_GENRE!
$compteur: Int!
$score: Int!
$reponseNum1: Int!
$reponseNum2: Int!
$reponseNum3: Int!
$reponseNum4: Int!
$reponseNum5: Int!
$reponseNum6: Int!
$reponseNum7: Int!
$reponseNum8: Int!
$reponseNum9: Int!
$reponseNum10: Int!
) {
createReponsesEpd(
input: {
data: {
genre: $genre
compteur: $compteur
score: $score
reponse_1: $reponseNum1
reponse_2: $reponseNum2
reponse_3: $reponseNum3
reponse_4: $reponseNum4
reponse_5: $reponseNum5
reponse_6: $reponseNum6
reponse_7: $reponseNum7
reponse_8: $reponseNum8
reponse_9: $reponseNum9
reponse_10: $reponseNum10
}
}
) {
reponsesEpd {
id
created_at
}
}
}
`;
export const EPDS_SEND_CONTACT_INFORMATION = `
mutation (
$email: String!
$telephone: String
$prenom: String!
$nombreEnfants: Int!
$naissanceDernierEnfant: String!
) {
epdsContact(
email: $email
telephone: $telephone
prenom: $prenom
nombre_enfants: $nombreEnfants
naissance_dernier_enfant: $naissanceDernierEnfant
)
}
`;
export const AROUNDME_FILTER_DATA = `
query {
etapes(sort: "id") {
nom
}
cartographieTypes(sort: "nom") {
nom
categorie
}
}
`;
export const GET_POIS_COUNT_BY_GPSCOORDS = `
query PoisCountByGPSCoords(
$long1: Float!
$lat1: Float!
$long2: Float!
$lat2: Float!
$types: [String!]
$etapes: [String!]
) {
searchPoisCount(
perimetre: [$long1, $lat1, $long2, $lat2]
types: $types
etapes: $etapes
)
}
`;
export const GET_POIS_BY_GPSCOORDS = `
query PoisByGPSCoords(
$long1: Float!
$lat1: Float!
$long2: Float!
$lat2: Float!
$types: [String!]
$etapes: [String!]
) {
searchPois(
perimetre: [$long1, $lat1, $long2, $lat2]
types: $types
etapes: $etapes
) {
nom
type
categorie
telephone
courriel
site_internet
adresse
code_postal
commune
position_longitude
position_latitude
}
}
`;
export const ARTICLE_GET_STEP_ARTICLES = (stepId: string): string => `
query GetStepArticles {
articles(sort: "ordre", where: {
etapes: { id: ${stepId} }
})
{
id
titre
resume
visuel {
url
height
width
}
thematiques {
nom
id
}
}
}
`;
import {
AROUNDME_FILTER_DATA,
ARTICLE_GET_STEP_ARTICLES,
EPDS_ADD_SURVEY_RESULTS,
EPDS_GET_SURVEY,
EPDS_SEND_CONTACT_INFORMATION,
GET_POIS_BY_GPSCOORDS,
GET_POIS_COUNT_BY_GPSCOORDS,
} from "./databaseQueries/databaseQueries.constants";
import { Article, Thematique, Visuel } from "./models/article/article";
import { EpdsGender } from "./models/epds/constants";
import { PoiCategorieEnum, PoiTypeEnum } from "./models/poi/constants";
import { Poi, PoisCount, PoiType, Step } from "./models/poi/poi";
export {
AROUNDME_FILTER_DATA,
Article,
ARTICLE_GET_STEP_ARTICLES,
EPDS_ADD_SURVEY_RESULTS,
EPDS_GET_SURVEY,
EPDS_SEND_CONTACT_INFORMATION,
EpdsGender,
GET_POIS_BY_GPSCOORDS,
GET_POIS_COUNT_BY_GPSCOORDS,
Poi,
PoiCategorieEnum,
PoisCount,
PoiType,
PoiTypeEnum,
Step,
Thematique,
Visuel,
};
export interface Article {
id: number;
titre: string;
resume: string;
texteTitre1: string;
texte1: string;
texteTitre2: string;
texte2: string;
leSaviezVous: string;
enbrefTexte1: string;
enbrefTexte2: string;
enbrefTexte3: string;
enbrefIcone1: string;
enbrefIcone2: string;
enbrefIcone3: string;
lienTitre1: string;
lienTitre2: string;
lienTitre3: string;
lienTitre4: string;
lienUrl1: string;
lienUrl2: string;
lienUrl3: string;
lienUrl4: string;
visuel?: Visuel;
thematiques: Thematique[];
hide?: boolean;
}
export interface Visuel {
url: string;
height: number;
width: number;
}
export interface Thematique {
id: number;
nom: string;
}
export enum EpdsGender {
masculin = "Masculin",
feminin = "Feminin",
nonBinaire = "Nonbinaire",
inconnu = "Inconnu",
}
/* eslint-disable @typescript-eslint/naming-convention */
export interface EpdsSurvey {
id: number;
locale: string;
ordre: number;
libelle: string;
reponse_1_libelle: string;
reponse_1_points: number;
reponse_2_libelle: string;
reponse_2_points: number;
reponse_3_libelle: string;
reponse_3_points: number;
reponse_4_libelle: string;
reponse_4_points: number;
}
/* eslint-disable @typescript-eslint/naming-convention */
export enum PoiTypeEnum {
planning_familial = "planning_familial",
maison_de_naissance = "maison_de_naissance",
maternite = "maternite",
pmi = "pmi", // pas d'icône
saad = "saad",
cpam = "cpam", // pas d'icône
caf = "caf", // pas d'icône
mairie = "mairie", // pas d'icône
}
export enum PoiCategorieEnum {
structure = "structure",
professionnel = "professionnel",
}
/* eslint-disable @typescript-eslint/naming-convention */
import type { PoiCategorieEnum, PoiTypeEnum } from "./constants";
export interface Poi {
id: number;
categorie: PoiCategorieEnum;
type: PoiTypeEnum;
nom: string;
telephone?: string;
courriel?: string;
site_internet?: string;
adresse: string;
code_postal: number;
commune: string;
position_latitude: number;
position_longitude: number;
}
export interface PoisCount {
count: number;
}
export interface PoiType {
nom: string;
categorie: string;
}
export interface Step {
nom: string;
}
{
"compilerOptions": {
/* Basic Options */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"es6"
] /* Specify library files to be included in the compilation. */,
"allowJs": true /* Allow javascript files to be compiled. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"outDir": "./lib" /* Redirect output structure to the directory. */,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment