1 /* 2 * Copyright (C) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #define MLOG_TAG "Media_Cloud_Controller" 17 18 #include "cloud_media_album_controller_processor.h" 19 20 #include "media_log.h" 21 #include "cloud_file_data_vo.h" 22 #include "cloud_file_data_dto.h" 23 #include "photos_vo.h" 24 #include "photos_dto.h" 25 26 namespace OHOS::Media::CloudSync { ConvertRecordPoToVo(PhotoAlbumPo record)27CloudMdkRecordPhotoAlbumVo CloudMediaAlbumControllerProcessor::ConvertRecordPoToVo(PhotoAlbumPo record) 28 { 29 CloudMdkRecordPhotoAlbumVo recordVo; 30 recordVo.albumId = record.albumId.value_or(0); 31 recordVo.albumType = record.albumType.value_or(0); 32 recordVo.albumName = record.albumName.value_or(""); 33 recordVo.lpath = record.lpath.value_or(""); 34 recordVo.cloudId = record.cloudId.value_or(""); 35 recordVo.albumSubtype = record.albumSubtype.value_or(0); 36 recordVo.dateAdded = record.dateAdded.value_or(0); 37 recordVo.dateModified = record.dateModified.value_or(0); 38 recordVo.bundleName = record.bundleName.value_or(""); 39 recordVo.localLanguage = record.localLanguage.value_or(""); 40 recordVo.coverUriSource = record.coverUriSource.value_or(0); 41 recordVo.coverCloudId = record.coverCloudId.value_or(""); 42 /* album_plugin columns */ 43 recordVo.albumPluginCloudId = record.albumPluginCloudId.value_or(""); 44 recordVo.albumNameEn = record.albumNameEn.value_or(""); 45 recordVo.dualAlbumName = record.dualAlbumName.value_or(""); 46 recordVo.priority = record.priority.value_or(0); 47 recordVo.isInWhiteList = record.isInWhiteList.value_or(false); 48 return recordVo; 49 } 50 ConvertToPhotoAlbumDto(const OnCreateRecordsAlbumReqBodyAlbumData & recordVo)51PhotoAlbumDto CloudMediaAlbumControllerProcessor::ConvertToPhotoAlbumDto( 52 const OnCreateRecordsAlbumReqBodyAlbumData &recordVo) 53 { 54 PhotoAlbumDto record; 55 record.cloudId = recordVo.cloudId; 56 record.newCloudId = recordVo.newCloudId; 57 record.isSuccess = recordVo.isSuccess; 58 record.errorType = recordVo.errorType; 59 record.serverErrorCode = recordVo.serverErrorCode; 60 record.errorDetails = recordVo.errorDetails; 61 return record; 62 } 63 ConvertToPhotoAlbumDto(const OnMdirtyAlbumRecord & recordVo)64PhotoAlbumDto CloudMediaAlbumControllerProcessor::ConvertToPhotoAlbumDto( 65 const OnMdirtyAlbumRecord &recordVo) 66 { 67 PhotoAlbumDto record; 68 record.cloudId = recordVo.cloudId; 69 record.isSuccess = recordVo.isSuccess; 70 record.errorType = recordVo.errorType; 71 record.serverErrorCode = recordVo.serverErrorCode; 72 record.errorDetails = recordVo.errorDetails; 73 return record; 74 } 75 } // namespace OHOS::Media::CloudSync