Merge branch 'main' into docker-test

This commit is contained in:
Erik Foris 2024-07-08 23:57:45 +02:00
commit 90f0bc6159
3 changed files with 95 additions and 8 deletions

View File

@ -0,0 +1,88 @@
# DataDash Explore public APIs and datasets
[TOC]
## Description
DataDash is a simple Product Hunt-like "tool" for searching and discovering the newest datasets and APIs.
It provides the ability to up-/downvote entries, and to indicate the quality of a given dataset/API by rating it on a scale of 0 to 5 stars.
## Installation
### On Linux and Mac
To install DataDash, follow these steps:
#### 1. Clone the repository:
```bash
$ git clone https://git.fim.uni-passau.de/padas/24ss-5430-web-and-data-eng/gruppe-3/datadash.git
```
#### 2. Enter the repo:
```bash
$ cd datadash
```
#### 3. Install Java JDK 22: Please refer to the installation instructions for your package manager/OS.
#### 4. Start the application:
```bash
$ ./mvnw spring-boot:run
```
Additional dependencies will be downloaded and managed by maven.
## Deployment
### 1. Follow [installation steps 1-3](#installation).
### 2. _(Optional)_ Remove sample data:
Remove [`src/main/resources/data.sql`](src/main/resources/data.sql) to remove the sample data.
> **Note:** This will also remove all default categories.
### 3. Package the application:
```bash
$ ./mvnw package
```
This will create the `.war` file that you can deploy as you like.
## Usage
1. Open your web browser and navigate to `http://localhost:8080`.
2. Some **dummy data** will be shown (if configured, see [deployment step 2](#2-optional-remove-sample-data)).
3. Add your own datasets and APIs via the **add button** in the top left corner.
4. In the top right you can see the **search toolbar**. Here you can **sort**, input **search terms**, and **filter by categories or type of content** (i.e. dataset or API).
5. For **more information** on a certain dataset just click on it
1. You can differentiate between **API** and **dataset** via the **blue box**.
2. The **user perceived quality** is indicated by the **number and stars** on the left hand side just below the title.
3. You can also **vote** by just **hovering** and then **clicking on the stars**.
4. Right next to the stars the **summary** is displayed. It's a short text describing the main purpose.
5. Below the star rating and summary the **dataset's/API's source** is linked
6. In the next section some metadata regarding the **date of submission**, **category**, **license** and a link to the **Terms of Use** are shown.
7. Next you can see a **full description**.
8. At the very bottom of the page there is a button that will bring you **back to the homepage**. If you want to go back to the **previous page** (e.g. search) you might want to use **your browser's back button**.
9. If you created the entry that you are currently looking at, you will find a **`Delete`** button next to the `Back to main page` button. This will **delete** the entry **without any further confirmation**.
## Used Frameworks/Libraries
### Frontend
None, our whole frontend is written in **native HTML, CSS, and JavaScript**.
It has been tested on **Firefox 127** and **Chromium 126**.
### Backend
We have used the following dependencies:
- `spring-boot-starter-web`
- `springdoc-openapi-starter-webmvc-ui`
- `spring-boot-starter-tomcat`
- `spring-boot-starter-test`
- `com.h2database`

View File

@ -87,7 +87,6 @@ rating.addEventListener("mousemove", (event) => {
if (!dataset.storageGetKey("is-rated", false)) {
let bounds = rating.getBoundingClientRect();
currentRating = Math.round(((event.clientX - bounds.left) / bounds.width) * 5);
console.log(currentRating);
rating.value = currentRating;
}

View File

@ -228,7 +228,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, "%", "%",
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(page);
String s = objectMapper.writeValueAsString(page);
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword))
.andExpect(status().isOk())
.andExpect(content().json(s));
}
@ -239,7 +239,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword))
.andExpect(status().isOk());
}
@ -249,7 +249,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword + "&sort=invalid"))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword + "&sort=invalid"))
.andExpect(status().isBadRequest());
}
@ -259,7 +259,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword + "&direction=invalid"))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword + "&direction=invalid"))
.andExpect(status().isBadRequest());
}
@ -269,7 +269,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword + "&page=-1"))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword + "&page=-1"))
.andExpect(status().isBadRequest());
}
@ -279,7 +279,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword + "&size=-1"))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword + "&size=-1"))
.andExpect(status().isBadRequest());
}
@ -289,7 +289,7 @@ public class DatasetControllerTests {
given(datasetService.searchByOptionalCriteria(keyword, null, null,
PageRequest.of(0, 20, Sort.by(Sort.Direction.DESC, "upvotes")))).willReturn(Page.empty());
mockMvc.perform(get("/api/v1/datasets/search?search=" + keyword + "&size=0"))
mockMvc.perform(get("/api/v1/datasets?search=" + keyword + "&size=0"))
.andExpect(status().isBadRequest());
}
}