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

update video status to published when processing is finished #47

Merged
merged 34 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b05ff84
feat: add `status` filed in `videos` collection (#46)
aninda052 Jul 26, 2023
1fbda43
feat: set status as `pending` while uploading a video (#46)
aninda052 Jul 26, 2023
55714e4
feat: set status as `published` after full video processing (#46)
aninda052 Jul 26, 2023
8512f6a
refactor : `shell-script` move to `server/scripts` directory (#24)
aninda052 Jul 25, 2023
eed3b8d
chore: use `update` function for updating video status (#46)
aninda052 Jul 26, 2023
46efbf4
Merge branch 'foyzulkarim:main' into feature/update-video-status
aninda052 Jul 26, 2023
7863c51
Update mongo usage and create Singleton MongoManager
foyzulkarim Jul 22, 2023
238122f
Refactor mongo schema update to run centrally
foyzulkarim Jul 23, 2023
ea5731c
before implementing generic repository
foyzulkarim Jul 28, 2023
58d0446
Work in progress
foyzulkarim Jul 28, 2023
9eb728b
getById is moved to common place
foyzulkarim Jul 29, 2023
8d3b1f1
Implemented generic searching
foyzulkarim Aug 2, 2023
51278ec
Merge branch 'main' into feature/update-video-status
aninda052 Aug 3, 2023
3d56a9c
chore : add `ffprobe` package for getting video metadata (#28)
aninda052 Jul 26, 2023
979e041
feat: store video durations while uploading a video (#28)
aninda052 Jul 26, 2023
d3ec0ee
doc : add comment for `getVideoDurations` (#28)
aninda052 Jul 26, 2023
37ca124
refactor: rename "product" to "video" (#28)
aninda052 Jul 26, 2023
5149cf4
chore : add "react-moment" library (#28)
aninda052 Jul 27, 2023
52e94da
feat : show duration on video thumbnails (#28)
aninda052 Jul 27, 2023
57ee4b9
feat : show `recordingDate` on video thumbnails (#29)
aninda052 Jul 27, 2023
7cc8194
stype : video thumbnails design improvment (#29)
aninda052 Jul 27, 2023
a45e3a9
Update mongo usage and create Singleton MongoManager
foyzulkarim Jul 22, 2023
9d4f013
Refactor mongo schema update to run centrally
foyzulkarim Jul 23, 2023
799c261
before implementing generic repository
foyzulkarim Jul 28, 2023
953c275
Work in progress
foyzulkarim Jul 28, 2023
4bac583
getById is moved to common place
foyzulkarim Jul 29, 2023
a0deced
Implemented generic searching
foyzulkarim Aug 2, 2023
76b171c
feat: video view count increment
aninda052 Aug 3, 2023
cc1ee49
fear: show status(#46)
aninda052 Aug 3, 2023
9855ac4
feat: store `status` field while inserting fake video data (#46)
aninda052 Aug 5, 2023
9c9c5eb
refactor : move `schema constants` to `db/constant.js` file (#28)
aninda052 Aug 6, 2023
d71c3c6
Merge branch 'main' into feature/update-video-status
foyzulkarim Aug 7, 2023
7b2cc2c
refactor : use object instead of array for `VIDEO_STATUS` (#24)
aninda052 Aug 7, 2023
eccb113
chore: modify `getVideoMetadata` func to return only duration & resol…
aninda052 Aug 7, 2023
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
6 changes: 4 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@
"formik": "^2.2.9",
"history": "^5.3.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"numeral": "^2.0.6",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-apexcharts": "^1.4.0",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-hook-form": "^7.37.0",
"react-moment": "^1.1.3",
"react-player": "^2.11.0",
"react-router-dom": "^6.4.2",
"react-scripts": "^5.0.1",
Expand All @@ -69,7 +71,6 @@
"yup": "^0.32.11"
},
"devDependencies": {
"serve": "^14.2.0",
"@babel/core": "^7.19.3",
"@babel/eslint-parser": "^7.19.1",
"@svgr/webpack": "^6.5.0",
Expand All @@ -83,7 +84,8 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"serve": "^14.2.0"
},
"overrides": {
"@svgr/webpack": "^6.5.0"
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/ProductsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';
// @mui
import { Container, Stack, Typography } from '@mui/material';
// components
import { ProductSort, ProductList, ProductCartWidget, ProductFilterSidebar } from '../sections/@dashboard/products';
import { ProductSort, VideoList, ProductCartWidget, ProductFilterSidebar } from '../sections/@dashboard/products';
// mock
import PRODUCTS from '../_mock/products';

Expand Down Expand Up @@ -42,7 +42,7 @@ export default function ProductsPage() {
</Stack>
</Stack>

<ProductList products={PRODUCTS} />
<VideoList videos={PRODUCTS} />
<ProductCartWidget />
</Container>
</>
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/VideosPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Container, Stack, Typography } from '@mui/material';
// components
import {
ProductSort,
ProductList,
VideoList,
ProductCartWidget,
ProductFilterSidebar,
} from '../sections/@dashboard/products';
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function ProductsPage() {
</Stack>
</Stack>

<ProductList products={videos} />
<VideoList videos={videos} />
<ProductCartWidget />
</Container>
</>
Expand Down
22 changes: 0 additions & 22 deletions client/src/sections/@dashboard/products/ProductList.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Box, Card, Stack, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';

import { Link } from "react-router-dom";
import Moment from 'react-moment';

// utils
// components
Expand All @@ -21,24 +22,27 @@ const StyledProductImg = styled('img')({

// ----------------------------------------------------------------------

ShopProductCard.propTypes = {
product: PropTypes.object,
VideoCard.propTypes = {
video: PropTypes.object,
};

export default function ShopProductCard({ video }) {
export default function VideoCard({ video }) {
const {
title: name,
thumbnailUrl: cover,
viewCount,
duration: status,
publishedAt,
duration,
status,
recordingDate,
_id: id,
} = video;

const onClickHandler = () => {
console.log('clicked', video);
};

const videoDuration = duration ?? 0;

return (
<Card onClick={onClickHandler}>
<Box sx={{ pt: '100%', position: 'relative' }}>
Expand All @@ -61,20 +65,23 @@ export default function ShopProductCard({ video }) {
</Box>

<Stack spacing={2} sx={{ p: 3 }}>
<Link to={id} color='inherit' underline='hover'>
<Typography variant='subtitle2' noWrap>
{name}
</Typography>
</Link>

<Stack
direction='row'
alignItems='center'
justifyContent='space-between'
>
<Typography variant='subtitle1'>{publishedAt}</Typography>
<Typography variant='subtitle1'>{viewCount} views</Typography>
</Stack>
<Stack direction='row' alignItems='center' justifyContent='space-between'>
<Link to={id} color='inherit' underline='hover'>
<Typography variant='subtitle2' noWrap>
{name}
</Typography>
</Link>
<Typography variant='subtitle1'>
<Moment format='DD/MM/yyyy'>{recordingDate}</Moment>
</Typography>
</Stack>

<Stack direction='row' alignItems='center' justifyContent='space-between'>
<Typography variant='subtitle1'>{viewCount} views</Typography>
<Typography variant='subtitle1'>
<Moment utc format='HH:mm:ss'>{videoDuration*1000}</Moment>
</Typography>
</Stack>
</Stack>
</Card>
);
Expand Down
22 changes: 22 additions & 0 deletions client/src/sections/@dashboard/products/VideoList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import PropTypes from 'prop-types';
// @mui
import { Grid } from '@mui/material';
import VideoCard from './VideoCard';

// ----------------------------------------------------------------------

VideoList.propTypes = {
videos: PropTypes.array.isRequired,
};

export default function VideoList({ videos = [], ...other }) {
return (
<Grid container spacing={3} {...other}>
{videos.map((video) => (
<Grid key={video.id} item xs={12} sm={6} md={3}>
<VideoCard video={video} />
</Grid>
))}
</Grid>
);
}
4 changes: 2 additions & 2 deletions client/src/sections/@dashboard/products/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { default as ProductCard } from './ProductCard';
export { default as ProductList } from './ProductList';
export { default as VideoCard } from './VideoCard';
export { default as VideoList } from './VideoList';
export { default as ProductSort } from './ProductSort';
export { default as ProductCartWidget } from './ProductCartWidget';
export { default as ProductFilterSidebar } from './ProductFilterSidebar';
10 changes: 10 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6681,6 +6681,11 @@ mkdirp@~0.5.1:
dependencies:
minimist "^1.2.6"

moment@^2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==

[email protected]:
version "2.0.0"
resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
Expand Down Expand Up @@ -7967,6 +7972,11 @@ react-is@^18.0.0, react-is@^18.2.0:
resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-moment@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/react-moment/-/react-moment-1.1.3.tgz#829b21dfb279aa6db47ce4f1ac2555af17a1bcdc"
integrity sha512-8EPvlUL8u6EknPp1ISF5MQ3wx2OHJVXIP/iZc4wRh3iV3XozftZERDv9ANZeAtMlhNNQHdFoqcZHFUkBSTONfA==

react-player@^2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/react-player/-/react-player-2.11.0.tgz#9afc75314eb915238e8d6615b2891fbe7170aeaa"
Expand Down
122 changes: 121 additions & 1 deletion server/package-lock.json

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

2 changes: 2 additions & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"license": "ISC",
"dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@ffprobe-installer/ffprobe": "^2.1.1",
"bcrypt": "^5.1.0",
"bullmq": "^3.5.11",
"compression": "^1.7.4",
Expand All @@ -33,6 +34,7 @@
"express": "^4.18.2",
"express-pino-logger": "^7.0.0",
"express-rate-limit": "^6.7.0",
"ffprobe": "^1.1.2",
"fluent-ffmpeg": "^2.1.2",
"helmet": "^6.0.1",
"joi": "^17.7.0",
Expand Down
6 changes: 4 additions & 2 deletions server/scripts/seed-data/video.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const { faker } = require('@faker-js/faker');
const { MongoManager } = require('../../src/modules/db/mongo');
const { VIDEO_STATUS, VIDEO_VISIBILITIES } = require('../../src/modules/db/constant');

const getFakeVideosData = (x) => {
const videos = [];
console.log('getting new batch', x);
for (let i = 0; i < 1000; i++) {
videos.push({
title: faker.lorem.sentence(5),
visibility: faker.helpers.arrayElement(['Public', 'Private', 'Unlisted']),
visibility: faker.helpers.arrayElement(VIDEO_VISIBILITIES),
aninda052 marked this conversation as resolved.
Show resolved Hide resolved
category: faker.helpers.arrayElement([
'education',
'entertainment',
Expand All @@ -18,7 +19,8 @@ const getFakeVideosData = (x) => {
recordingDate: faker.date.past(),
publishedAt: faker.date.past(),
fileName: faker.lorem.sentence(5),

status: faker.helpers.arrayElement(VIDEO_STATUS),
isDeleted : faker.datatype.boolean(),
thumbnailUrl: faker.image.imageUrl(),
duration: parseInt(faker.random.numeric()),
viewCount: parseInt(faker.random.numeric()),
Expand Down
Loading