-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeveloperController.java
More file actions
23 lines (20 loc) · 927 Bytes
/
Copy pathDeveloperController.java
File metadata and controls
23 lines (20 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package org.example.crm.controller;
import lombok.RequiredArgsConstructor;
import org.example.crm.entity.dto.user.AdminUserCreateDto;
import org.example.crm.entity.dto.user.UserCreateDto;
import org.example.crm.entity.dto.user.UserDto;
import org.example.crm.service.UserService;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@RestController
@RequiredArgsConstructor
@PreAuthorize("hasRole('DEVELOPER')")
@RequestMapping("/api/v1/developer")
public class DeveloperController {
final UserService userService;
@PostMapping("/create-super-admin")
public ResponseEntity<UserDto> createSuperAdmin(@RequestParam String organizationId, @RequestBody AdminUserCreateDto userCreateDto) {
return ResponseEntity.status(201).body(userService.createSuperAdmin(organizationId, userCreateDto));
}
}