Commit graph

245 commits

Author SHA1 Message Date
Damien Le Thiec
a51ed0094b Fix tests 2023-02-07 00:28:21 +01:00
Sébastien Carceles
49ce255e29
feat(dossier): prefill region champ (#8442)
* make regions champ prefillable

* add possible and example value

* add external_id and value validation
2023-01-24 11:25:17 +00:00
Damien Le Thiec
962016e32e
Schema graph_ql (#8406)
* First draft schema graph_ql

* Add tests for json schema procedures
2023-01-23 11:31:06 +01:00
Sébastien Carceles
68ddae7382
feat(demarche): prefilling stats (#8436)
* force json content type for POST / PATCH / PUT

* add specs about stats dossiers funnel

* new endpoint to render stats about a procedure
2023-01-20 13:28:02 +00:00
Paul Chavard
8f1ae99413 fix(graphql): remove deprecated options from introspection query 2023-01-20 09:54:50 +01:00
Martin
52380d5249 fix(api): on fixe avec avec des tests le prob de token 2023-01-19 17:40:19 +01:00
Martin
7206f1b298 bug(api): token, not checked 2023-01-19 17:33:19 +01:00
Paul Chavard
b5dc71e975 fix(graphql): demarche with pj should return schema 2023-01-18 18:06:10 +01:00
Paul Chavard
cdb3ce65cb feat(graphql): expose more information on demarche descriptor 2023-01-18 13:46:40 +01:00
Paul Chavard
b663939674 feat(graphql): add demarcheCloner mutation 2023-01-11 23:38:12 +01:00
Paul Chavard
afc1f12028 feat(graphql): implement add/remove instructeurs via API 2023-01-10 20:33:35 +01:00
Sébastien Carceles
177dec2bdb
feat(dossier): add dossier id to prefill response (#8382) 2023-01-06 13:46:27 +00:00
Martin
a4d6692bc6 accessibilite(pages-authentification): evolutions des pages de connexion/creation de compte pour respecter le DSFR et supporter une meilleure accessibilite
Update app/components/dsfr/input_component/input_component.html.haml

Co-authored-by: Colin Darie <colin@darie.eu>
2023-01-03 16:26:05 +01:00
Sébastien Carceles
20136b7ac8
feat(demarche): create and prefill a dossier with POST request (#8233)
* add base controller for public api

* add dossiers controller with basic checks

* create the dossier

* ensure content-type is json

* prefill dossier with given values

* mark a dossier as prefilled

When a dossier is prefilled, it's allowed not to have a user.

Plus, we add a secure token to the dossier, which we will need later to set a
user after sign in / sign up.

* set user as owner of an orphan prefilled dossier

When a visitor comes from the dossier_url answered by the public api,
the dossier is orphan:
- when the user is already authenticated: they become the owner
- when the user is not authenticated: they can sign in / sign up / france_connect
and then they become the owner

So here is the procedure:
- allow to sign in / sign up / france connect when user is unauthenticated
- set dossier ownership when the dossier is orphan
- check dossier ownership when the dossier is not
- redirect to brouillon path when user is signed in and owner

* mark the dossier as prefilled when it's prefilled
(even with a GET request, because it will be useful later on, for
exmample in order to cleanup the unused prefilled dossiers)

* system spec: prefilling dossier with post request
2023-01-03 14:46:10 +01:00
Martin
186d4e6539 correctif(ChampDepartement): gere les departement a 3 codes 2022-12-27 14:55:57 +01:00
Martin
48c80e9387 correctif(api/v1): ajoute la methode manquante for_api sur le type de champs departement 2022-12-27 11:45:43 +01:00
Paul Chavard
4a4ce67ef6 fix(dossier): explicitly send draft notification email 2022-12-26 22:02:33 +00:00
Eric Leroy-Terquem
2645ac85f7 update wording and order in types de champ select 2022-12-16 09:30:36 +01:00
Paul Chavard
52c8fc7e8d feat(api_token): api v2 use new token 2022-12-07 18:19:37 +01:00
Paul Chavard
a47a056ee8 feat(api_token): api v1 use new token 2022-12-07 18:19:37 +01:00
Paul Chavard
73ff739c52 refactor(graphql): extract stored queries spec in a separate file 2022-12-07 12:06:55 +01:00
Colin Darie
4ba76e6844 fix(api-v1): dossier -> avis -> piece_justificative_file_attachment relation name 2022-12-06 11:48:42 +01:00
Colin Darie
1138604748 feat(api): PieceJustificativeChamp: deprecate file in favor of files 2022-12-05 10:47:10 +01:00
Paul Chavard
c5901fbb95 clean(type_de_champ): remove magic factory 2022-12-01 16:36:59 +01:00
Paul Chavard
ee30a95847 fix(graphql): check if tokens are revoked 2022-11-25 16:27:11 +01:00
Paul Chavard
5a9ce7a331 feat(graphql): make demarche schema public 2022-11-24 18:21:33 +01:00
Paul Chavard
234975b806 feat(graphql): expose groupe_instructeur state and update mutation 2022-11-24 14:33:29 +01:00
Paul Chavard
29bdd82b59 refactor(procedure): types_de_champ -> active_revision.types_de_champ_public 2022-11-17 13:54:14 +01:00
Paul Chavard
e6288c39f2 refactor(dossier): champs -> champs_public 2022-11-10 22:44:39 +00:00
Paul Chavard
3ced06d59b feat(graphql): improuve groupe instructeur query 2022-11-04 11:27:58 +00:00
Paul Chavard
5487ce0458 feat(graphql): implement stored queries 2022-11-02 11:26:57 +01:00
Paul Chavard
2ed26e8699 fix(graphql): properly handle variables json parse errors 2022-10-31 11:32:30 +01:00
Martin
1f8bf201a2 feat(procedure_serializer): just add an empty string for direction 2022-10-07 18:39:17 +02:00
Martin
6752da40a9 test(procedure.direction): can we drop this column ? 2022-10-07 18:39:17 +02:00
Paul Chavard
df47f4a7ab feat(graphql): new tokens should carry administrateur_id 2022-09-29 11:58:58 +02:00
Colin Darie
23fbc9210e test(graphql): don't perform irrelevant & unmocked APIEntreprise::ServiceJob
They would require heavy mocks otherwise
2022-09-06 09:23:52 +02:00
Paul Chavard
2d7803cd48 refactor(spec): use new procedure.types_de_champ factory 2022-08-04 12:10:32 +02:00
Paul Chavard
430365768a test(dossier.pdf): add a test case with piece_justificative inside repetition 2022-07-21 11:46:28 +02:00
Paul Chavard
02675a104d fix(revision): fix tests to use new revison system 2022-05-31 08:58:53 +02:00
Paul Chavard
8c6feb1e1f feat(graphql): expose repasser_en_construction and repasser_en_instruction 2022-05-23 18:12:33 +02:00
Paul Chavard
2ba05bfb4f fix(dossier): use depose_at instead of en_construction_at 2021-12-06 15:49:17 +01:00
Pierre de La Morinerie
0a541d678d graphql_controller_spec: create several dossiers only when required
Creating dossiers is faster than creating a procedure, but still slow.
We can create a single dossier in the default case, and only create
several others when the example requires it.

Speeds up this spec from 0m 57s to 0m 49s.
2021-11-03 19:38:01 +01:00
Pierre de La Morinerie
f0e045ad25 graphql_controller_spec: create all types de champs only when required
Creating a procedure with all available types de champ is slow. We can
create a simpler procedure in the default case, and only create all
types de champs when the example requires it.

Speeds up this spec from 1m 55s to 0m 57s.
2021-11-03 19:38:01 +01:00
Pierre de La Morinerie
e02251c0e5 graphql_controller_spec: populate all champs only when required
Creating a dossier with available champs populated is slow. We can
create simpler dossiers in the default case, and only populate all
champs when the example requires it.

Speeds up this spec from 2mn 20s to 1m 55s.
2021-11-03 19:38:01 +01:00
Pierre de La Morinerie
bb1bc9140d graphql_controller_spec: remove unused line 2021-11-03 19:38:01 +01:00
Pierre de La Morinerie
04159056af specs: clarify spec by replacing some context by describe 2021-11-03 19:38:01 +01:00
Pierre de La Morinerie
b06183d7bf specs: rename Dossier's with_all_champs to with_populated_champs
This better reflects what the trait is used for, and disambiguate it
from the similarly named trait in the Procedure factory.
2021-11-03 19:38:01 +01:00
Paul Chavard
74e277d0a2 feat(graphql): add an option to dossier state change mutations to disable notifications 2021-09-07 14:21:48 +02:00
Paul Chavard
9e30d5fc22 fix(virus scan): prevent virus scans in specs 2021-09-07 14:21:48 +02:00
Paul Chavard
1399d9bba9 feat(graphql): expose demarche descriptor on dossier type
We don't want to expose full demarche type on dossiers because it would open the door for recursive queries that we want to avoid. DemarcheDescriptorType is a lightweight representation of demarche metadata.
2021-08-25 11:12:24 +02:00
Paul Chavard
a4482233b8 [GraphQL] expose deleted dossiers 2021-06-24 11:51:37 +02:00
Paul Chavard
990ae10399 GraphQL byte_size should be BigInt 2021-06-03 10:53:17 +02:00
Paul Chavard
866ae256a3 Add revision dossiers filters 2021-03-17 11:53:48 +01:00
Paul Chavard
76aa7bdfe3 Add default nil value for numero_tva_intracommunautaire 2021-03-16 12:57:10 +01:00
Paul Chavard
9ce07be1ee [GraphQL] modifier annotation 2021-02-11 17:45:14 +01:00
Paul Chavard
dc08993a89 Add DateTime champ to GraphQL 2021-01-14 14:08:42 +01:00
Paul Chavard
fed300bfe1 Fix and test ActiveStorage::IntegrityError on upload 2020-12-11 10:30:17 +01:00
Paul Chavard
65d650eba6 Better graphql mutation error messages 2020-12-10 18:35:24 +01:00
Paul Chavard
cac981cf42 fix warning with ruby 2.7 2020-11-25 10:46:34 +01:00
Paul Chavard
b897e0cc1c [GraphQL] add better errors when attachments are not properly used 2020-11-17 12:40:14 +01:00
Paul Chavard
0aa06d0197 [GraphQL] expose dossier pdf, geojson and attestation 2020-10-06 21:54:43 +02:00
Paul Chavard
061a743759 [GraphQL] Add archiver mutation 2020-09-22 08:34:38 +00:00
clemkeirua
005c244438 fixup! add fix for nil values on numeroVoie and typeVoie 2020-09-22 10:17:54 +02:00
clemkeirua
7ba8ab9e6a maj du schema json 2020-09-22 10:14:55 +02:00
clemkeirua
412a87e532 add fix for nil values on numeroVoie and typeVoie 2020-09-22 09:43:44 +02:00
clemkeirua
1173f1e459 add default values when nil 2020-09-22 09:43:44 +02:00
clemkeirua
adb2a91640 add a broken test case 2020-09-22 09:43:44 +02:00
clemkeirua
4c17acf349 ajout du code effectif entreprise dans une spec graphql nominale 2020-09-22 09:43:44 +02:00
clemkeirua
6643b598c3 remove :administrateur_graphql 2020-09-17 09:24:50 +02:00
Paul Chavard
91bc2db594 Expose revisions on GraphQL API 2020-09-08 10:54:13 +02:00
Paul Chavard
6a33a8e48b update controllers specs to use revisions 2020-09-02 11:26:26 +02:00
clemkeirua
c404f92107 graphql: possibility to filter dossiers by archived 2020-07-29 16:59:34 +02:00
Paul Chavard
86f562e7ea Expose repetitions and options on champ_descriptors 2020-07-21 10:37:33 +02:00
Christophe Robillard
8f9d6d2871 show which instructeur took decision and when
and also replace "sans suite" by "classé sans suite"
2020-07-08 18:15:15 +02:00
Pierre de La Morinerie
43569f687e specs: use fixture_file_upload rather than Rack::Test::UploadedFile
This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
2020-07-01 11:13:45 +02:00
Christophe Robillard
792e755af9 expose effectif_annuel dans api graphql 2020-04-23 09:53:27 +02:00
Christophe Robillard
149b98007f add effectif mensuel to graphql api 2020-04-21 21:13:07 +02:00
Paul Chavard
32f783142c [GraphQL] allow to query dossiers by groupe instructeur 2020-04-09 09:29:28 +02:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
pedong
62f82cc83c add dossierChangerGroupeInstructeur mutation 2020-03-05 12:28:16 +01:00
Paul Chavard
1ed1aa75cd [GraphQL] add groupeInstructeur on dossier 2020-03-03 10:23:18 +01:00
Paul Chavard
6030409b2f [GraphQL] Use GraphQL::Types::BigInt instead of Int 2020-01-28 21:48:00 +01:00
Pierre de La Morinerie
792ba73643 factories: ensure that dossiers with_entreprise are consistent 2020-01-21 17:24:56 +01:00
Pierre de La Morinerie
724ff50363 factories: rename dossier for_individual to with_individual
This clarifies the distinction between

```
create :procedure, :for_individual
```

and

```
create :dossier, :with_individual
```
2020-01-21 17:24:56 +01:00
Paul Chavard
c6326bfa77 Fix tests involving attachment urls 2020-01-08 14:46:18 +01:00
Pierre de La Morinerie
7f5b0d8bf3 specs: don't create an implicit brouillon in all test cases 2020-01-07 17:59:11 +01:00
Pierre de La Morinerie
630c6de967 specs: move the query for individual to the individual context 2020-01-07 17:59:11 +01:00
Paul Chavard
6b5793f0b9 [GraphQL] fix a crash in mutations with an attachment 2019-12-11 13:22:32 +01:00
Paul Chavard
422b7f37ec [GraphQL] expose file information 2019-12-11 12:34:49 +01:00
Paul Chavard
b5eafdab56 [GraphQL]: informations du service 2019-12-04 14:21:40 +01:00
Paul Chavard
fd42fafcb4 [GraphQL]: informations du demandeur du dossier 2019-12-04 12:39:29 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Paul Chavard
e9f993fe0c [GraphQL]: normalize date names in French 2019-11-27 12:23:00 +01:00
Paul Chavard
e600aceccc [GraphQL]: add dossier state change mutations 2019-11-19 11:51:34 +01:00
Paul Chavard
ba03dbf8dd [GraphQL] Add dossierEnvoyerMessage mutation 2019-11-13 19:54:27 +01:00
Paul Chavard
f0ac01bf19 [GraphQL]: test unauthorized mutation 2019-11-13 19:54:27 +01:00
Paul Chavard
ea6667ff9f [GraphQL]: démarche and dossier number should be a number 2019-11-13 15:53:56 +01:00
Paul Chavard
fa741c9bae [GraphQL]: do not return dossiers brouillons 2019-11-07 22:07:42 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
4231b81727 [GraphQL] Add create direct upload mutation 2019-11-07 12:48:51 +01:00