Skip to content

Instantly share code, notes, and snippets.

Stop prod API

scalingo --app trackdechets-production-api scale web:0:L

Start a one-off container

scalingo --app trackdechets-production-api run bash
@benoitguigal
benoitguigal / workflow.ts
Last active June 28, 2021 09:34
automatic workflow
import { userWithCompanyFactory } from "../../../__tests__/factories";
import makeClient from "../../../__tests__/testClient";
import fs from "fs";
const workflow = {
title: "Acheminement direct du producteur à l'installation de traitement",
actors: ["producer"],
steps: [
{
description: "Le producteur de déchet crée le bordereau",
import React, { useRef, useEffect, ReactNode } from "react";
import styles from "./Modal.module.scss";
type Props = {
display: boolean;
close: () => void;
children: ReactNode;
};
/**
PASS src/__tests__/oauth2.integration.ts (17.034s, 648 MB heap size)
PASS src/forms/__tests__/wasteReceive.integration.ts (48.689s, 679 MB heap size)
PASS src/forms/mutations/__tests__/appendix2-mark-as-received-processed.integration.ts (16.184s, 719 MB heap size)
FAIL src/forms/mutations/__tests__/save-form.integration.ts (71.288s, 697 MB heap size)
PASS src/forms/__tests__/formsLifeCycle.integration.ts (42.038s, 715 MB heap size)
PASS src/companies/queries/__tests__/companyInfos.integration.ts (22.188s, 748 MB heap size)
PASS src/forms/mutations/__tests__/mark-as-sent.integration.ts (16.584s, 794 MB heap size)
PASS src/__tests__/auth.integration.ts (43.171s, 821 MB heap size)
PASS src/users/bulk-creation/__tests__/bulk-create.integration.ts (36.463s, 851 MB heap size)
PASS src/forms/mutations/__tests__/mark-as-sealed.integration.ts (14.554s, 887 MB heap size)
<script src="https://unpkg.com/mermaid@8.0.0/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
Le diagramme ci dessous retrace le cycle de vie d'un BSD dans Trackdéchets:
<div class="mermaid">
graph TD
subgraph Préparation du BSD
a1(Création d'un BSD) --> b0
subgraph Informations émetteur
@benoitguigal
benoitguigal / test.js
Created March 29, 2020 09:39
jest mock setup
const spyReturns = returnValue => jest.fn(() => returnValue);
describe("scenario", () => {
const setup = (mockOverrides) => {
const mockedFunctions = {
a: spyReturns(true),
b: spyReturns(true),
...mockOverrides
}
return {
@benoitguigal
benoitguigal / server.ts
Last active February 5, 2020 10:06
server.ts
const sentryMiddleware = () =>
sentry<GraphQLContext>({
config: {
dsn: SENTRY_DSN,
environment: NODE_ENV,
integrations: [new CaptureConsole({ levels: ["error"] })]
},
forwardErrors: true,
withScope: (scope, error, context) => {
const reqUser = !!context.user ? context.user.email : "anonymous";
@benoitguigal
benoitguigal / get_me.py
Last active November 20, 2019 14:31
Exemple de requête GraphQL sur l'API Trackdéchets en Python
import os
import json
import requests
# url de l'API de recette
TD_API_URL = "https://api.trackdechets.fr/"
# token passé en variable d'environnement
# recette.trackdechets.fr > Mon Compte > Intégration API > Générer une clé
TOKEN = os.environ["TOKEN"]
@benoitguigal
benoitguigal / here.py
Created August 6, 2019 06:00
get absolute path of directory
here = path.abspath(path.dirname(__file__))
brew services start tomcat
brew services stop tomcat