-
Notifications
You must be signed in to change notification settings - Fork 2
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
Endpoint to retrieve the last uploaded CVs #95 #155
Conversation
useEffect(() => { | ||
(async () => { | ||
const result = await fetch('/api/usercv').then((res) => res.json()); | ||
console.log(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets remove console.logs
setCvs(result); | ||
})(); | ||
}, []); | ||
console.log(cvs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets remove console.logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okey, thanks ,.,i will remove all console.logs
import React, { useState, useEffect } from 'react'; | ||
import { CardCvViewSearchComponent } from '../CardCvViewSearchComponent/CardCvViewSearchComponent'; | ||
|
||
export default function RetriveCvs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default function RetriveCvs() { | |
export default function RetrieveCvs() { |
console.log(cvs); | ||
return ( | ||
<div> | ||
{cvs.slice(-3).map((item) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this sliced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to upload only 3 last uploaded cvs,. The original array will not be modified, but the task requires that we show only 3 latest cvs,.,Thats why i use slice like in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice ,.,.,under parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use conditions instead by using array length and boolean value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that .slice (-3) working fine to isplay last 3 cvs
Thanks Mr Kamal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the Frontend changes on this PR.
This PR should be have endpoint code
45056a6
to
9eedd22
Compare
* @swagger | ||
* /modules: | ||
* get: | ||
* summary: Get all cvs and users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should say that there is a limit on 20?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, Patrick,.let me change on swagger documentation, Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, only have some minor suggestions.
|
||
const knex = require('../../config/db'); | ||
|
||
const getCvsnUsers = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think getUserCvs
makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, let me change it and push again, thanks,
24bdc0f
to
e30c2a3
Compare
Has been resolved.
Title : Endpoint to retrieve the last uploaded CVs #95
One can retrieve from the DB a list the 3 last upload CVs or All the whole list (limit to 20), so that you can view them on Frontend.
Fixes # #95
How to test?
On frontend, you can see the 3 last uploaded CVs as below;
On backend Testing,., I joined users and cv tables, I created new usercv router and usercv controller. I also limit the cvs numbers to be fetched from backend to max 20 cvs. see joined table below;
Checklist