Compare commits
14 Commits
2041c8998a
...
fr/testing
Author | SHA1 | Date | |
---|---|---|---|
82a24efd91 | |||
5f29773b4a | |||
7eb548e138 | |||
6c2ebe7d7a | |||
1dd7952976 | |||
922a11b23b | |||
5a2a2db5e2 | |||
61449caef1 | |||
c9b8246218 | |||
c89dfa6786 | |||
8f3e442077 | |||
0430710522 | |||
c1805643c8 | |||
f1c296c0d3 |
32
.gitea/workflows/build.yaml
Normal file
32
.gitea/workflows/build.yaml
Normal 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
|
||||
|
28
README.md
28
README.md
@ -35,7 +35,12 @@ To get started with DeguApp, follow these steps:
|
||||
2. Install dependencies:
|
||||
|
||||
```bash
|
||||
cd deguapp
|
||||
# frontend
|
||||
cd deguapp/frontend
|
||||
npm install
|
||||
|
||||
# backend
|
||||
cd deguapp/api
|
||||
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!
|
||||
|
||||
## 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
|
||||
### Android
|
||||
|
||||
@ -74,12 +74,24 @@ bundletool build-apks --bundle=./frontend/android/app/build/outputs/bundle/relea
|
||||
bundletool install-apks --apks=./deguapp.apks
|
||||
```
|
||||
|
||||
|
||||
### Resources:
|
||||
#### Resources:
|
||||
|
||||
- https://github.com/expo/eas-cli/issues/1300
|
||||
- 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
|
||||
|
||||
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
|
||||
app.use(routes);
|
||||
|
||||
//test
|
||||
|
@ -5,9 +5,9 @@ export const router = Router();
|
||||
|
||||
router.use("/api/v1", api_v1);
|
||||
|
||||
//router.get("*", (req: Request, res: Response) => {
|
||||
// res.sendFile(path.join(__dirname, "../views/index.html"));
|
||||
//});
|
||||
router.get("*", (req: Request, res: Response) => {
|
||||
res.sendFile(path.join(__dirname, "../public/index.html"));
|
||||
});
|
||||
|
||||
// 404
|
||||
router.use((req: Request, res: Response) => {
|
||||
|
@ -1,43 +1,41 @@
|
||||
{
|
||||
"expo": {
|
||||
"name": "deguapp",
|
||||
"slug": "deguapp",
|
||||
"scheme": "deguapp",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"assetBundlePatterns": [
|
||||
"**/*"
|
||||
],
|
||||
"ios": {
|
||||
"supportsTablet": true
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
}
|
||||
},
|
||||
"web": {
|
||||
"favicon": "./assets/favicon.png"
|
||||
},
|
||||
"plugins": [
|
||||
"expo-router",
|
||||
[
|
||||
"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.",
|
||||
"microphonePermission": "The app accesses your microphone to let you record audio and share it with your friends."
|
||||
}
|
||||
],
|
||||
"expo-secure-store"
|
||||
]
|
||||
}
|
||||
"expo": {
|
||||
"name": "deguapp",
|
||||
"slug": "deguapp",
|
||||
"scheme": "deguapp",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"assetBundlePatterns": ["**/*"],
|
||||
"ios": {
|
||||
"supportsTablet": true
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
}
|
||||
},
|
||||
"web": {
|
||||
"favicon": "./assets/favicon.png"
|
||||
},
|
||||
"plugins": [
|
||||
"expo-router",
|
||||
[
|
||||
"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.",
|
||||
"microphonePermission": "The app accesses your microphone to let you record audio and share it with your friends."
|
||||
}
|
||||
],
|
||||
"expo-secure-store"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { View, StyleSheet, FlatList } from "react-native";
|
||||
import { View, StyleSheet, FlatList, Image } from "react-native";
|
||||
import Text from "@components/Text";
|
||||
import Button from "@components/Button";
|
||||
import { colors } from "@components/style";
|
||||
@ -14,6 +14,8 @@ export default function Tab() {
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
const API_HOST = process.env.EXPO_PUBLIC_API_URL.replace("/api/v1", "");
|
||||
|
||||
async function fetchData() {
|
||||
try {
|
||||
const res = await fetch(`${process.env.EXPO_PUBLIC_API_URL}/review/get`, {
|
||||
@ -23,6 +25,28 @@ export default function Tab() {
|
||||
let data = await res.json();
|
||||
// show only logged in user's data
|
||||
data = data.data.filter((review) => review.user_id == user._id);
|
||||
|
||||
let beers = await fetch(`${process.env.EXPO_PUBLIC_API_URL}/beer/get`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
});
|
||||
beers = await beers.json();
|
||||
beers = beers.data;
|
||||
console.log(beers);
|
||||
|
||||
async function getBeerParam(search, beers) {
|
||||
for (let i = 0; i < beers.length; i++) {
|
||||
if (beers[i]._id == search) {
|
||||
return beers[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
data.forEach(async (el) => {
|
||||
el.beer = await getBeerParam(el.beer_id, beers);
|
||||
});
|
||||
|
||||
console.log("reviews", data);
|
||||
setData(data);
|
||||
} catch (err) {
|
||||
@ -30,27 +54,53 @@ export default function Tab() {
|
||||
alert("Something went wrong");
|
||||
}
|
||||
}
|
||||
const opt3 = ["Bad", "Medium", "Excellent!"];
|
||||
const opt5 = [
|
||||
"Disgust",
|
||||
"Not great, not terrible",
|
||||
"Good",
|
||||
"Why not?",
|
||||
"Excellent!",
|
||||
];
|
||||
const opt2 = ["Yes", "No"];
|
||||
const sourness = ["Good", "Bad"];
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button
|
||||
title="Add Review"
|
||||
color={colors.gold}
|
||||
onPress={() => {
|
||||
router.replace("/review/add");
|
||||
}}
|
||||
/>
|
||||
|
||||
<FlatList
|
||||
data={data}
|
||||
style={styles.reviewList}
|
||||
keyExtractor={(item) => String(item._id)}
|
||||
renderItem={({ item }) => (
|
||||
<View style={styles.item}>
|
||||
<Text>Name: {item.name}</Text>
|
||||
<Text>Brand: {item.brand}</Text>
|
||||
<Text>Degree: {item.degree}</Text>
|
||||
<Text>Packaging: {item.packaging}</Text>
|
||||
<View style={styles.itemContainer}>
|
||||
<View>
|
||||
<Text>{item.beer.name}</Text>
|
||||
<Text>{item.beer.brand}</Text>
|
||||
<Text>{item.beer.degree}°</Text>
|
||||
<Text>{item.beer.packaging}</Text>
|
||||
<Image
|
||||
source={
|
||||
item.beer.imgs[0]
|
||||
? {
|
||||
uri: `${API_HOST}/public/uploads/${item.beer.imgs[0]}`,
|
||||
}
|
||||
: {
|
||||
uri: "https://imagesvc.meredithcorp.io/v3/mm/image?url=https:%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F44%2F2020%2F09%2F29%2Flight-beer.jpg",
|
||||
}
|
||||
}
|
||||
style={styles.itemImg}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<Text>Foam → {opt3[item.foam - 1]}</Text>
|
||||
<Text>
|
||||
Bitter / Sweetness → {opt3[item.bitter_sweetness - 1]}
|
||||
</Text>
|
||||
<Text>Taste → {opt5[item.taste - 1]}</Text>
|
||||
<Text>Packaging → {opt5[item.packaging - 1]}</Text>
|
||||
<Text>Sourness → {sourness[item.sourness - 1]}</Text>
|
||||
<Text>Would again? → {opt2[item.would_again - 1]}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
/>
|
||||
@ -70,11 +120,20 @@ export const styles = StyleSheet.create({
|
||||
paddingHorizontal: "15%",
|
||||
marginTop: "5%",
|
||||
},
|
||||
item: {
|
||||
itemContainer: {
|
||||
borderColor: "gray",
|
||||
borderWidth: 1,
|
||||
borderRadius: 10,
|
||||
padding: 13,
|
||||
marginBottom: "5%",
|
||||
flex: 1,
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
},
|
||||
itemImg: {
|
||||
width: 150,
|
||||
aspectRatio: 1,
|
||||
resizeMode: "contain",
|
||||
marginTop: "5%",
|
||||
},
|
||||
});
|
||||
|
@ -16,23 +16,28 @@ function SignupPage() {
|
||||
const { onSignin } = useAuth();
|
||||
|
||||
async function signin() {
|
||||
if (pass1 == pass2) {
|
||||
const res = await onSignin(username, email, pass1);
|
||||
if (res.error) {
|
||||
if (res.msg.message == "validation error") {
|
||||
alert(res.msg.data.message);
|
||||
} else {
|
||||
alert(res.msg.message);
|
||||
}
|
||||
}
|
||||
if (!res.error) {
|
||||
alert("You have been successfully registered. Please Log In");
|
||||
router.replace("/login");
|
||||
if (pass1 != pass2) {
|
||||
alert("Passwords are not same!");
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await onSignin(username, email, pass1);
|
||||
const data = await res.json();
|
||||
|
||||
if (res.status == 400) {
|
||||
if (data.message == "validation error") {
|
||||
alert(data.data.message);
|
||||
} else {
|
||||
alert("Something went wrong");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
alert("Passwords are not same!");
|
||||
if (res.status == 201) {
|
||||
alert("You have been successfully registered. Please Log In");
|
||||
router.replace("/login");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
||||
"files": {
|
||||
"ignore": [".expo/", ".vscode/", "node_modules/"]
|
||||
"ignore": [".expo/", ".vscode/", "node_modules/", "dist/"]
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
|
@ -1,41 +1,43 @@
|
||||
{
|
||||
"name": "deguapp",
|
||||
"version": "1.0.0",
|
||||
"main": "expo-router/entry",
|
||||
"scripts": {
|
||||
"start": "expo start",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"web": "expo start --web"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/metro-runtime": "~3.2.1",
|
||||
"@react-native-async-storage/async-storage": "^1.23.1",
|
||||
"@types/react": "~18.2.45",
|
||||
"axios": "^1.6.8",
|
||||
"expo": "^51.0.2",
|
||||
"expo-constants": "~16.0.1",
|
||||
"expo-image-picker": "~15.0.4",
|
||||
"expo-linear-gradient": "~13.0.2",
|
||||
"expo-linking": "~6.3.1",
|
||||
"expo-router": "~3.5.11",
|
||||
"expo-secure-store": "~13.0.1",
|
||||
"expo-status-bar": "~1.12.1",
|
||||
"expo-system-ui": "~3.0.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-native": "0.74.1",
|
||||
"react-native-dropdown-picker": "^5.4.6",
|
||||
"react-native-range-slider-expo": "^1.4.3",
|
||||
"react-native-safe-area-context": "4.10.1",
|
||||
"react-native-screens": "3.31.1",
|
||||
"react-native-web": "~0.19.6",
|
||||
"@shopify/flash-list": "1.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@biomejs/biome": "1.7.3",
|
||||
"babel-plugin-module-resolver": "^5.0.2"
|
||||
},
|
||||
"private": true
|
||||
"name": "deguapp",
|
||||
"version": "1.0.0",
|
||||
"main": "expo-router/entry",
|
||||
"scripts": {
|
||||
"start": "expo start",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"web": "expo start --web",
|
||||
"build:web": "npx expo export",
|
||||
"format": "npx @biomejs/biome format --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/metro-runtime": "~3.2.1",
|
||||
"@react-native-async-storage/async-storage": "^1.23.1",
|
||||
"@types/react": "~18.2.45",
|
||||
"axios": "^1.6.8",
|
||||
"expo": "^51.0.2",
|
||||
"expo-constants": "~16.0.1",
|
||||
"expo-image-picker": "~15.0.4",
|
||||
"expo-linear-gradient": "~13.0.2",
|
||||
"expo-linking": "~6.3.1",
|
||||
"expo-router": "~3.5.11",
|
||||
"expo-secure-store": "~13.0.1",
|
||||
"expo-status-bar": "~1.12.1",
|
||||
"expo-system-ui": "~3.0.4",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-native": "0.74.1",
|
||||
"react-native-dropdown-picker": "^5.4.6",
|
||||
"react-native-range-slider-expo": "^1.4.3",
|
||||
"react-native-safe-area-context": "4.10.1",
|
||||
"react-native-screens": "3.31.1",
|
||||
"react-native-web": "~0.19.6",
|
||||
"@shopify/flash-list": "1.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
"@biomejs/biome": "1.7.3",
|
||||
"babel-plugin-module-resolver": "^5.0.2"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
Reference in New Issue
Block a user