Compare commits
8 Commits
fr/review-
...
eca59344f6
Author | SHA1 | Date | |
---|---|---|---|
eca59344f6 | |||
43b98e3e8b | |||
09e7193f89 | |||
6c2ebe7d7a | |||
1dd7952976 | |||
922a11b23b | |||
5a2a2db5e2 | |||
61449caef1 |
29
.gitea/workflows/build.yaml
Normal file
29
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: Build DeguApp backend
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./api
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node.js and TypeScript
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: "20.14.0"
|
||||||
|
|
||||||
|
- name: change directory to api/
|
||||||
|
|
||||||
|
- name: npm install, build and test
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build --if-present
|
||||||
|
npm run test
|
||||||
|
|
28
README.md
28
README.md
@ -35,7 +35,12 @@ To get started with DeguApp, follow these steps:
|
|||||||
2. Install dependencies:
|
2. Install dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd deguapp
|
# frontend
|
||||||
|
cd deguapp/frontend
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# backend
|
||||||
|
cd deguapp/api
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -43,11 +48,6 @@ To get started with DeguApp, follow these steps:
|
|||||||
|
|
||||||
5. Open the app in your browser or Android emulator and start exploring!
|
5. Open the app in your browser or Android emulator and start exploring!
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Contributions are welcome! If you'd like to contribute to DeguApp, please fork the repository and submit a pull request with your changes.
|
|
||||||
Use the upstream of the project, which can be found at https:/git.filiprojek.cz/fr/deguapp. **GitHub repository is just a mirror!**
|
|
||||||
|
|
||||||
## Local builds
|
## Local builds
|
||||||
### Android
|
### Android
|
||||||
|
|
||||||
@ -74,12 +74,24 @@ bundletool build-apks --bundle=./frontend/android/app/build/outputs/bundle/relea
|
|||||||
bundletool install-apks --apks=./deguapp.apks
|
bundletool install-apks --apks=./deguapp.apks
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Resources:
|
||||||
### Resources:
|
|
||||||
|
|
||||||
- https://github.com/expo/eas-cli/issues/1300
|
- https://github.com/expo/eas-cli/issues/1300
|
||||||
- https://reactnative.dev/docs/signed-apk-android#generating-the-release-aab
|
- https://reactnative.dev/docs/signed-apk-android#generating-the-release-aab
|
||||||
|
|
||||||
|
### Server
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd api/
|
||||||
|
npm i
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! If you'd like to contribute to DeguApp, please fork the repository and submit a pull request with your changes.
|
||||||
|
Use the upstream of the project, which can be found at https:/git.filiprojek.cz/fr/deguapp. **GitHub repository is just a mirror!**
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the GNU GPLv3 License - see the [LICENSE](LICENSE) file for details.
|
This project is licensed under the GNU GPLv3 License - see the [LICENSE](LICENSE) file for details.
|
||||||
|
23
api/.gitea/workflows/build.yaml
Normal file
23
api/.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
name: Build DeguApp backend
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node.js and TypeScript
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: "20.14.0"
|
||||||
|
|
||||||
|
- name: npm install, build and test
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build --if-present
|
||||||
|
npm run test
|
||||||
|
|
@ -41,3 +41,5 @@ app.use(cookieParser());
|
|||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
app.use(routes);
|
app.use(routes);
|
||||||
|
|
||||||
|
//test
|
||||||
|
@ -28,11 +28,6 @@ const schema = new Schema<IReview | any>(
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
note: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
beer_id: {
|
beer_id: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":"2.0.0","endpoints":{"user":{"signup":{"name":"user","operation":"signup","route":"/api/v1/auth/signup","method":"POST","description":"user signup api","body":{"username":"testuser","email":"text@example.com","password":"Test1234"},"response":"status object"},"signin":{"name":"user","operation":"signin","route":"/api/v1/auth/signin","method":"POST","description":"user signin api","body":{"email":"text@example.com","password":"Test1234"},"response":"status object"},"logout":{"name":"user","operation":"logout","route":"/api/v1/auth/logout","method":"POST","description":"user logout api","body":{},"response":"status object"},"status":{"name":"user","operation":"status","route":"/api/v1/auth/status","method":"GET","description":"user login status api","response":"status code | user object"}},"beer":{"add":{"name":"beer","operation":"add","route":"/api/v1/beer/add","method":"POST","description":"beer add api","body":{"brand":"Pilsner Urqell","name":"Kozel","degree":11,"packaging":"can","photos":"optional field | max 4 images | formData"},"response":"status object | beer object"},"get":{"name":"beer","operation":"get","route":"/api/v1/beer/get","method":"GET","description":"beer get api","response":"status object | array of beer objects"},"del":{"name":"beer","operation":"del","route":"/api/v1/beer/del","method":"POST","description":"beer del api","body":{"_id":"6352b303b71cb62222f39895"},"response":"status object"},"edit":{"name":"beer","operation":"edit","route":"/api/v1/beer/edit","method":"POST","description":"beer edit api","body":{"_id":"6355b95dc03fad77bc380146","brand":"Pilsner Urqell","name":"Radegast","degree":12,"packaging":"bottle","imgs":[],"photos":"optional field | max 4 images | formData"},"response":"status object | beer data"}},"docs":{"get_all":{"name":"docs","operation":"get_all","route":"/api/v1","method":"GET","description":"Get docs json","response":"docs json"}},"review":{"add":{"name":"review","operation":"add","route":"/api/v1/review/add","method":"POST","description":"review add api","body":{"beer_id":"6352b303b71cb62222f39895","foam":3,"bitter_sweetness":2,"taste":5,"packaging":3,"sourness":false,"would_again":true,"note":"Pretty good beer"},"response":"status object | review object"},"get":{"name":"review","operation":"get","route":"/api/v1/review/get","method":"GET","description":"review get api","response":"status object | array of review objects"},"del":{"name":"review","operation":"del","route":"/api/v1/review/del","method":"POST","description":"review del api","body":{"_id":"6352b303b71cb62222f39895"},"response":"status object"}}}}
|
{"version":"2.0.0","endpoints":{"user":{"signup":{"name":"user","operation":"signup","route":"/api/v1/auth/signup","method":"POST","description":"user signup api","body":{"username":"testuser","email":"text@example.com","password":"Test1234"},"response":"status object"},"signin":{"name":"user","operation":"signin","route":"/api/v1/auth/signin","method":"POST","description":"user signin api","body":{"email":"text@example.com","password":"Test1234"},"response":"status object"},"logout":{"name":"user","operation":"logout","route":"/api/v1/auth/logout","method":"POST","description":"user logout api","body":{},"response":"status object"},"status":{"name":"user","operation":"status","route":"/api/v1/auth/status","method":"GET","description":"user login status api","response":"status code | user object"}},"beer":{"add":{"name":"beer","operation":"add","route":"/api/v1/beer/add","method":"POST","description":"beer add api","body":{"brand":"Pilsner Urqell","name":"Kozel","degree":11,"packaging":"can","photos":"optional field | max 4 images | formData"},"response":"status object | beer object"},"get":{"name":"beer","operation":"get","route":"/api/v1/beer/get","method":"GET","description":"beer get api","response":"status object | array of beer objects"},"del":{"name":"beer","operation":"del","route":"/api/v1/beer/del","method":"POST","description":"beer del api","body":{"_id":"6352b303b71cb62222f39895"},"response":"status object"},"edit":{"name":"beer","operation":"edit","route":"/api/v1/beer/edit","method":"POST","description":"beer edit api","body":{"_id":"6355b95dc03fad77bc380146","brand":"Pilsner Urqell","name":"Radegast","degree":12,"packaging":"bottle","imgs":[],"photos":"optional field | max 4 images | formData"},"response":"status object | beer data"}},"docs":{"get_all":{"name":"docs","operation":"get_all","route":"/api/v1","method":"GET","description":"Get docs json","response":"docs json"}},"review":{"add":{"name":"review","operation":"add","route":"/api/v1/review/add","method":"POST","description":"review add api","body":{"beer_id":"6352b303b71cb62222f39895","foam":3,"bitter_sweetness":2,"taste":5,"packaging":3,"sourness":false,"would_again":true},"response":"status object | review object"},"get":{"name":"review","operation":"get","route":"/api/v1/review/get","method":"GET","description":"review get api","response":"status object | array of review objects"},"del":{"name":"review","operation":"del","route":"/api/v1/review/del","method":"POST","description":"review del api","body":{"_id":"6352b303b71cb62222f39895"},"response":"status object"}}}}
|
@ -20,8 +20,7 @@ export const add = yup.object({
|
|||||||
packaging: yup.number().min(1).max(5).required(),
|
packaging: yup.number().min(1).max(5).required(),
|
||||||
sourness: yup.boolean().required(),
|
sourness: yup.boolean().required(),
|
||||||
would_again: yup.boolean().required(),
|
would_again: yup.boolean().required(),
|
||||||
user_id: yup.string().notRequired(),
|
user_id: yup.string().notRequired()
|
||||||
note: yup.string().notRequired()
|
|
||||||
});
|
});
|
||||||
export interface IReview extends yup.InferType<typeof add>, mongooseAddition {}
|
export interface IReview extends yup.InferType<typeof add>, mongooseAddition {}
|
||||||
export const addExam: IReview = {
|
export const addExam: IReview = {
|
||||||
@ -32,7 +31,6 @@ export const addExam: IReview = {
|
|||||||
packaging: 3,
|
packaging: 3,
|
||||||
sourness: false,
|
sourness: false,
|
||||||
would_again: true,
|
would_again: true,
|
||||||
note: "Pretty good beer"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove
|
// Remove
|
||||||
|
@ -73,15 +73,6 @@ describe("POST /api/v1/review/add", () => {
|
|||||||
expect(res.statusCode).toBe(400);
|
expect(res.statusCode).toBe(400);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should drop 201 (missing note)", async () => {
|
|
||||||
const jwt = await login();
|
|
||||||
const body: any = { ...addExam };
|
|
||||||
delete body.note;
|
|
||||||
const res = await request.post(url).set("Cookie", jwt).send(body);
|
|
||||||
|
|
||||||
expect(res.statusCode).toBe(201);
|
|
||||||
})
|
|
||||||
|
|
||||||
test("should drop 201", async () => {
|
test("should drop 201", async () => {
|
||||||
const jwt = await login();
|
const jwt = await login();
|
||||||
const res = await request.post(url).set("Cookie", jwt).send(addExam);
|
const res = await request.post(url).set("Cookie", jwt).send(addExam);
|
||||||
|
@ -1,43 +1,41 @@
|
|||||||
{
|
{
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "deguapp",
|
"name": "deguapp",
|
||||||
"slug": "deguapp",
|
"slug": "deguapp",
|
||||||
"scheme": "deguapp",
|
"scheme": "deguapp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
"userInterfaceStyle": "light",
|
"userInterfaceStyle": "light",
|
||||||
"splash": {
|
"splash": {
|
||||||
"image": "./assets/splash.png",
|
"image": "./assets/splash.png",
|
||||||
"resizeMode": "contain",
|
"resizeMode": "contain",
|
||||||
"backgroundColor": "#ffffff"
|
"backgroundColor": "#ffffff"
|
||||||
},
|
},
|
||||||
"assetBundlePatterns": [
|
"assetBundlePatterns": ["**/*"],
|
||||||
"**/*"
|
"ios": {
|
||||||
],
|
"supportsTablet": true
|
||||||
"ios": {
|
},
|
||||||
"supportsTablet": true
|
"android": {
|
||||||
},
|
"adaptiveIcon": {
|
||||||
"android": {
|
"foregroundImage": "./assets/adaptive-icon.png",
|
||||||
"adaptiveIcon": {
|
"backgroundColor": "#ffffff"
|
||||||
"foregroundImage": "./assets/adaptive-icon.png",
|
}
|
||||||
"backgroundColor": "#ffffff"
|
},
|
||||||
}
|
"web": {
|
||||||
},
|
"favicon": "./assets/favicon.png"
|
||||||
"web": {
|
},
|
||||||
"favicon": "./assets/favicon.png"
|
"plugins": [
|
||||||
},
|
"expo-router",
|
||||||
"plugins": [
|
[
|
||||||
"expo-router",
|
"expo-image-picker",
|
||||||
[
|
{
|
||||||
"expo-image-picker",
|
"photosPermission": "The app accesses your photos to let you share them with your friends.",
|
||||||
{
|
"cameraPermission": "The app accesses your camera to let you take photos of your beer and share them with your friends.",
|
||||||
"photosPermission": "The app accesses your photos to let you share them with your friends.",
|
"microphonePermission": "The app accesses your microphone to let you record audio and share it with your friends."
|
||||||
"cameraPermission": "The app accesses your camera to let you take photos of your beer and share them with your friends.",
|
}
|
||||||
"microphonePermission": "The app accesses your microphone to let you record audio and share it with your friends."
|
],
|
||||||
}
|
"expo-secure-store"
|
||||||
],
|
]
|
||||||
"expo-secure-store"
|
}
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,23 +16,28 @@ function SignupPage() {
|
|||||||
const { onSignin } = useAuth();
|
const { onSignin } = useAuth();
|
||||||
|
|
||||||
async function signin() {
|
async function signin() {
|
||||||
if (pass1 == pass2) {
|
if (pass1 != pass2) {
|
||||||
const res = await onSignin(username, email, pass1);
|
alert("Passwords are not same!");
|
||||||
if (res.error) {
|
return;
|
||||||
if (res.msg.message == "validation error") {
|
}
|
||||||
alert(res.msg.data.message);
|
|
||||||
} else {
|
const res = await onSignin(username, email, pass1);
|
||||||
alert(res.msg.message);
|
const data = await res.json();
|
||||||
}
|
|
||||||
}
|
if (res.status == 400) {
|
||||||
if (!res.error) {
|
if (data.message == "validation error") {
|
||||||
alert("You have been successfully registered. Please Log In");
|
alert(data.data.message);
|
||||||
router.replace("/login");
|
} else {
|
||||||
|
alert("Something went wrong");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert("Passwords are not same!");
|
if (res.status == 201) {
|
||||||
|
alert("You have been successfully registered. Please Log In");
|
||||||
|
router.replace("/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
||||||
"files": {
|
"files": {
|
||||||
"ignore": [".expo/", ".vscode/", "node_modules/"]
|
"ignore": [".expo/", ".vscode/", "node_modules/", "dist/"]
|
||||||
},
|
},
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
@ -1,42 +1,43 @@
|
|||||||
{
|
{
|
||||||
"name": "deguapp",
|
"name": "deguapp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "expo-router/entry",
|
"main": "expo-router/entry",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "expo start",
|
"start": "expo start",
|
||||||
"android": "expo start --android",
|
"android": "expo start --android",
|
||||||
"ios": "expo start --ios",
|
"ios": "expo start --ios",
|
||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"build:web": "npx expo export"
|
"build:web": "npx expo export",
|
||||||
},
|
"format": "npx @biomejs/biome format --write ."
|
||||||
"dependencies": {
|
},
|
||||||
"@expo/metro-runtime": "~3.2.1",
|
"dependencies": {
|
||||||
"@react-native-async-storage/async-storage": "^1.23.1",
|
"@expo/metro-runtime": "~3.2.1",
|
||||||
"@types/react": "~18.2.45",
|
"@react-native-async-storage/async-storage": "^1.23.1",
|
||||||
"axios": "^1.6.8",
|
"@types/react": "~18.2.45",
|
||||||
"expo": "^51.0.2",
|
"axios": "^1.6.8",
|
||||||
"expo-constants": "~16.0.1",
|
"expo": "^51.0.2",
|
||||||
"expo-image-picker": "~15.0.4",
|
"expo-constants": "~16.0.1",
|
||||||
"expo-linear-gradient": "~13.0.2",
|
"expo-image-picker": "~15.0.4",
|
||||||
"expo-linking": "~6.3.1",
|
"expo-linear-gradient": "~13.0.2",
|
||||||
"expo-router": "~3.5.11",
|
"expo-linking": "~6.3.1",
|
||||||
"expo-secure-store": "~13.0.1",
|
"expo-router": "~3.5.11",
|
||||||
"expo-status-bar": "~1.12.1",
|
"expo-secure-store": "~13.0.1",
|
||||||
"expo-system-ui": "~3.0.4",
|
"expo-status-bar": "~1.12.1",
|
||||||
"react": "18.2.0",
|
"expo-system-ui": "~3.0.4",
|
||||||
"react-dom": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-native": "0.74.1",
|
"react-dom": "18.2.0",
|
||||||
"react-native-dropdown-picker": "^5.4.6",
|
"react-native": "0.74.1",
|
||||||
"react-native-range-slider-expo": "^1.4.3",
|
"react-native-dropdown-picker": "^5.4.6",
|
||||||
"react-native-safe-area-context": "4.10.1",
|
"react-native-range-slider-expo": "^1.4.3",
|
||||||
"react-native-screens": "3.31.1",
|
"react-native-safe-area-context": "4.10.1",
|
||||||
"react-native-web": "~0.19.6",
|
"react-native-screens": "3.31.1",
|
||||||
"@shopify/flash-list": "1.6.4"
|
"react-native-web": "~0.19.6",
|
||||||
},
|
"@shopify/flash-list": "1.6.4"
|
||||||
"devDependencies": {
|
},
|
||||||
"@babel/core": "^7.20.0",
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.7.3",
|
"@babel/core": "^7.20.0",
|
||||||
"babel-plugin-module-resolver": "^5.0.2"
|
"@biomejs/biome": "1.7.3",
|
||||||
},
|
"babel-plugin-module-resolver": "^5.0.2"
|
||||||
"private": true
|
},
|
||||||
|
"private": true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user