# Getting Started ### Reference Documentation For further reference, please consider the following sections: * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/) * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/#build-image) * [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-mongodb) * [OAuth2 Resource Server](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-security-oauth2-server) * [Spring Data JDBC](https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/) * [Spring Data Reactive MongoDB](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-mongodb) ### Guides The following guides illustrate how to use some features concretely: * [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/) * [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics) ### Server-side Testing #### UserService - Register ``` curl -v --header "Content-Type: application/json" \ --request POST \ --data '{"userName":"test","password":"fake"}' \ http://localhost:8080/user/register ``` - Login ``` curl -v --user test:fake http://localhost:8080/user/login ``` - Logout ``` curl http://localhost:8080/user/logout ``` - Show Favorites ``` curl -v http://localhost:8080/user/test/favorites ``` - Add Material to Favorites ``` curl -v --header "Content-Type: application/json" \ --request POST \ --data '{"id":"6017ac5f0a02022776965418"}' \ http://localhost:8080/user/test/favorites ``` - Delete Material to Favorites ``` curl -v --header "Content-Type: application/json" \ --request DELETE \ --data '{"id":"6017ac5f0a02022776965418"}' \ http://localhost:8080/user/test/favorites ``` #### CategoryService - Show Root Categories ``` curl -v http://localhost:8080/categories ``` - Show specific category info (will return an array including all its subCategories) ``` curl -v http://localhost:8080/categories/6017a128200eb739d8576281 ``` - Create Categories ``` curl -v --header "Content-Type: application/json" \ --request POST \ --data '{"name":"测试类root", "dummy": "nothing"}' \ http://localhost:8080/admin/materialCategories curl -v --header "Content-Type: application/json" \ --request POST \ --data '{"name":"测试类root2", "parentId": "6017a0e7200eb739d8576280"}' \ http://localhost:8080/admin/materialCategories curl -v --header "Content-Type: application/json" \ --request POST \ --data '{"name":"测试3", "parentId": "6017a0e7200eb739d8576280"}' \ http://localhost:8080/admin/materialCategories ``` - Edit Category ``` curl -v --header "Content-Type: application/json" \ -X PUT \ --data '{"name":"测试类root2", "parentId": null}' \ http://localhost:8080/admin/categories/6017a128200eb739d8576281 ``` - Delete Category ``` curl -v --header "Content-Type: application/json" \ -X DELETE \ http://localhost:8080/admin/categories/6017a128200eb739d8576281 ``` #### LearningMaterialService - Create Material ``` curl -v --header "Content-Type: application/json" \ -X POST \ --data '{"name":"测试材料1", "description": "This is only for testing"}' \ http://localhost:8080/admin/materials ``` - Edit Material ``` curl -v --header "Content-Type: application/json" \ -X PUT \ --data '{"name":"测试材料1", "description": "This is only for testing", "contents": "钊哥真帅"}' \ http://localhost:8080/admin/materials/6017a89cf3ae0e6d5288354d ``` - Like Material ``` curl -v --header "Content-Type: application/json" \ -X POST \ --data '{"id":"601677a8e2f8a06e3d15c292"}' \ http://localhost:8080/materials/6017a89cf3ae0e6d5288354d/like ``` - Read Material ``` curl -v --header "Content-Type: application/json" \ -X POST \ --data '{"id":"601677a8e2f8a06e3d15c292"}' \ http://localhost:8080/materials/6017a89cf3ae0e6d5288354d/read ``` - Get Material ``` curl -v http://localhost:8080/materials/6017a89cf3ae0e6d5288354d ``` - Delete Material ``` curl -v --header "Content-Type: application/json" \ -X DELETE \ http://localhost:8080/admin/materials/6017a89cf3ae0e6d5288354d ``` - Start exam ``` curl -v --header "Content-Type: application/json" \ -X POST \ --data '{"userName":"testuser-JDWkEEmbvq"}' \ http://localhost:8080/exams/60332015f62a7768d567a023/start ``` - End exam ``` curl -v --header "Content-Type: application/json" \ -X POST \ --data '{"userId":"testuser-JDWkEEmbvq", "points": 5}' \ http://localhost:8080/exams/60332015f62a7768d567a023/end ```