Skip to content

Commit 97e2ff4

Browse files
committed
flat payment and swagger update
1 parent eb365a6 commit 97e2ff4

58 files changed

Lines changed: 8897 additions & 2462 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
PWD := $(shell pwd)
22

3-
swagger:
4-
swagger validate swagger.yml
5-
docker run -i yousan/swagger-yaml-to-html < swagger.yml > docs/swagger.html
6-
73
run:
84
docker compose up

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cloud4students aims to help students deploy their projects on Threefold Grid.
1313
- First create `config.json` check [configuration](#configuration)
1414

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

1718
To build backend and frontend images
1819

client/scripts/build-env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ then
1313
exit 64
1414
fi
1515

16+
if [ -z ${STRIPE_PUBLISHER_KEY+x} ]
17+
then
18+
echo 'Error! $STRIPE_PUBLISHER_KEY is required.'
19+
exit 64
20+
fi
21+
1622

1723
configs="
1824
window.configs = window.configs || {};
1925
window.configs.vite_app_endpoint = '$VITE_API_ENDPOINT';
26+
window.configs.stripe_publisher_key = '$STRIPE_PUBLISHER_KEY';
2027
"
2128

2229
if [ -e $file ]

client/scripts/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ then
1212
exit 64
1313
fi
1414

15+
if [ -z ${STRIPE_PUBLISHER_KEY+x} ]
16+
then
17+
echo 'Error! $STRIPE_PUBLISHER_KEY is required.'
18+
exit 64
19+
fi
1520

1621
configs="
1722
window.configs = window.configs || {};
1823
window.configs.vite_app_endpoint = '$VITE_API_ENDPOINT';
24+
window.configs.stripe_publisher_key = '$STRIPE_PUBLISHER_KEY';
1925
"
2026

2127
if [ -e $file ]

client/src/components/Toast.vue

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<template>
2-
<div></div>
2+
<div></div>
33
</template>
44

55
<script lang="ts">
66
import "mosha-vue-toastify/dist/style.css";
77
import { createToast, clearToasts } from "mosha-vue-toastify";
88
export default {
9-
setup() {
10-
const toast = (title, color = "#217dbb") => {
11-
createToast(title, {
12-
position: "bottom-right",
13-
hideProgressBar: true,
14-
toastBackgroundColor: color,
15-
timeout: 8000,
16-
});
17-
};
18-
const clear = () => {
19-
clearToasts();
20-
};
21-
return { toast, clear };
22-
},
9+
setup() {
10+
const toast = (title, color = "#217dbb") => {
11+
createToast(title.charAt(0).toUpperCase() + title.slice(1), {
12+
position: "bottom-right",
13+
hideProgressBar: true,
14+
toastBackgroundColor: color,
15+
timeout: 8000,
16+
});
17+
};
18+
const clear = () => {
19+
clearToasts();
20+
};
21+
return { toast, clear };
22+
},
2323
};
2424
</script>

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ services:
2222
frontend:
2323
environment:
2424
- VITE_API_ENDPOINT=http://localhost:3000/v1
25+
- STRIPE_PUBLISHER_KEY=""
2526
build:
2627
context: client/.
2728
dockerfile: Dockerfile

docs/swagger.html

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/user_stories.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@
7272

7373
## Scenario 8
7474

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

7777
### Acceptance Criteria
7878

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

8483
## Scenario 9

server/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ build:
77
@echo "Running $@"
88
@go build -ldflags="-X 'github.com/codescalers/cloud4students/cmd.Commit=$(shell git rev-parse HEAD)'" -o bin/cloud4students main.go
99

10-
run: build
10+
swag:
11+
@echo "Installing swag" && go install github.com/swaggo/swag/cmd/swag@latest
12+
export PATH=${PATH}:${HOME}/go/bin
13+
@swag init
14+
15+
run: build swag
1116
@echo "Running $@"
1217
bin/cloud4students
1318

server/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,20 @@ make run
6969
```bash
7070
docker run cloud4students
7171
```
72+
73+
### Swagger
74+
75+
- Install swag binary
76+
77+
```bash
78+
go install github.com/swaggo/swag/cmd/swag@latest
79+
```
80+
81+
- Generate swagger docs
82+
83+
```bash
84+
swag init
85+
```
86+
87+
- You can access swagger through `/swagger/index.html`.
88+
- Example: if your port is `3000` and host is `localhost`, then you can access swagger using `http://localhost:3000/swagger/index.html`

0 commit comments

Comments
 (0)