rez_core 3.1.82 → 3.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "3.1.82",
3
+ "version": "3.1.83",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -57,12 +57,14 @@ export class MediaController {
57
57
  @Param('id') id: number,
58
58
  @Res() res: Response,
59
59
  @Req() req: Request & { user: any },
60
+ @Param('expiresIn') expiresIn?: number,
60
61
  ) {
61
62
  const loggedInUser = req.user.userData;
62
63
  try {
63
64
  const downloadUrl = await this.mediaDataService.getMediaDownloadUrl(
64
65
  id,
65
66
  loggedInUser,
67
+ expiresIn,
66
68
  );
67
69
  res.status(HttpStatus.OK).json({
68
70
  message: 'Download URL fetched successfully',
@@ -118,7 +118,7 @@ export class MediaDataService extends EntityServiceImpl {
118
118
  }
119
119
 
120
120
  // New method to get the signed URL for the media (download link)
121
- async getMediaDownloadUrl(id: number, loggedInUser) {
121
+ async getMediaDownloadUrl(id: number, loggedInUser, expiresIn?: number) {
122
122
  try {
123
123
  const entityData = await this.getEntityData(
124
124
  ENTITYTYPE_MEDIA,
@@ -129,7 +129,7 @@ export class MediaDataService extends EntityServiceImpl {
129
129
  const signedUrl = await this.s3.getSignedUrlPromise('getObject', {
130
130
  Bucket: this.bucketName,
131
131
  Key: mediaData.media_url,
132
- Expires: 60 * 5, // URL valid for 5 mins
132
+ Expires: expiresIn || 60 * 5, // URL valid for 5 mins or custom time
133
133
  });
134
134
  return { signedUrl, fileName: mediaData.file_name, id: mediaData.id };
135
135
  } catch (error) {