add CrossOrigin definition to the REST controllers for the Web UI client

This commit is contained in:
Timotheus Pokorra 2024-08-10 06:42:14 +02:00 committed by Dev und Test fuer hsadminng
parent 99a26aed8b
commit 85eb53905f
20 changed files with 39 additions and 0 deletions

View File

@ -3,3 +3,4 @@ export HSADMINNG_POSTGRES_ADMIN_USERNAME=admin
export HSADMINNG_POSTGRES_ADMIN_PASSWORD=
export HSADMINNG_POSTGRES_RESTRICTED_USERNAME=restricted
export HSADMINNG_MIGRATION_DATA_PATH=migration
export HSADMINNG_CORS_WEBUI='http://localhost:3000'

View File

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -23,6 +24,7 @@ import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsBookingItemController implements HsBookingItemsApi {

View File

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityNotFoundException;
@ -18,6 +19,7 @@ import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsBookingProjectController implements HsBookingProjectsApi {

View File

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -26,6 +27,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.function.BiConsumer;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsHostingAssetController implements HsHostingAssetsApi {

View File

@ -5,11 +5,13 @@ import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.api.HsHostingAssetP
import net.hostsharing.hsadminng.hs.hosting.generated.api.v1.model.HsHostingAssetTypeResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import java.util.List;
import java.util.Map;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsHostingAssetPropsController implements HsHostingAssetPropsApi {

View File

@ -11,11 +11,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.util.List;
import java.util.UUID;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeBankAccountController implements HsOfficeBankAccountsApi {

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.util.List;
@ -18,6 +19,7 @@ import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.mapper.KeyValueMap.from;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeContactController implements HsOfficeContactsApi {

View File

@ -11,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityNotFoundException;
@ -22,6 +23,7 @@ import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.*;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAssetsApi {

View File

@ -13,6 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.time.LocalDate;
@ -24,6 +25,7 @@ import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionTypeResource.CANCELLATION;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionTypeResource.SUBSCRIPTION;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopSharesApi {

View File

@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -26,6 +27,7 @@ import java.util.UUID;
import static net.hostsharing.hsadminng.errors.DisplayAs.DisplayName;
import static net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType.DEBITOR;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeDebitorController implements HsOfficeDebitorsApi {

View File

@ -10,12 +10,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeMembershipController implements HsOfficeMembershipsApi {

View File

@ -19,6 +19,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -28,6 +29,7 @@ import java.util.UUID;
import static net.hostsharing.hsadminng.hs.office.relation.HsOfficeRelationType.EX_PARTNER;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficePartnerController implements HsOfficePartnersApi {

View File

@ -10,11 +10,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.util.List;
import java.util.UUID;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficePersonController implements HsOfficePersonsApi {

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -20,6 +21,7 @@ import java.util.UUID;
import java.util.function.BiConsumer;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeRelationController implements HsOfficeRelationsApi {

View File

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -20,6 +21,7 @@ import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class HsOfficeSepaMandateController implements HsOfficeSepaMandatesApi {

View File

@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
@ -15,6 +16,7 @@ import jakarta.persistence.PersistenceContext;
import java.util.List;
import java.util.UUID;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class RbacGrantController implements RbacGrantsApi {

View File

@ -8,9 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import java.util.List;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class RbacRoleController implements RbacRolesApi {

View File

@ -9,11 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import java.util.List;
import java.util.UUID;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class RbacUserController implements RbacUsersApi {

View File

@ -8,12 +8,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import java.util.List;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class TestCustomerController implements TestCustomersApi {

View File

@ -10,10 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.CrossOrigin;
import java.util.List;
import java.util.UUID;
@CrossOrigin(origins = "${HSADMINNG_CORS_WEBUI:http://localhost:3000}")
@RestController
public class TestPackageController implements TestPackagesApi {