Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
PWD := $(shell pwd)

swagger:
swagger validate swagger.yml
docker run -i yousan/swagger-yaml-to-html < swagger.yml > docs/swagger.html

run:
docker compose up
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cloud4students aims to help students deploy their projects on Threefold Grid.
- First create `config.json` check [configuration](#configuration)

- Change `VITE_API_ENDPOINT` in docker-compose.yml to server api url for example `http://localhost:3000/v1`
- Change `STRIPE_PUBLISHER_KEY` in docker-compose.yml to your stripe publisher key (can get it from stripe dashboard)

To build backend and frontend images

Expand Down
7 changes: 7 additions & 0 deletions client/scripts/build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ then
exit 64
fi

if [ -z ${STRIPE_PUBLISHER_KEY+x} ]
then
echo 'Error! $STRIPE_PUBLISHER_KEY is required.'
exit 64
fi


configs="
window.configs = window.configs || {};
window.configs.vite_app_endpoint = '$VITE_API_ENDPOINT';
window.configs.stripe_publisher_key = '$STRIPE_PUBLISHER_KEY';
"

if [ -e $file ]
Expand Down
6 changes: 6 additions & 0 deletions client/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ then
exit 64
fi

if [ -z ${STRIPE_PUBLISHER_KEY+x} ]
then
echo 'Error! $STRIPE_PUBLISHER_KEY is required.'
exit 64
fi

configs="
window.configs = window.configs || {};
window.configs.vite_app_endpoint = '$VITE_API_ENDPOINT';
window.configs.stripe_publisher_key = '$STRIPE_PUBLISHER_KEY';
"

if [ -e $file ]
Expand Down
32 changes: 17 additions & 15 deletions client/src/components/Toast.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<template>
<div></div>
<div></div>
</template>

<script lang="ts">
import "mosha-vue-toastify/dist/style.css";
import { createToast, clearToasts } from "mosha-vue-toastify";
export default {
setup() {
const toast = (title, color = "#217dbb") => {
createToast(title, {
position: "bottom-right",
hideProgressBar: true,
toastBackgroundColor: color,
timeout: 8000,
});
};
const clear = () => {
clearToasts();
};
return { toast, clear };
},
setup() {
const toast = (title, color = "#217dbb") => {
if (title.length > 0) {
createToast(title.charAt(0).toUpperCase() + title.slice(1), {
position: "bottom-right",
hideProgressBar: true,
toastBackgroundColor: color,
timeout: 8000,
});
}
};
const clear = () => {
clearToasts();
};
return { toast, clear };
},
};
</script>
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
frontend:
environment:
- VITE_API_ENDPOINT=http://localhost:3000/v1
- STRIPE_PUBLISHER_KEY=""
build:
context: client/.
dockerfile: Dockerfile
Expand Down
53 changes: 0 additions & 53 deletions docs/swagger.html

This file was deleted.

7 changes: 3 additions & 4 deletions docs/user_stories.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@

## Scenario 8

- As a user I expect to get all information about the voucher, used resources, and remaining quota
- As a user I expect to get all information about the voucher, used resources, and remaining balance

### Acceptance Criteria

- User should get all information about the voucher and its available resources (vms)
- Each user will have certain numbers of vms based on the voucher
- Each user should know how quota is calculated
- User should get all information about the voucher and its available balance
- Each user will have certain amount of money based on the voucher
---

## Scenario 9
Expand Down
7 changes: 6 additions & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ build:
@echo "Running $@"
@go build -ldflags="-X 'github.com/codescalers/cloud4students/cmd.Commit=$(shell git rev-parse HEAD)'" -o bin/cloud4students main.go

run: build
swag:
@echo "Installing swag" && go install github.com/swaggo/swag/cmd/swag@latest
export PATH=${PATH}:${HOME}/go/bin
@swag init

run: build swag
@echo "Running $@"
bin/cloud4students

Expand Down
17 changes: 17 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,20 @@ make run
```bash
docker run cloud4students
```

### Swagger

- Install swag binary

```bash
go install github.com/swaggo/swag/cmd/swag@latest
```

- Generate swagger docs

```bash
swag init
```

- You can access swagger through `/swagger/index.html`.
- Example: if your port is `3000` and host is `localhost`, then you can access swagger using `http://localhost:3000/swagger/index.html`
Loading
Loading