Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added YAUS frontend developed in C4GT"22 #56

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yaus_c4gt_backend/server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
77 changes: 77 additions & 0 deletions yaus_c4gt_backend/server/Stats_For_Links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const url_data=[

{
"customeHashID":'edu34',
"url":" https://yaus.xyz/education",
"date_created":"2022-07-09",
"no_of_clicks_overall":"3",
"no_of_views_overall":"8",
"no_of_opens_overall":"5",
"no_of_installs_overall":"89",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120001",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120002",
"daily_stats":[2,75,26,21,57,42,18],
"monthly_stats":[743,754,53,743,944,34,765,134,895,245,894,224]


},
{
"customeHashID":"gov32",
"url":"https://yaus.xyz/govt",
"date_created":"2022-06-22",
"no_of_clicks_overall":"33",
"no_of_views_overall":"28",
"no_of_opens_overall":"95",
"no_of_installs_overall":"64",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120007",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120003",
"daily_stats":[6,23,86,24,75,24,64],
"monthly_stats":[665,366,246,864,345,45,246,87,456,32,466,753]


},
{
"customeHashID":"des65",
"url":"https://yaus.xyz/design",
"date_created":"2022-07-19",
"no_of_clicks_overall":"34",
"no_of_views_overall":"86",
"no_of_opens_overall":"19",
"no_of_installs_overall":"23",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120008",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120004",
"daily_stats":[55,74,24,5,24,77,33],
"monthly_stats":[854,65,775,223,6565,784,775,24,633,675,687,355]

},
{
"customeHashID":"cre62",
"url":"https://yaus.xyz/create",
"date_created":"2022-07-03",
"no_of_clicks_overall":"31",
"no_of_views_overall":"68",
"no_of_opens_overall":"55",
"no_of_installs_overall":"32",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120009",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120005",
"daily_stats":[46,6,4,66,33,43,45],
"monthly_stats":[73,789,235,76,235,789,432,675,336,643,356,754]

},
{
"customeHashID":"cre31",
"url":" https://yaus.xyz/create",
"date_created":"2022-07-15",
"no_of_clicks_overall":"78",
"no_of_views_overall":"15",
"no_of_opens_overall":"46",
"no_of_installs_overall":"85",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120000",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120006",
"daily_stats":[65,33,76,24,85,25,86],
"monthly_stats":[356,64,78,335,754,23,67,24,687,344,68,245]

}
];

module.exports=url_data;
55 changes: 55 additions & 0 deletions yaus_c4gt_backend/server/dashboard_table_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module.exports=[{
"url":" https://yaus.xyz/education",
"date_created":"2022-07-09",
"no_of_clicks":"3",
"no_of_views":"8",
"no_of_opens":"5",
"no_of_installs":"89",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120001",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120002"

},
{
"url":" https://yaus.xyz/govt",
"date_created":"2022-06-22",
"no_of_clicks":"33",
"no_of_views":"28",
"no_of_opens":"95",
"no_of_installs":"64",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120007",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120003",

},
{
"url":" https://yaus.xyz/design",
"date_created":"2022-07-19",
"no_of_clicks":"34",
"no_of_views":"86",
"no_of_opens":"19",
"no_of_installs":"23",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120008",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120004",

},
{
"url":" https://yaus.xyz/create",
"date_created":"2022-07-03",
"no_of_clicks":"31",
"no_of_views":"68",
"no_of_opens":"55",
"no_of_installs":"32",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120009",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120005",

},
{
"url":" https://yaus.xyz/create",
"date_created":"2022-06-15",
"no_of_clicks":"78",
"no_of_views":"15",
"no_of_opens":"46",
"no_of_installs":"85",
"userID":"0fe6ff38-fc46-11ec-b939-0242ac120000",
"projectID":"0fe6ff38-fc46-11ec-b939-0242ac120006",
}
];
65 changes: 65 additions & 0 deletions yaus_c4gt_backend/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const express = require("express");
const app = express();
const cors = require("cors");
const bodyParser = require("body-parser");
const dashboard_table_data= require("./dashboard_table_data");
const main_dashboard_chart_data =require("./main_dashboard_chart_data")
const url_data =require("./Stats_For_Links")
const link_manager_data=require("./link_manager_data")
const recent_activity_data=require("./recent_activity_data")
require("dotenv").config();

app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const PORT = process.env.PORT || 3233;

app.get("/", (req, res) => {
res.send("Api is running.");
});

// for dashboard table data

app.get("/dashboard_table", (req, res) => {
res.set("Access-Control-Allow-Origin", "*");
res.json(dashboard_table_data);
});


// for the main deshboard chart
app.get("/main_dashboard_chart", (req, res) => {
res.set("Access-Control-Allow-Origin", "*");
res.json(main_dashboard_chart_data);
});

// for specific link stats

// app.get('/:customeHashID',(req, res) => {
// res.set("Access-Control-Allow-Origin", "*");
// const {customeHashID} =req.params;
// console.log(req.params);
// const singleID=url_data.find((single)=>single.customeHashID===customeHashID);
// console.log(singleID);
// if(!singleID){
// return res.status(404).send('ID not found')
// }
// res.json(singleID);
// });

// for link manager

app.get("/link_manager_data", (req, res) => {
res.set("Access-Control-Allow-Origin", "*");
res.json(link_manager_data);
});

// for recent activities
app.get("/recent_activity_data", (req, res) => {
res.set("Access-Control-Allow-Origin", "*");
res.json(recent_activity_data);
});


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

module.exports = app;
43 changes: 43 additions & 0 deletions yaus_c4gt_backend/server/link_manager_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports=[{
"url":" https://yaus.xyz/sunbird437",
"date_created":"2022-07-09",
"title":"Test",
"no_of_clicks":"335",
"no_of_opens":"144",

},
{
"url":" https://yaus.xyz/sunbird842",
"date_created":"2022-06-22",
"title":"Test",
"no_of_clicks":"125",
"no_of_opens":"110",


},
{
"url":" https://yaus.xyz/sunbird371",
"date_created":"2022-07-19",
"no_of_clicks":"194",
"title":"Test",
"no_of_opens":"139",


},
{
"url":" https://yaus.xyz/sunbird752",
"date_created":"2022-07-03",
"title":"Test",
"no_of_clicks":"168",
"no_of_opens":"128",


},
{
"url":" https://yaus.xyz/create",
"date_created":"2022-06-15",
"no_of_clicks":"178",
"title":"Test",
"no_of_opens":"146",
}
];
37 changes: 37 additions & 0 deletions yaus_c4gt_backend/server/main_dashboard_chart_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports=
[

{
"month":"jan",
"url_created":"53"
},
{
"month":"feb",
"url_created":"62"
},
{
"month":"mar",
"url_created":"70"
},
{
"month":"apr",
"url_created":"67"
},
{
"month":"may",
"url_created":"77"
},
{
"month":"jun",
"url_created":"84"
},
{
"month":"jul",
"url_created":"90"
},
{
"month":"aug",
"url_created":"95"
},
]

55 changes: 55 additions & 0 deletions yaus_c4gt_backend/server/models/dashboard_schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const mongoose=require('mongoose')

const dashboardSchema=mongoose.Schema({
"type": "object",
"properties": {
"url": {
"type": "string"
},
"date-created": {
"type": "date string"
},
"no_of_clicks": {
"type": "integer"
},
"no_of_views": {
"type": "integer"
},
"no_of_opens": {
"type": "integer"
},
"userID": {
"type": "string"
},
"projectID": {
"type": "string"
},
"per_day_clicks": {
"type": "integer"
},
"per_week_clicks": {
"type": "integer"
},
"per_year_clicks": {
"type": "integer"
}
},
"required": [
"url",
"date-created",
"no_of_clicks",
"no_of_views",
"no_of_opens",
"userID",
"projectID",
"per_day_clicks",
"per_week_clicks",
"per_year_clicks"
]

})
const Dashboard=mongoose.model('Dashboard',dashboardSchema)



module.exports=Dashboard;
Loading