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

OV-377: Create preview page and flow #429

Merged
merged 23 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b868514
OV-377: + add preview page with video player
stefano-lacorazza Sep 23, 2024
49af338
OV-377: + add copy url button to homepage
stefano-lacorazza Sep 23, 2024
06e0c10
OV-377: + create JWT with video id and return it to frontend
stefano-lacorazza Sep 24, 2024
945fac9
OV-377: + copy url to clipboard
stefano-lacorazza Sep 24, 2024
c19a3fa
OV-377: + create dynamic preview url
stefano-lacorazza Sep 24, 2024
01bf93f
OV-377: + create public-video controller and service
stefano-lacorazza Sep 25, 2024
e7cc793
Merge branch 'next' into task/OV-377-create-preview-page
stefano-lacorazza Sep 25, 2024
5e9044d
OV-377: + white route public-video
stefano-lacorazza Sep 25, 2024
ba2031e
OV-377: + style preview page
stefano-lacorazza Sep 25, 2024
423cabc
OV-377: * prettier
stefano-lacorazza Sep 25, 2024
5c7e932
OV-377: * Refactor token service to use a unified method for creating…
stefano-lacorazza Sep 26, 2024
480e38f
OV-377: + added dynamically created sharing URL
stefano-lacorazza Sep 26, 2024
556ed1d
OV-377: - use config to create video url
stefano-lacorazza Sep 26, 2024
907bdaf
Merge branch 'next' into task/OV-377-create-preview-page
stefano-lacorazza Sep 26, 2024
c2ebd64
Merge branch 'next' into task/OV-377-create-preview-page
stefano-lacorazza Sep 26, 2024
32b55b7
OV-377: + create env variable for deployment URL andfix magic numbers
stefano-lacorazza Sep 26, 2024
7d1c536
OV-377: * prettier
stefano-lacorazza Sep 26, 2024
3ae5db1
OV-377: * changed baseurl to access env PUBLIC_URL
stefano-lacorazza Sep 26, 2024
d932a5a
OV-377: * changed baseurl to access env PUBLIC_URL
stefano-lacorazza Sep 26, 2024
89fd45d
OV-377: * prettier
stefano-lacorazza Sep 26, 2024
b012825
Merge branch 'next' into task/OV-377-create-preview-page
stefano-lacorazza Sep 27, 2024
b8e9f78
OV-377: - prettier
stefano-lacorazza Sep 27, 2024
34e1084
OV-377: * change .env variable
stefano-lacorazza Sep 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PublicVideoController extends BaseController {
return {
status: HTTPCode.OK,
payload: await this.publicVideoService.findUrlByToken(
videoTokenHeader ?? '',
videoTokenHeader,
),
};
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/bundles/public-video/public-video.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PublicVideoService {
this.throwVideoNotFoundError();
}

const url = video.toObject().url;
const { url } = video.toObject();
if (!url) {
this.throwVideoNotFoundError();
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/bundles/videos/video.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class VideoController extends BaseController {
),
});
this.addRoute({
path: `${VideosApiPath.ID}/share`,
path: `${VideosApiPath.ID}${VideosApiPath.SHARE}`,
method: HTTPMethod.GET,
handler: (options) => {
return this.createVideoIdJWT(
Expand Down
6 changes: 6 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ VITE_APP_API_ORIGIN_URL=/api/v1
#
VITE_APP_PROXY_SERVER_URL=http://localhost:3001
VITE_APP_SOCKET_ORIGIN_URL=/socket.io

#
# DEPLOYMENT
#
DEPLOYMENT_URL=http://bsa-2024-outreachvids-dev.eu-north-1.elasticbeanstalk.com
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#
# DEPLOYMENT
#
DEPLOYMENT_URL=http://bsa-2024-outreachvids-dev.eu-north-1.elasticbeanstalk.com
#
# DEPLOYMENT
#
PUBLIC_URL=http://localhost:3000


2 changes: 1 addition & 1 deletion frontend/src/bundles/common/api/video-api/videos-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class VideosApi extends BaseHttpApi {

public async getVideoIdJWT(id: string): Promise<string> {
const response = await this.load(
this.getFullEndpoint(`${VideosApiPath.ROOT}${id}/share`, {}),
this.getFullEndpoint(`${VideosApiPath.ROOT}${id}${VideosApiPath.SHARE}`, {}),
{
method: HTTPMethod.GET,
contentType: ContentType.JSON,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/bundles/home/helpers/create-url-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { config } from '~/framework/config/config.js';
const createVideoUrl = (jwtToken: string): string => {
const baseUrl =
config.ENV.APP.ENVIRONMENT === AppEnvironment.PRODUCTION
? 'http://bsa-2024-outreachvids-dev.eu-north-1.elasticbeanstalk.com'
? config.ENV.DEPLOYMENT.URL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to add something like PUBLIC_URL. And use it as it is without checks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im having problems with this one. I changed .env, EnvironmentSchema, and base-config.package adding the new ENV PUBLIC_URL variable but when I try to access it in createVideoUrl I keep getting undefined.

: 'http://localhost:3000';

return `${baseUrl}/preview/${jwtToken}`;
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/framework/config/base-config.package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class BaseConfig implements Config {
'VITE_APP_SOCKET_ORIGIN_URL'
] as string,
},
DEPLOYMENT: {
URL: import.meta.env['DEPLOYMENT_URL'] as string,
},
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ type EnvironmentSchema = {
ORIGIN_URL: string;
SOCKET_ORIGIN_URL: string;
};
DEPLOYMENT: {
URL: string;
};
};

export { type EnvironmentSchema };
Loading