Skip to content

Commit

Permalink
redis-implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
ARYPROGRAMMER committed Oct 6, 2024
1 parent f6185c4 commit 88171ca
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 24 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ jobs:
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/*"
tag: v2.0.7
tag: v2.0.8
token: ${{ secrets.TOKEN }}
name: "stable-v2.0.7"
name: "stable-v2.0.8"
body: |
## What's New in v2.0.7
## What's New in v2.0.8
- **Added Redis-base to support syncfusion**
- **Fixed Performance and Responsiveness Issues and Improved UI.
- **New Feature**: Implemented Syncfusion.
- **Bug Fixes**: Resolved major bugs pertaining to syncfusion.
- **Performance Improvements**: Optimized the UI load response time.
- **UI Enhancements**: Improved the home UI.
### Known Issues are Resolved.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Mindful-App](https://socialify.git.ci/ARYPROGRAMMER/Mindful-App/image?description=1&descriptionEditable=Mindful%20is%20a%20mental%20wellness%20app%20designed%20to%20support%20users%20in%20managing%20stress%20and%20anxiety&font=Source%20Code%20Pro&language=1&name=1&owner=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Dark)

[![Build Status](https://github.com/travisjeffery/timecop/workflows/CI/badge.svg)](https://github.com/ARYPROGRAMMER/Mindful-App/actions)
![version](https://img.shields.io/badge/version-2.0.7-blue)
![version](https://img.shields.io/badge/version-2.0.8-red)

<p align="center">
<img src="https://img.shields.io/badge/firebase-ffca28?style=for-the-badge&logo=firebase&logoColor=black"/>
Expand All @@ -12,15 +12,13 @@

**APP STATUS** : ALL CORE FUNCTIONALITIES WORKING (Deployed NodeJs & Postgresql on Render)

## What's New in v2.0.7
## What's New in v2.0.8

- **Added Redis-base to support syncfusion**
- **Fixed Performance and Responsiveness Issues and Improved UI.
- **New Feature**: Implemented Syncfusion.
- **Bug Fixes**: Resolved major bugs pertaining to syncfusion.
- **Performance Improvements**: Optimized the UI load response time.
- **UI Enhancements**: Improved the home UI.

### Known Issues are Resolved.
### Known Issues are Resolved.

[DEMO LINK OF WORKING](https://vimeo.com/1016496824?share=copy)

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.0.7
version: 2.0.8

environment:
sdk: ^3.5.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MeditationController{
const quotesRepository = new GeminiApi();

const getAdviceByMood = new GetAdviceByMood(quotesRepository);
const advice = await getAdviceByMood.execute();
const advice = await getAdviceByMood.execute(mood);
return res.json(advice);

}
Expand Down
19 changes: 19 additions & 0 deletions server/Mental Health api/adapters/controllers/userController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fetchmoodData = require("../../application/usecases/getmoodData");
class UserController{

static async usernames(req,res){
try{
const { username }= req.params;
const moodData = new fetchmoodData();
const moodata = await moodData.execute(username);

return res.json(moodata);
}

catch(err){
res.status(500).json({error: err.message});
}
}
}

module.exports = UserController;
1 change: 0 additions & 1 deletion server/Mental Health api/adapters/routes/songRoutes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const Song = require('../../domain/entities/song');
const SongController = require('../controllers/SongController');

const router = require('express').Router();
Expand Down
7 changes: 7 additions & 0 deletions server/Mental Health api/adapters/routes/userRoutes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const UserController = require('../../adapters/controllers/userController');

const router = require('express').Router();

router.get('/:username',UserController.usernames);

module.exports = router;
24 changes: 24 additions & 0 deletions server/Mental Health api/application/usecases/getmoodData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const UserName = require("../../domain/entities/user");
const { mooddatainfo } = require("../../infrastructure/db-fast/queries/userQueries");
const UseCaseInt = require("../interfaces/UseCaseInt");

class MoodData extends UseCaseInt{

async execute(username) {

const moodData = await mooddatainfo(username);
return moodData;
// return moodData.map((data) => new UserName (
// {
// happy: data.happy,
// sad: data.sad,
// neutral: data.neutral,
// calm: data.calm,
// relax: data.relax,
// focus: data.focus,

// }));
}
}

module.exports = MoodData;
3 changes: 0 additions & 3 deletions server/Mental Health api/application/usecases/getsongs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// fetch all songs from the database
//get daily quotes -> call gemini -> {morning,noon,evening}
//provide advice

const Song = require("../../domain/entities/song");
const { getAllSongs } = require("../../infrastructure/db/queries/songQueries");
Expand Down
14 changes: 14 additions & 0 deletions server/Mental Health api/domain/entities/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class UserName{
constructor(happy,sad,neutral,calm,relax,focus){

this.happy = happy;
this.sad = sad;
this.neutral = neutral;
this.calm = calm;
this.relax = relax;
this.focus = focus;

}
}

module.exports = UserName;
23 changes: 23 additions & 0 deletions server/Mental Health api/infrastructure/db-fast/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const Redis = require('redis');

const redis = Redis.createClient({
socket: {
host: 'redis-15193.c309.us-east-2-1.ec2.redns.redis-cloud.com',
port: 15193,
},
password: 'qJ3EEzX4aQ0LwiPCeP5sMAUZycRiNOK1'
});

redis.on('connect', () => {
console.log('Connected to Redis successfully!');
});

redis.on('error', (err) => {
console.error('Redis connection error:', err);
});

(async () => {
await redis.connect();
})();

module.exports = redis;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const redis = require('..');

const mooddatainfo = async (username) => {
try {
const mooddatas = await redis.get(username);
console.log('Raw value:', mooddatas);
return value;
} catch (err) {
console.error('Error fetching the value:', err);
}
}

module.exports = {mooddatainfo};
109 changes: 105 additions & 4 deletions server/Mental Health api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion server/Mental Health api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"llamaai": "^1.0.4",
"nodemon": "^3.1.7",
"openai": "^4.63.0",
"pg": "^8.13.0"
"pg": "^8.13.0",
"redis": "^4.7.0"
}
}
2 changes: 2 additions & 0 deletions server/Mental Health api/server.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const express = require('express');
const meditationRoutes = require('./adapters/routes/meditationRoutes');
const songRoutes = require('./adapters/routes/songRoutes');
const userRoutes = require('./adapters/routes/userRoutes');

const app = express();
const port = process.env.PORT || 6000;

app.use('/meditation', meditationRoutes);
app.use('/songs', songRoutes);
app.use('/user', userRoutes);

app.listen(port, () => {
console.log(`Server is running on port ${port}`);
Expand Down

0 comments on commit 88171ca

Please sign in to comment.