feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>everything-is-suitable-admin-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Everything Is Suitable Admin API</name>
|
||||
<description>Admin API layer for Everything Is Suitable API</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-sys</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-statistics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.destiny</groupId>
|
||||
<artifactId>everything-is-suitable-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package io.destiny.admin.api.config;
|
||||
|
||||
import io.destiny.admin.api.handler.AdminStatisticsHandler;
|
||||
import io.destiny.admin.api.handler.AdminUserHandler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
|
||||
import static org.springframework.web.reactive.function.server.RequestPredicates.*;
|
||||
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
|
||||
|
||||
@Configuration
|
||||
public class AdminRouter {
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> adminRoutes(AdminUserHandler userHandler,
|
||||
AdminStatisticsHandler statisticsHandler) {
|
||||
return route()
|
||||
.GET("/api/users", userHandler::listUsers)
|
||||
.POST("/api/users", userHandler::createUser)
|
||||
.GET("/api/statistics", statisticsHandler::getStatistics)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package io.destiny.admin.api.handler;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Component
|
||||
public class AdminStatisticsHandler {
|
||||
|
||||
public Mono<ServerResponse> getStatistics(ServerRequest request) {
|
||||
return ServerResponse.ok()
|
||||
.bodyValue("{\"message\":\"Statistics - to be implemented\"}");
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package io.destiny.admin.api.handler;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Component
|
||||
public class AdminUserHandler {
|
||||
|
||||
public Mono<ServerResponse> listUsers(ServerRequest request) {
|
||||
return ServerResponse.ok()
|
||||
.bodyValue("{\"message\":\"List users - to be implemented\"}");
|
||||
}
|
||||
|
||||
public Mono<ServerResponse> createUser(ServerRequest request) {
|
||||
return ServerResponse.ok()
|
||||
.bodyValue("{\"message\":\"Create user - to be implemented\"}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user