forked from RyanGoodwill/backend
Merge remote-tracking branch 'origin/merge/1' into merge/1
# Conflicts: # src/main/java/org/cmh/backend/UserManagement/controller/UserManagementController.java
This commit is contained in:
commit
83d6713e93
@ -1,16 +1,12 @@
|
||||
package org.cmh.backend.OrganizationManagement.controller;
|
||||
|
||||
import org.aspectj.weaver.ast.Or;
|
||||
import org.cmh.backend.OrganizationManagement.model.Organization;
|
||||
import org.cmh.backend.OrganizationManagement.service.OrganizationService;
|
||||
import org.cmh.backend.authentication.model.User;
|
||||
import org.cmh.backend.authentication.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -33,14 +29,14 @@ public class OrganizationController {
|
||||
@PostMapping("/addOrganization")
|
||||
public Organization add(@RequestBody Map<String, String> credentials) {
|
||||
Organization organization = new Organization();
|
||||
if(credentials.get("organizationId") != null){
|
||||
if (credentials.get("organizationId") != null) {
|
||||
organization.setOrganizationId(Long.parseLong(credentials.get("organizationId")));
|
||||
}
|
||||
organization.setOrganizationName(credentials.get("organizationName"));
|
||||
organization.setOrganizationStatus(Boolean.parseBoolean(credentials.get("organizationStatus")));
|
||||
if(Integer.parseInt(credentials.get("parentOrganization")) != 0){
|
||||
if (Integer.parseInt(credentials.get("parentOrganization")) != 0) {
|
||||
organization.setParentOrganization(organizationService.getById(Long.parseLong(credentials.get("parentOrganization"))));
|
||||
}else{
|
||||
} else {
|
||||
organization.setParentOrganization(null);
|
||||
}
|
||||
organization.setEmail(credentials.get("email"));
|
||||
|
||||
@ -2,32 +2,31 @@ package org.cmh.backend.UserManagement.controller;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.cmh.backend.UserManagement.model.Tenant;
|
||||
import org.cmh.backend.UserManagement.service.TenantManagementService;
|
||||
import org.cmh.backend.UserManagement.model.User;
|
||||
import org.cmh.backend.UserManagement.service.TenantManagementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tenant")
|
||||
public class TenantManagementController {
|
||||
@Autowired
|
||||
private TenantManagementService tenantManagementService;
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:5173")
|
||||
@PostMapping("/addTenant")
|
||||
public Tenant addTenant(@RequestBody Tenant tenant) {
|
||||
Tenant tenant1=tenantManagementService.registerTenant(tenant);
|
||||
Tenant tenant1 = tenantManagementService.registerTenant(tenant);
|
||||
System.out.println(tenant.toString());
|
||||
return tenant1;
|
||||
}
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:5173")
|
||||
@GetMapping("/getAllTenant")
|
||||
public List<Tenant> getAll() {
|
||||
return tenantManagementService.findAll();
|
||||
}
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:5173")
|
||||
@PostMapping("/updateTenant")
|
||||
public Tenant update(@RequestBody Tenant tenant) {
|
||||
System.out.println(tenant);
|
||||
@ -35,7 +34,6 @@ public class TenantManagementController {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:5173")
|
||||
@PostMapping("/deleteTenant")
|
||||
@Transactional
|
||||
public void delete(@RequestBody User user) {
|
||||
|
||||
@ -34,7 +34,6 @@ public class User {
|
||||
this.gender = gender;
|
||||
this.email = email;
|
||||
this.phone = phone;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user