Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix status if file no upload

Maksim Mrug787528e1aa96
diff --git a/src/marketplace/extensions/extensions.controller.ts b/src/marketplace/extensions/extensions.controller.ts
index 77ce91d96..57fb21937 100644
--- a/src/marketplace/extensions/extensions.controller.ts
+++ b/src/marketplace/extensions/extensions.controller.ts
@@ -365,6 +365,7 @@ export class ExtensionsController {
let fileURL
let mainImageURL
+ let statusInfo
try {
fileURL = files.file && (await this.cdnService.uploadFile(files.file[0]))?.filename
@@ -378,6 +379,12 @@ export class ExtensionsController {
throw new InternalServerErrorException('Failed to upload main image to the CDN.')
}
+ if (fileURL) {
+ statusInfo = ExtensionStatus.PENDING
+ } else {
+ statusInfo = ExtensionStatus.NO_EXTENSION_UPLOADED
+ }
+
const user = await this.userService.findOne(userId)
const extensionInstance = this.extensionsService.create({
name: body.name,
@@ -386,6 +393,7 @@ export class ExtensionsController {
price: body.price,
owner: user,
mainImage: mainImageURL,
+ status: statusInfo,
additionalImages: additionalImageFilenames,
fileURL,
category: body.categoryID
@@ -464,6 +472,7 @@ export class ExtensionsController {
let fileURL
let mainImageURL
+ let statusInfo
try {
fileURL =
@@ -485,12 +494,19 @@ export class ExtensionsController {
)
}
+ if (fileURL) {
+ statusInfo = ExtensionStatus.PENDING
+ } else {
+ statusInfo = ExtensionStatus.NO_EXTENSION_UPLOADED
+ }
+
const extensionInstance = this.extensionsService.create({
...extension,
name: body.name || extension.name,
description: body.description || extension.description,
version: body.version || extension.version,
price: body.price || extension.price,
+ status: statusInfo,
mainImage: mainImageURL || extension.mainImage,
additionalImages: _isEmpty(additionalImageFilenames)
? extension.additionalImages
diff --git a/src/marketplace/extensions/interfaces/create-extension.interface.ts b/src/marketplace/extensions/interfaces/create-extension.interface.ts
index 3676b9dae..c92cd2f8b 100644
--- a/src/marketplace/extensions/interfaces/create-extension.interface.ts
+++ b/src/marketplace/extensions/interfaces/create-extension.interface.ts
@@ -9,6 +9,7 @@ export interface ICreateExtension {
price?: number
mainImage?: string | null
additionalImages?: string[] | []
+ status?: string
fileURL?: string
category?: Category
}