Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CaCaoCritics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bilel El Yaagoubi
CaCaoCritics
Commits
732165f6
Commit
732165f6
authored
3 years ago
by
Bilel El Yaagoubi
Browse files
Options
Downloads
Patches
Plain Diff
hop
parent
ced1dd1f
No related branches found
No related tags found
1 merge request
!23
Show liked movies
Pipeline
#42639
passed
3 years ago
Stage: lint
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/routes/users.js
+8
-0
8 additions, 0 deletions
backend/routes/users.js
frontend/src/router/index.js
+6
-0
6 additions, 0 deletions
frontend/src/router/index.js
frontend/src/views/Users.vue
+47
-18
47 additions, 18 deletions
frontend/src/views/Users.vue
with
61 additions
and
18 deletions
backend/routes/users.js
+
8
−
0
View file @
732165f6
...
@@ -9,6 +9,14 @@ router.get("/", function (req, res) {
...
@@ -9,6 +9,14 @@ router.get("/", function (req, res) {
});
});
});
});
router
.
get
(
"
/likedMovies/:userId
"
,
async
function
(
req
,
res
)
{
const
userId
=
await
req
.
params
[
"
userId
"
];
const
userPopulated
=
await
UserModel
.
findById
(
userId
).
populate
(
"
liked_movies
"
);
res
.
send
(
userPopulated
.
liked_movies
);
});
router
.
get
(
"
/isliked/:movieId/:userId
"
,
async
function
(
req
,
res
)
{
router
.
get
(
"
/isliked/:movieId/:userId
"
,
async
function
(
req
,
res
)
{
const
userId
=
await
req
.
params
[
"
userId
"
];
const
userId
=
await
req
.
params
[
"
userId
"
];
console
.
log
(
userId
);
console
.
log
(
userId
);
...
...
This diff is collapsed.
Click to expand it.
frontend/src/router/index.js
+
6
−
0
View file @
732165f6
...
@@ -3,6 +3,7 @@ import Home from "../views/Home.vue";
...
@@ -3,6 +3,7 @@ import Home from "../views/Home.vue";
import
Connexion
from
"
../views/Connexion.vue
"
;
import
Connexion
from
"
../views/Connexion.vue
"
;
import
Users
from
"
../views/Users.vue
"
;
import
Users
from
"
../views/Users.vue
"
;
import
AddUser
from
"
../views/AddUsers.vue
"
;
import
AddUser
from
"
../views/AddUsers.vue
"
;
import
MoviePage
from
"
../views/MoviePage
"
;
const
routes
=
[
const
routes
=
[
{
{
...
@@ -25,6 +26,11 @@ const routes = [
...
@@ -25,6 +26,11 @@ const routes = [
name
:
"
AddUsers
"
,
name
:
"
AddUsers
"
,
component
:
AddUser
,
component
:
AddUser
,
},
},
{
path
:
"
/movie/:id
"
,
name
:
"
MoviePage
"
,
component
:
MoviePage
,
},
];
];
const
router
=
createRouter
({
const
router
=
createRouter
({
...
...
This diff is collapsed.
Click to expand it.
frontend/src/views/Users.vue
+
47
−
18
View file @
732165f6
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<header>
<header>
<div
class=
"user"
>
<div
class=
"user"
>
<img
class=
"photo"
src=
"../assets/placeholder.jpeg"
/>
<img
class=
"photo"
src=
"../assets/placeholder.jpeg"
/>
<br
>
<br
/
>
<div
class=
"name"
>
<div
class=
"name"
>
<h1>
Jeanne Dupont
</h1>
<h1>
Jeanne Dupont
</h1>
</div>
</div>
...
@@ -11,10 +11,40 @@
...
@@ -11,10 +11,40 @@
<div
class=
"like"
>
<div
class=
"like"
>
<h4
class=
"texte"
>
Films que vous avez aimés >
</h4>
<h4
class=
"texte"
>
Films que vous avez aimés >
</h4>
</div>
</div>
<div>
{{
likedFilms
}}
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
axios
from
"
axios
"
;
const
backendURL
=
process
.
env
.
VUE_APP_BACKEND_BASE_URL
;
export
default
{
data
:
function
()
{
return
{
likedFilms
:
[],
};
},
methods
:
{
getLiked
:
async
function
()
{
try
{
const
likedFilms
=
await
axios
.
get
(
backendURL
+
"
/users/likedMovies/
"
+
this
.
userId
);
return
likedFilms
.
data
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
},
},
created
()
{
this
.
userId
=
this
.
$route
.
query
.
uid
;
this
.
getLiked
().
then
((
results
)
=>
{
console
.
log
(
results
);
this
.
likedFilms
=
results
;
});
console
.
log
(
this
.
userId
);
},
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
@@ -35,7 +65,7 @@
...
@@ -35,7 +65,7 @@
.like
{
.like
{
text-align
:
center
;
text-align
:
center
;
display
:
flex
;
display
:
flex
;
background-color
:
#912
F
56
;
background-color
:
#912
f
56
;
color
:
white
;
color
:
white
;
max-height
:
100px
;
max-height
:
100px
;
justify-content
:
center
;
justify-content
:
center
;
...
@@ -48,7 +78,6 @@
...
@@ -48,7 +78,6 @@
margin-left
:
5px
;
margin-left
:
5px
;
}
}
.name
{
.name
{
background-color
:
#
EAF2EF
;
background-color
:
#
eaf2ef
;
}
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment