Skip to content
Extraits de code Groupes Projets
Valider 1668f029 rédigé par oussama aftys's avatar oussama aftys
Parcourir les fichiers

Merge branch 'develop' into 'staging'

Develop

See merge request !14
parents b50c823c c7f83ce1
Branches staging
1 requête de fusion!14Develop
Pipeline #8873 en échec avec les étapes
in 3 minutes et 36 secondes
......@@ -89,7 +89,7 @@ public class LiveProductService implements ILiveProductService {
return LiveProductDto.builder()
.id(liveProductId)
.type(MessageType.ADDPRODUCT)
.productId(liveProductId)
.productId(liveProduct.getProductId())
.image(liveProduct.getImage())
.price(liveProduct.getPrice())
.sku(liveProduct.getSku())
......
......@@ -2,14 +2,14 @@ package com.marketingconfort.mydressin.mydressinstreamservices.services.impl;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -44,7 +44,6 @@ import com.marketingconfort.starter.core.exceptions.FunctionalException;
import com.marketingconfort.starter.core.exceptions.S3FunctionalException;
import com.marketingconfort.starter.core.services.implementations.S3FileServiceImpl;
import jakarta.persistence.EntityNotFoundException;
import lombok.AllArgsConstructor;
......@@ -68,7 +67,8 @@ public class LiveStreamService implements ILiveStreamService {
@Override
@Transactional(rollbackFor = { FunctionalException.class, S3FunctionalException.class })
public LiveStreamResponse createLiveStream(LiveStreamDto liveStreamDto, MultipartFile image) throws S3FunctionalException, IOException {
public LiveStreamResponse createLiveStream(LiveStreamDto liveStreamDto, MultipartFile image)
throws S3FunctionalException, IOException {
if (image == null || image.getOriginalFilename() == null) {
throw new RuntimeException();
}
......@@ -76,8 +76,9 @@ public class LiveStreamService implements ILiveStreamService {
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf('.'));
String date = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
String newFileName = date + ExternUtils.uniqueUuid() + fileExtension;
MultipartFile renamedFile = new CustomMultipartFile(image.getName(), newFileName, image.getContentType(), image.getBytes());
List<String> paths=s3FileService.uploadFilesToBucket(awsConfigProps.getBucketName(), List.of(renamedFile));
MultipartFile renamedFile = new CustomMultipartFile(image.getName(), newFileName, image.getContentType(),
image.getBytes());
List<String> paths = s3FileService.uploadFilesToBucket(awsConfigProps.getBucketName(), List.of(renamedFile));
LiveStream liveStream = LiveStreamDto.toEntity(liveStreamDto);
liveStream.setStatus(LiveStatus.COMING);
liveStream.setImage(paths.get(0));
......@@ -94,7 +95,8 @@ public class LiveStreamService implements ILiveStreamService {
@Override
@Transactional(rollbackFor = { FunctionalException.class, S3FunctionalException.class })
public LiveStreamResponse modifyLiveStream(Long id, LiveStreamDto liveStreamDto, MultipartFile image) throws S3FunctionalException, IOException {
public LiveStreamResponse modifyLiveStream(Long id, LiveStreamDto liveStreamDto, MultipartFile image)
throws S3FunctionalException, IOException {
LiveStream liveStream = liveStreamRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("LiveStream with id " + id + " not found"));
......@@ -103,8 +105,10 @@ public class LiveStreamService implements ILiveStreamService {
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf('.'));
String date = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
String newFileName = date + ExternUtils.uniqueUuid() + fileExtension;
MultipartFile renamedFile = new CustomMultipartFile(image.getName(), newFileName, image.getContentType(), image.getBytes());
List<String> paths = s3FileService.uploadFilesToBucket(awsConfigProps.getBucketName(), List.of(renamedFile));
MultipartFile renamedFile = new CustomMultipartFile(image.getName(), newFileName, image.getContentType(),
image.getBytes());
List<String> paths = s3FileService.uploadFilesToBucket(awsConfigProps.getBucketName(),
List.of(renamedFile));
liveStream.setImage(paths.get(0));
}
......@@ -140,7 +144,7 @@ public class LiveStreamService implements ILiveStreamService {
}
@Override
@Override
public void startLiveStream(Long id) throws JsonProcessingException {
LiveStream liveStream = liveStreamRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("LiveStream with id " + id + " not found"));
......@@ -160,7 +164,7 @@ public class LiveStreamService implements ILiveStreamService {
if (response != null) {
System.out.println("Response received: " + response.toString());
liveStream.setStartedAt(LocalDateTime.now());
liveStream.setStartedAt(ZonedDateTime.now(ZoneOffset.UTC).toLocalDateTime());
liveStream.setStatus(LiveStatus.ONGOING);
liveStream.setFfmpegPid(response.getPid());
liveStreamRepository.save(liveStream);
......@@ -192,6 +196,7 @@ public class LiveStreamService implements ILiveStreamService {
restTemplate.postForObject(liveServerConfig.getStatus() + "/stop-recording", stopDto, LiveStopDto.class);
}
@Override
public void deleteLive(Long id) {
liveStreamRepository.deleteById(id);
......
......@@ -11,8 +11,7 @@ spring:
username: mydressin-stream-service-local-user
password: '*323taq9C'
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 2
cache:
type: ehcache
autoconfigure:
......@@ -22,5 +21,4 @@ spring:
ehcache:
ehcacheFilePath: local-ehcache.xml
stockManagementService: http://localhost:8083
......@@ -11,8 +11,7 @@ spring:
username: mydressin-stream-service-local-user
password: '*323taq9C'
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 2
cache:
type: ehcache
autoconfigure:
......
live-server:
hls: https://hls.mydressin-server.com/hls
rtmp: rtmp://rtmp.mydressin-server.com/live
stat: https://rtmp.mydressin-server.com/stat
stat: https://hls.mydressin-server.com/stat
status: https://status.mydressin-server.com
cdn: https://bucket-rtmp.s3.eu-north-1.amazonaws.com/
......@@ -11,8 +11,6 @@ spring:
username: mydressin-stream-service-local-user
password: '*323taq9C'
driver-class-name: org.postgresql.Driver
hikari:
maximum-pool-size: 2
cache:
type: ehcache
autoconfigure:
......
......@@ -18,7 +18,7 @@ spring:
jpa:
hibernate:
ddl-auto: create
ddl-auto: update
show-sql: true
properties:
hibernate:
......@@ -38,5 +38,5 @@ rest:
read: 5000
headers:
Authorization: "token"
Content-Type: "application/json"
"Content-Type": "application/json"
Accept: "application/json"
\ No newline at end of file
<ehcache>
<diskStore path="java.io.tmpdir"/>
<cache name="s3UrlCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="100"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="listAndSearchFilesCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="filesMetadataCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="listFilesWithHierarchyCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
</ehcache>
<ehcache>
<diskStore path="java.io.tmpdir"/>
<cache name="s3UrlCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="100"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="listAndSearchFilesCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="filesMetadataCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
<cache name="listFilesWithHierarchyCache"
maxEntriesLocalHeap="1000"
maxEntriesLocalDisk="1000"
eternal="false"
timeToLiveSeconds="600"
timeToIdleSeconds="300"
memoryStoreEvictionPolicy="LFU"
statistics="true">
</cache>
</ehcache>
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter