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

[SELC-6237] Ports the POST /bulk/institutions endpoint in the new Quarkus module #54

Open
wants to merge 7 commits into
base: refactor-quarkus
Choose a base branch
from
5 changes: 5 additions & 0 deletions apps/institution-ms-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>it.pagopa.selfcare</groupId>
<artifactId>onboarding-sdk-product</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
185 changes: 185 additions & 0 deletions apps/institution-ms-quarkus/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"openapi" : "3.0.3",
"info" : {
"title" : "Institution API",
"version" : "1.0.0"
},
"servers" : [ {
"url" : "http://localhost:8080",
"description" : "Auto generated value"
}, {
"url" : "http://0.0.0.0:8080",
"description" : "Auto generated value"
} ],
"paths" : {
"/bulk/institutions" : {
"post" : {
"tags" : [ "Management Controller" ],
"operationId" : "retrieveInstitutionByIds",
"requestBody" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/BulkPartiesSeed"
}
}
}
},
"responses" : {
"200" : {
"description" : "OK",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/BulkInstitutions"
}
}
}
}
}
}
}
},
"components" : {
"schemas" : {
"AttributesResponse" : {
"type" : "object",
"properties" : {
"origin" : {
"type" : "string"
},
"code" : {
"type" : "string"
},
"description" : {
"type" : "string"
}
}
},
"BillingResponse" : {
"type" : "object",
"properties" : {
"vatNumber" : {
"type" : "string"
},
"taxCodeInvoicing" : {
"type" : "string"
},
"recipientCode" : {
"type" : "string"
},
"publicServices" : {
"type" : "boolean"
}
}
},
"BulkInstitution" : {
"required" : [ "id", "externalId", "origin", "originId", "description", "digitalAddress", "address", "zipCode", "taxCode", "products" ],
"type" : "object",
"properties" : {
"id" : {
"type" : "string"
},
"externalId" : {
"type" : "string"
},
"origin" : {
"type" : "string"
},
"originId" : {
"type" : "string"
},
"description" : {
"type" : "string"
},
"institutionType" : {
"type" : "string"
},
"digitalAddress" : {
"type" : "string"
},
"address" : {
"type" : "string"
},
"zipCode" : {
"type" : "string"
},
"taxCode" : {
"type" : "string"
},
"attributes" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/AttributesResponse"
}
},
"products" : {
"type" : "object",
"additionalProperties" : {
"$ref" : "#/components/schemas/BulkProduct"
}
}
}
},
"BulkInstitutions" : {
"type" : "object",
"properties" : {
"found" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/BulkInstitution"
}
},
"notFound" : {
"type" : "array",
"items" : {
"type" : "string"
}
}
}
},
"BulkPartiesSeed" : {
"required" : [ "partyIdentifiers" ],
"type" : "object",
"properties" : {
"partyIdentifiers" : {
"type" : "array",
"items" : {
"type" : "string"
}
}
}
},
"BulkProduct" : {
"required" : [ "product", "billing" ],
"type" : "object",
"properties" : {
"product" : {
"type" : "string"
},
"billing" : {
"$ref" : "#/components/schemas/BillingResponse"
},
"pricingPlan" : {
"type" : "string"
},
"status" : {
"$ref" : "#/components/schemas/RelationshipState"
}
}
},
"RelationshipState" : {
"enum" : [ "ACTIVE", "PENDING", "TOBEVALIDATED", "SUSPENDED", "DELETED", "REJECTED" ],
"type" : "string"
}
},
"securitySchemes" : {
"SecurityScheme" : {
"type" : "http",
"description" : "Authentication",
"scheme" : "bearer",
"bearerFormat" : "JWT"
}
}
}
}
141 changes: 141 additions & 0 deletions apps/institution-ms-quarkus/src/main/docs/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
openapi: 3.0.3
info:
title: Institution API
version: 1.0.0
servers:
- url: http://localhost:8080
description: Auto generated value
- url: http://0.0.0.0:8080
description: Auto generated value
paths:
/bulk/institutions:
post:
tags:
- Management Controller
operationId: retrieveInstitutionByIds
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/BulkPartiesSeed"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/BulkInstitutions"
components:
schemas:
AttributesResponse:
type: object
properties:
origin:
type: string
code:
type: string
description:
type: string
BillingResponse:
type: object
properties:
vatNumber:
type: string
taxCodeInvoicing:
type: string
recipientCode:
type: string
publicServices:
type: boolean
BulkInstitution:
required:
- id
- externalId
- origin
- originId
- description
- digitalAddress
- address
- zipCode
- taxCode
- products
type: object
properties:
id:
type: string
externalId:
type: string
origin:
type: string
originId:
type: string
description:
type: string
institutionType:
type: string
digitalAddress:
type: string
address:
type: string
zipCode:
type: string
taxCode:
type: string
attributes:
type: array
items:
$ref: "#/components/schemas/AttributesResponse"
products:
type: object
additionalProperties:
$ref: "#/components/schemas/BulkProduct"
BulkInstitutions:
type: object
properties:
found:
type: array
items:
$ref: "#/components/schemas/BulkInstitution"
notFound:
type: array
items:
type: string
BulkPartiesSeed:
required:
- partyIdentifiers
type: object
properties:
partyIdentifiers:
type: array
items:
type: string
BulkProduct:
required:
- product
- billing
type: object
properties:
product:
type: string
billing:
$ref: "#/components/schemas/BillingResponse"
pricingPlan:
type: string
status:
$ref: "#/components/schemas/RelationshipState"
RelationshipState:
enum:
- ACTIVE
- PENDING
- TOBEVALIDATED
- SUSPENDED
- DELETED
- REJECTED
type: string
securitySchemes:
SecurityScheme:
type: http
description: Authentication
scheme: bearer
bearerFormat: JWT
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package it.pagopa.selfcare.conf;

import org.bson.BsonReader;
import org.bson.BsonType;
import org.bson.BsonWriter;
import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.EncoderContext;

import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;

public class DateCodec implements Codec<OffsetDateTime> {

@Override
public OffsetDateTime decode(BsonReader reader, DecoderContext decoderContext) {
BsonType currentType = reader.getCurrentBsonType();
if (currentType.equals(BsonType.DATE_TIME)) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(reader.readDateTime()), ZoneId.systemDefault());
} else if (currentType.equals(BsonType.STRING)) {
return OffsetDateTime.parse(reader.readString());
}
return null;
}

@Override
public void encode(BsonWriter bsonWriter, OffsetDateTime aLong, EncoderContext encoderContext) {
bsonWriter.writeDateTime(aLong.toInstant().toEpochMilli());
}

@Override
public Class<OffsetDateTime> getEncoderClass() {
return OffsetDateTime.class;
}

}
Loading