Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement help #97

Merged
merged 8 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ MSAL_AUTHORITY=https://testcgnportalbitrock.b2clogin.com/testcgnportalbitrock.on
MSAL_REDIRECT_URI=https://cgnportaltest-d-cdnendpoint-frontend.azureedge.net/

BASE_IMAGE_PATH=https://cgnportaltestdsa.blob.core.windows.net

BASE_PUBLIC_PATH=https://api.cgn-dev.caravan-azure.bitrock.it/public/v1
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ MSAL_AUTHORITY=https://cgnonboardingportal.b2clogin.com/cgnonboardingportal.onmi
MSAL_REDIRECT_URI=https://cgnonboardingportal-p-cdnendpoint-frontend.azureedge.net/

BASE_IMAGE_PATH=https://cgnonboardingportalpsa.blob.core.windows.net

BASE_PUBLIC_PATH=https://api.cgnonboardingportal.pagopa.it/public/v1
2 changes: 2 additions & 0 deletions .env.uat
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ MSAL_AUTHORITY=https://cgnonboardingportaluat.b2clogin.com/cgnonboardingportalua
MSAL_REDIRECT_URI=https://cgnonboardingportal-u-cdnendpoint-frontend.azureedge.net/

BASE_IMAGE_PATH=https://cgnonboardingportalusa.blob.core.windows.net

BASE_PUBLIC_PATH=https://api.cgnonboardingportal-uat.pagopa.it/public/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ local.settings.json
node_modules
generated
generated_backoffice
generated_public
build
local
dist
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"lint-autofix": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
"generate:api": "openapi-generator-cli generate -i ./src/api/api.yaml -g typescript-axios -o ./src/api/generated",
"generate:api_backoffice": "openapi-generator-cli generate -i ./src/api/api_backoffice.yaml -g typescript-axios -o ./src/api/generated_backoffice",
"generate:api_public": "openapi-generator-cli generate -i ./src/api/api_public.yaml -g typescript-axios -o ./src/api/generated_public",
"generate": "npm-run-all generate:*",
"prettify": "prettier --write \"./**/*.{ts,tsx}\"",
"typescript:dts": "node scripts/dts.js"
Expand Down Expand Up @@ -86,6 +87,7 @@
"jest": "^26.6.3",
"npm-run-all": "^4.1.5",
"parcel": "^1.12.3",
"sass": "^1.32.13",
"shx": "^0.3.3",
"ts-jest": "^26.5.4",
"typescript": "^4.1.2"
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
import { useParams } from "react-router-dom";
import { setCookie, getCookie } from "./utils/cookie";
import { setUser } from "./store/user/userSlice";
import CenteredLoading from "./components/CenteredLoading/CenteredLoading";
Expand Down
85 changes: 85 additions & 0 deletions src/api/api_public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
swagger: '2.0'
info:
title: CGN Onboarding Portal Public API
description: Carta Giovani Nazionale Onboarding Portal - Public API
version: '0.1.0'
host: api.cgn.pagopa.it
basePath: /public/api
schemes:
- https

tags:
- name: help
description: Help

paths:
/help:
post:
tags:
- help
summary: Send an help request
operationId: sendHelpRequest
parameters:
- in: body
description: Help request
name: helpRequest
required: true
schema:
$ref: '#/definitions/HelpRequest'
responses:
204:
description: Request Received

consumes:
- application/json
produces:
- application/json

definitions:
HelpRequest:
type: object
required:
- legalName
- referentFirstName
- referentLastName
- emailAddress
- category
- message
properties:
legalName:
type: string
referentFirstName:
type: string
referentLastName:
type: string
emailAddress:
type: string
format: email
category:
type: string
enum:
- Access
- DataFilling
- Discounts
- Documents
- TechnicalProblem
- CgnOwnerReporting
- Suggestions
- Other
topic:
type: string
message:
type: string
maxLength: 200


responses:
InvalidRequest:
description: Bad request
#content: {} #TODO
Forbidden:
description: Forbidden
#content: {} #TODO
NotFound:
description: Not found
#content: {} #TODO
3 changes: 2 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios, { AxiosError } from 'axios';
import { getCookie, logout } from '../utils/cookie';
import {AgreementApi, ProfileApi, DiscountApi, DocumentApi, DocumentTemplateApi, ApiTokenApi } from './generated';
import {AgreementApi, ProfileApi, DiscountApi, DocumentApi, DocumentTemplateApi, ApiTokenApi, HelpApi } from './generated';

const token = getCookie();

Expand Down Expand Up @@ -29,4 +29,5 @@ export default {
Document: new DocumentApi(undefined, process.env.BASE_API_PATH, axiosInstance),
DocumentTemplate: new DocumentTemplateApi(undefined, process.env.BASE_API_PATH, axiosInstance),
ApiToken: new ApiTokenApi(undefined, process.env.BASE_API_PATH, axiosInstance),
Help: new HelpApi(undefined, process.env.BASE_API_PATH, axiosInstance),
};
15 changes: 15 additions & 0 deletions src/api/public.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import axios, { AxiosError } from 'axios';
import { HelpApi } from './generated_public';

export const axiosInstance = axios.create({
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
}
});

axiosInstance.interceptors.response.use((response) => response, (error: AxiosError) => error);

export default {
NotLoggedHelp: new HelpApi(undefined, process.env.BASE_PUBLIC_PATH, axiosInstance)
};
Loading