Compare commits

..

11 Commits

Author SHA1 Message Date
19a3d168a1 Changes in text 2024-06-03 16:30:24 +02:00
81ce9eb546 Merge pull request 'Fixes: error handling on login page #13' (#39) from fr/error-handling-login into main
Reviewed-on: #39
2024-06-03 16:21:31 +02:00
d40af87c46 Fixes: error handling on login page #13
Some checks failed
Build DeguApp backend / build (pull_request) Failing after 2m11s
2024-06-03 16:19:32 +02:00
7eb548e138 Added: gitea action for backend 2024-06-03 13:22:25 +02:00
6c2ebe7d7a Added: dist/ to biome ignore 2024-06-02 23:06:58 +02:00
1dd7952976 Code formatted 2024-06-02 23:06:32 +02:00
922a11b23b Added: package.json format script 2024-06-02 23:05:57 +02:00
5a2a2db5e2 Fixes: error handling on signup page #13 2024-06-02 23:04:42 +02:00
61449caef1 Updated README.md 2024-06-02 22:34:07 +02:00
c9b8246218 Fix: route for frontend 2024-05-16 15:41:24 +02:00
c89dfa6786 Added: script for building website version 2024-05-15 03:04:16 +02:00
11 changed files with 170 additions and 117 deletions

View File

@ -0,0 +1,32 @@
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
working-directory: api/
run: |
npm install
- name: npm run build
working-directory: api/
run: |
npm run build --if-present
- name: npm run test
working-directory: api/
run: |
npm run test

View File

@ -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.

View File

@ -5,9 +5,9 @@ export const router = Router();
router.use("/api/v1", api_v1); router.use("/api/v1", api_v1);
//router.get("*", (req: Request, res: Response) => { router.get("*", (req: Request, res: Response) => {
// res.sendFile(path.join(__dirname, "../views/index.html")); res.sendFile(path.join(__dirname, "../public/index.html"));
//}); });
// 404 // 404
router.use((req: Request, res: Response) => { router.use((req: Request, res: Response) => {

View File

@ -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" }
]
}
} }

View File

@ -18,7 +18,7 @@ export default function BeerAdd() {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [items, setItems] = useState([ const [items, setItems] = useState([
{ label: "Tank beer", value: "tank" }, { label: "Tank beer", value: "tank" },
{ label: "Cask beer", value: "cask" }, { label: "Keg beer", value: "keg" },
{ label: "Glass bottle", value: "glass" }, { label: "Glass bottle", value: "glass" },
{ label: "Can", value: "can" }, { label: "Can", value: "can" },
{ label: "PET bottle", value: "pet" }, { label: "PET bottle", value: "pet" },

View File

@ -19,7 +19,7 @@ export default function reviewAdd() {
const [openSourness, setOpenSourness] = useState(false); const [openSourness, setOpenSourness] = useState(false);
const [openAgain, setOpenAgain] = useState(false); const [openAgain, setOpenAgain] = useState(false);
// pěna // foam
const [itemFoam, setFoamValue] = useState(null); const [itemFoam, setFoamValue] = useState(null);
const [foam, setFoam] = useState([ const [foam, setFoam] = useState([
{ {
@ -54,11 +54,11 @@ export default function reviewAdd() {
}, },
]); ]);
// hořkost / sladkost // bitter / sweetness
const [itemBitter_sweetness, setBitter_sweetnessValue] = useState(null); const [itemBitter_sweetness, setBitter_sweetnessValue] = useState(null);
const [bitter_sweetness, setBitter_sweetness] = useState([ const [bitter_sweetness, setBitter_sweetness] = useState([
{ {
label: "Bad", label: "Bitter",
value: "1", value: "1",
icon: () => ( icon: () => (
<Image <Image
@ -78,7 +78,7 @@ export default function reviewAdd() {
), ),
}, },
{ {
label: "Excellent", label: "Sweet",
value: "3", value: "3",
icon: () => ( icon: () => (
<Image <Image
@ -89,7 +89,7 @@ export default function reviewAdd() {
}, },
]); ]);
//chuť // taste
const [itemTaste, setTasteValue] = useState(null); const [itemTaste, setTasteValue] = useState(null);
const [taste, setTaste] = useState([ const [taste, setTaste] = useState([
{ {
@ -199,7 +199,7 @@ export default function reviewAdd() {
}, },
]); ]);
//kyselost // sourness
const [itemSourness, setSournessValue] = useState(null); const [itemSourness, setSournessValue] = useState(null);
const [sourness, setSourness] = useState([ const [sourness, setSourness] = useState([
{ {
@ -224,7 +224,7 @@ export default function reviewAdd() {
}, },
]); ]);
//dal bych si znovu? // would again
const [itemAgain, setAgainValue] = useState(null); const [itemAgain, setAgainValue] = useState(null);
const [again, setAgain] = useState([ const [again, setAgain] = useState([
{ {

View File

@ -90,7 +90,7 @@ export function AuthProvider({ children }) {
}); });
if (resUser.status != 200) { if (resUser.status != 200) {
throw Error("user does not have user data"); throw Error("Username or password is incorrect!");
} }
const userData = await resUser.json(); const userData = await resUser.json();
@ -104,7 +104,7 @@ export function AuthProvider({ children }) {
await storageUtil.setItem(TOKEN_KEY, loginData.data.jwt); await storageUtil.setItem(TOKEN_KEY, loginData.data.jwt);
} catch (err) { } catch (err) {
console.error("Failed to log in", err); console.error("Failed to log in", err);
return { error: true, msg: err.res }; return { error: true, msg: err };
} }
} }

View File

@ -20,8 +20,12 @@ function LoginPage() {
} }
}, [authState.authenticated]); }, [authState.authenticated]);
function login() { async function login() {
onLogin(email, pass); const res = await onLogin(email, pass);
if (res !== undefined && res.error === true) {
alert(res.msg);
return;
}
} }
return ( return (

View File

@ -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 (

View File

@ -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

View File

@ -1,41 +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",
"dependencies": { "format": "npx @biomejs/biome format --write ."
"@expo/metro-runtime": "~3.2.1", },
"@react-native-async-storage/async-storage": "^1.23.1", "dependencies": {
"@types/react": "~18.2.45", "@expo/metro-runtime": "~3.2.1",
"axios": "^1.6.8", "@react-native-async-storage/async-storage": "^1.23.1",
"expo": "^51.0.2", "@types/react": "~18.2.45",
"expo-constants": "~16.0.1", "axios": "^1.6.8",
"expo-image-picker": "~15.0.4", "expo": "^51.0.2",
"expo-linear-gradient": "~13.0.2", "expo-constants": "~16.0.1",
"expo-linking": "~6.3.1", "expo-image-picker": "~15.0.4",
"expo-router": "~3.5.11", "expo-linear-gradient": "~13.0.2",
"expo-secure-store": "~13.0.1", "expo-linking": "~6.3.1",
"expo-status-bar": "~1.12.1", "expo-router": "~3.5.11",
"expo-system-ui": "~3.0.4", "expo-secure-store": "~13.0.1",
"react": "18.2.0", "expo-status-bar": "~1.12.1",
"react-dom": "18.2.0", "expo-system-ui": "~3.0.4",
"react-native": "0.74.1", "react": "18.2.0",
"react-native-dropdown-picker": "^5.4.6", "react-dom": "18.2.0",
"react-native-range-slider-expo": "^1.4.3", "react-native": "0.74.1",
"react-native-safe-area-context": "4.10.1", "react-native-dropdown-picker": "^5.4.6",
"react-native-screens": "3.31.1", "react-native-range-slider-expo": "^1.4.3",
"react-native-web": "~0.19.6", "react-native-safe-area-context": "4.10.1",
"@shopify/flash-list": "1.6.4" "react-native-screens": "3.31.1",
}, "react-native-web": "~0.19.6",
"devDependencies": { "@shopify/flash-list": "1.6.4"
"@babel/core": "^7.20.0", },
"@biomejs/biome": "1.7.3", "devDependencies": {
"babel-plugin-module-resolver": "^5.0.2" "@babel/core": "^7.20.0",
}, "@biomejs/biome": "1.7.3",
"private": true "babel-plugin-module-resolver": "^5.0.2"
},
"private": true
} }