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

circle ci fix, account page progress, axios rework #155

Merged
merged 14 commits into from
Nov 23, 2021
Merged
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
ls # for debugging: show sub-directories in here
- run: |
cd front-end
npm config set legacy-peer-deps true # use legacy peer deps for real fix
npm install # install all dependencies listed in package.json
npm run build # have react build the stand-alone front-end code

Expand Down
26 changes: 19 additions & 7 deletions back-end/Controllers/UniController/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,34 @@ const UniService = require("./../../Services/UniService")

// Display list of all unis.
exports.uni_list = function (req, res) {
res.send(UniService.uniData.map(uni => ({uniID: uni.uniID, uniLogoPath: uni.uniLogoPath, uniName: uni.uniName, uniStudentCount: uni.uniStudents.length})))
res.send(UniService.uniData.map(uni => (
{
uniID: uni.uniID,
uniLogoPath: uni.uniLogoPath,
uniName: uni.uniName,
uniStudentCount: uni.uniStudents.length
}
)
)
)
};

// Display detail page for a specific uni.
exports.uni_detail = function (req, res) {
res.send('NOT IMPLEMENTED: uni detail: ' + req.params.id);
};

// Display uni create form on GET.
exports.uni_create_get = function (req, res) {
res.send('NOT IMPLEMENTED: uni create GET');
};

// Handle uni create on POST.
exports.uni_create_post = function (req, res) {
res.send('NOT IMPLEMENTED: uni create POST');
exports.uni_create = function (req, res) {
const data = req.body;
const { uniName, uniLogoPath } = data

//an example situation:
//make a call to service.createuni
//make a call to service.addCoursesToUni()

//res.send('NOT IMPLEMENTED: uni create POST');
};

// Display uni delete form on GET.
Expand Down
8 changes: 6 additions & 2 deletions back-end/Controllers/UserController/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
* we will implement this when we have the mongodb models, schemas ...
* */

const UserService = require('./../../Services/UserService')

// Display list of all users.
exports.user_list = function (req, res) {
res.send('NOT IMPLEMENTED: user list');
res.send('NOT IMPLEMENTED: user list: ');
};

// Display detail page for a specific user.
exports.user_detail = function (req, res) {
res.send('NOT IMPLEMENTED: user detail: ' + req.params.id);

const currentUser = UserService.get_user(req.body.userID)
res.send(currentUser);
};

// Display user create form on GET.
Expand Down
2 changes: 2 additions & 0 deletions back-end/Services/UniService/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ exports.uniData = uniData
//everything containing uniID, uniName, uniLogoPath but it doesnt need uniStudent[] and UniCourses[]
// as there might not be any student registered.

//TODO we should have a mongoose instance here for all the
//post requests that are going to be processed by the srevices

/**
* Get uni by uniID
Expand Down
6 changes: 1 addition & 5 deletions back-end/routes/Account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ var router = express.Router({ mergeParams: true });
var { userController } = require('../../Controllers');



router.get('/', (req, res) => {

res.send('Account Request Received')
})
router.post('/', userController.user_detail)

router.post('/edit', (req, res) => {
res.send('Account edit req by user: USER_ID')
Expand Down
2 changes: 1 addition & 1 deletion back-end/routes/Chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ router.post('/:chatID/newMessage', (req, res) => {
})

//chat like/unlike message
router.post('/:chatID/newMessage', (req, res) => {
router.post('/:chatID/likeMessage', (req, res) => {

res.send("Chat add messages req for chat: CHAT_ID, by user: USER_ID, message: message_id")
})
Expand Down
4 changes: 2 additions & 2 deletions back-end/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ var mongoose = require('mongoose');
var mongoDB = process.env.DB_URL;
mongoose.connect(mongoDB, { useNewUrlParser: true, useUnifiedTopology: true });
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));
db.on('error', console.error.bind(console, 'MongoDB connection error:'));



app.use(cors())
Expand Down
Loading