mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server): calculate asset type server side (#3200)
* refactor(server): calculate asset type server-side * chore: open api * chore: remove comments * fix: linting * update * Revert "update" This reverts commit dc58702923250b9385d22468a7afe77dc9972a03. * fix: upload LivePhotos * chore: remove unused request fields for upload * remove unused method * mobile-fix: livePhoto filename * fix: revert check for livephotos filename and extension --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
22
mobile/openapi/lib/api/asset_api.dart
generated
22
mobile/openapi/lib/api/asset_api.dart
generated
@@ -1359,12 +1359,8 @@ class AssetApi {
|
||||
/// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [AssetTypeEnum] assetType (required):
|
||||
///
|
||||
/// * [MultipartFile] assetData (required):
|
||||
///
|
||||
/// * [String] fileExtension (required):
|
||||
///
|
||||
/// * [String] deviceAssetId (required):
|
||||
///
|
||||
/// * [String] deviceId (required):
|
||||
@@ -1388,7 +1384,7 @@ class AssetApi {
|
||||
/// * [bool] isVisible:
|
||||
///
|
||||
/// * [String] duration:
|
||||
Future<Response> uploadFileWithHttpInfo(AssetTypeEnum assetType, MultipartFile assetData, String fileExtension, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
|
||||
Future<Response> uploadFileWithHttpInfo(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/asset/upload';
|
||||
|
||||
@@ -1407,10 +1403,6 @@ class AssetApi {
|
||||
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest('POST', Uri.parse(path));
|
||||
if (assetType != null) {
|
||||
hasFields = true;
|
||||
mp.fields[r'assetType'] = parameterToString(assetType);
|
||||
}
|
||||
if (assetData != null) {
|
||||
hasFields = true;
|
||||
mp.fields[r'assetData'] = assetData.field;
|
||||
@@ -1430,10 +1422,6 @@ class AssetApi {
|
||||
hasFields = true;
|
||||
mp.fields[r'isReadOnly'] = parameterToString(isReadOnly);
|
||||
}
|
||||
if (fileExtension != null) {
|
||||
hasFields = true;
|
||||
mp.fields[r'fileExtension'] = parameterToString(fileExtension);
|
||||
}
|
||||
if (deviceAssetId != null) {
|
||||
hasFields = true;
|
||||
mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);
|
||||
@@ -1483,12 +1471,8 @@ class AssetApi {
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [AssetTypeEnum] assetType (required):
|
||||
///
|
||||
/// * [MultipartFile] assetData (required):
|
||||
///
|
||||
/// * [String] fileExtension (required):
|
||||
///
|
||||
/// * [String] deviceAssetId (required):
|
||||
///
|
||||
/// * [String] deviceId (required):
|
||||
@@ -1512,8 +1496,8 @@ class AssetApi {
|
||||
/// * [bool] isVisible:
|
||||
///
|
||||
/// * [String] duration:
|
||||
Future<AssetFileUploadResponseDto?> uploadFile(AssetTypeEnum assetType, MultipartFile assetData, String fileExtension, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
|
||||
final response = await uploadFileWithHttpInfo(assetType, assetData, fileExtension, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, isFavorite, key: key, livePhotoData: livePhotoData, sidecarData: sidecarData, isReadOnly: isReadOnly, isArchived: isArchived, isVisible: isVisible, duration: duration, );
|
||||
Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
|
||||
final response = await uploadFileWithHttpInfo(assetData, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, isFavorite, key: key, livePhotoData: livePhotoData, sidecarData: sidecarData, isReadOnly: isReadOnly, isArchived: isArchived, isVisible: isVisible, duration: duration, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
10
mobile/openapi/lib/model/import_asset_dto.dart
generated
10
mobile/openapi/lib/model/import_asset_dto.dart
generated
@@ -13,7 +13,6 @@ part of openapi.api;
|
||||
class ImportAssetDto {
|
||||
/// Returns a new [ImportAssetDto] instance.
|
||||
ImportAssetDto({
|
||||
required this.assetType,
|
||||
this.isReadOnly = true,
|
||||
required this.assetPath,
|
||||
this.sidecarPath,
|
||||
@@ -27,8 +26,6 @@ class ImportAssetDto {
|
||||
this.duration,
|
||||
});
|
||||
|
||||
AssetTypeEnum assetType;
|
||||
|
||||
bool isReadOnly;
|
||||
|
||||
String assetPath;
|
||||
@@ -77,7 +74,6 @@ class ImportAssetDto {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ImportAssetDto &&
|
||||
other.assetType == assetType &&
|
||||
other.isReadOnly == isReadOnly &&
|
||||
other.assetPath == assetPath &&
|
||||
other.sidecarPath == sidecarPath &&
|
||||
@@ -93,7 +89,6 @@ class ImportAssetDto {
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetType.hashCode) +
|
||||
(isReadOnly.hashCode) +
|
||||
(assetPath.hashCode) +
|
||||
(sidecarPath == null ? 0 : sidecarPath!.hashCode) +
|
||||
@@ -107,11 +102,10 @@ class ImportAssetDto {
|
||||
(duration == null ? 0 : duration!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ImportAssetDto[assetType=$assetType, isReadOnly=$isReadOnly, assetPath=$assetPath, sidecarPath=$sidecarPath, deviceAssetId=$deviceAssetId, deviceId=$deviceId, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, isFavorite=$isFavorite, isArchived=$isArchived, isVisible=$isVisible, duration=$duration]';
|
||||
String toString() => 'ImportAssetDto[isReadOnly=$isReadOnly, assetPath=$assetPath, sidecarPath=$sidecarPath, deviceAssetId=$deviceAssetId, deviceId=$deviceId, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, isFavorite=$isFavorite, isArchived=$isArchived, isVisible=$isVisible, duration=$duration]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetType'] = this.assetType;
|
||||
json[r'isReadOnly'] = this.isReadOnly;
|
||||
json[r'assetPath'] = this.assetPath;
|
||||
if (this.sidecarPath != null) {
|
||||
@@ -150,7 +144,6 @@ class ImportAssetDto {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return ImportAssetDto(
|
||||
assetType: AssetTypeEnum.fromJson(json[r'assetType'])!,
|
||||
isReadOnly: mapValueOfType<bool>(json, r'isReadOnly') ?? true,
|
||||
assetPath: mapValueOfType<String>(json, r'assetPath')!,
|
||||
sidecarPath: mapValueOfType<String>(json, r'sidecarPath'),
|
||||
@@ -209,7 +202,6 @@ class ImportAssetDto {
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'assetType',
|
||||
'assetPath',
|
||||
'deviceAssetId',
|
||||
'deviceId',
|
||||
|
||||
Reference in New Issue
Block a user