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!

Kill Swetrix Extensions Marketplace

Blue Mouse2e04bf5bf3c9
diff --git a/README.md b/README.md
index ce67c54aa..4cd124cb1 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,6 @@ We've been building Swetrix since 2021 with a goal to make web analytics simple
- **Error tracking**: capture client‑side errors with details and aggregated views.
- **Shareable analytics**: public or password‑protected dashboards; invite teammates with roles, or manage access with organisations.
- **Data portability**: export to CSV and access data via our [developer API](https://docs.swetrix.com/statistics-api).
-- **Extensible (Cloud)**: extensions marketplace to enhance dashboards and workflows.
- **Alerts & notifications (Cloud)**: get notified on thresholds via Slack, Telegram or Discord.
- Open source and self‑hostable, with a fully managed EU‑hosted Cloud option.
@@ -75,8 +74,8 @@ Prefer to run it yourself? Swetrix Community Edition (CE) ships the same core an
Cloud vs Community Edition
-| | Swetrix Cloud | Swetrix Community Edition |
-| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| | Swetrix Cloud | Swetrix Community Edition |
+| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Infrastructure management** | ✅ It's easy to get started with Swetrix Cloud - you can set up tracking in a matter of minutes. We manage server maintenance, upgrades, security for you. | ⚠️ You are responsible for managing servers, installs, upgrades, scaling and backups. |
| **Core analytics (traffic, events, sessions, funnels, performance, errors)** | ✅ Included | ✅ Included |
| **Teams & sharing** | ✅ Organisations to manage multiple projects and users with permissions setup; invite people to your projects directly, or share a public or password protected link with people. | ⚠️ Only direct project invites, password protected links and public projects are supported. |
diff --git a/backend/apps/cloud/src/app.module.ts b/backend/apps/cloud/src/app.module.ts
index dbf6f3a0f..f3a9489d4 100644
--- a/backend/apps/cloud/src/app.module.ts
+++ b/backend/apps/cloud/src/app.module.ts
@@ -18,7 +18,6 @@ import { TaskManagerModule } from './task-manager/task-manager.module'
import { BlogModule } from './blog/blog.module'
import { WebhookModule } from './webhook/webhook.module'
import { PingModule } from './ping/ping.module'
-import { MarketplaceModule } from './marketplace/marketplace.module'
import { AlertModule } from './alert/alert.module'
import { GoalModule } from './goal/goal.module'
import { ExperimentModule } from './experiment/experiment.module'
@@ -80,7 +79,6 @@ const modules = [
AnalyticsModule,
WebhookModule,
PingModule,
- MarketplaceModule,
AlertModule,
GoalModule,
ExperimentModule,
diff --git a/backend/apps/cloud/src/main.ts b/backend/apps/cloud/src/main.ts
index c420d3b10..cbdf29575 100644
--- a/backend/apps/cloud/src/main.ts
+++ b/backend/apps/cloud/src/main.ts
@@ -25,7 +25,6 @@ async function bootstrap() {
if (isDevelopment) {
const config = new DocumentBuilder()
.setTitle('Swetrix API')
- .setDescription('Swetrix Analytics & Marketplace API')
.setVersion(process.env.npm_package_version)
.addBearerAuth()
.build()
diff --git a/backend/apps/cloud/src/marketplace/categories/categories.controller.ts b/backend/apps/cloud/src/marketplace/categories/categories.controller.ts
deleted file mode 100644
index 2d5a016e4..000000000
--- a/backend/apps/cloud/src/marketplace/categories/categories.controller.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import {
- Controller,
- Get,
- NotFoundException,
- Param,
- Query,
- UsePipes,
- ValidationPipe,
-} from '@nestjs/common'
-import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
-import { CategoriesService } from './categories.service'
-import { Category } from './category.entity'
-import { GetAllCategoriesQueries } from './dtos/get-all-categories-queries.dto'
-import { GetCategoryParams } from './dtos/get-category-params.dto'
-
-@ApiTags('categories')
-@UsePipes(
- new ValidationPipe({
- forbidNonWhitelisted: true,
- forbidUnknownValues: true,
- transform: true,
- whitelist: true,
- }),
-)
-@Controller('categories')
-export class CategoriesController {
- constructor(private readonly categoriesService: CategoriesService) {}
-
- @ApiQuery({
- description: 'Category offset',
- example: '15',
- name: 'offset',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Category limit',
- example: '75',
- name: 'limit',
- required: false,
- type: String,
- })
- @Get()
- async getAllCategories(@Query() queries: GetAllCategoriesQueries): Promise<{
- categories: Category[]
- count: number
- }> {
- const [categories, count] = await this.categoriesService.findAndCount({
- skip: queries.offset || 0,
- take: queries.limit > 100 ? 25 : queries.limit || 25,
- })
-
- return { categories, count }
- }
-
- @ApiParam({
- name: 'categoryId',
- description: 'Category ID',
- example: 1,
- type: Number,
- })
- @Get(':categoryId')
- async getCategory(@Param() params: GetCategoryParams): Promise<Category> {
- const category = await this.categoriesService.findOne({
- where: {
- id: params.categoryId,
- },
- relations: ['extensions'],
- })
-
- if (!category) {
- throw new NotFoundException('Category not found.')
- }
-
- return category
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/categories.module.ts b/backend/apps/cloud/src/marketplace/categories/categories.module.ts
deleted file mode 100644
index 8a134644d..000000000
--- a/backend/apps/cloud/src/marketplace/categories/categories.module.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Module } from '@nestjs/common'
-import { TypeOrmModule } from '@nestjs/typeorm'
-import { UserModule } from '../../user/user.module'
-import { CategoriesController } from './categories.controller'
-import { CategoriesService } from './categories.service'
-import { Category } from './category.entity'
-
-@Module({
- imports: [TypeOrmModule.forFeature([Category]), UserModule],
- controllers: [CategoriesController],
- providers: [CategoriesService],
- exports: [CategoriesService],
-})
-export class CategoriesModule {}
diff --git a/backend/apps/cloud/src/marketplace/categories/categories.service.ts b/backend/apps/cloud/src/marketplace/categories/categories.service.ts
deleted file mode 100644
index 3fa714e5f..000000000
--- a/backend/apps/cloud/src/marketplace/categories/categories.service.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { Injectable } from '@nestjs/common'
-import { InjectRepository } from '@nestjs/typeorm'
-import { FindManyOptions, FindOneOptions, Repository } from 'typeorm'
-import { Category } from './category.entity'
-import { ICreateCategory } from './interfaces/create-category.interface'
-import { ISaveCategory } from './interfaces/save-category.interface'
-import { IUpdateCategory } from './interfaces/update-category.interface'
-
-@Injectable()
-export class CategoriesService {
- constructor(
- @InjectRepository(Category)
- private readonly categoryRepository: Repository<Category>,
- ) {}
-
- async findOne(options: FindOneOptions<Category>): Promise<Category> {
- return this.categoryRepository.findOne({ ...options })
- }
-
- create(category: ICreateCategory): Category {
- return this.categoryRepository.create(category)
- }
-
- async save(category: ISaveCategory): Promise<ISaveCategory & Category> {
- return this.categoryRepository.save(category)
- }
-
- async findById(id: number): Promise<Category> {
- return this.findOne({ where: { id } })
- }
-
- async update(id: number, category: IUpdateCategory): Promise<void> {
- await this.categoryRepository.update({ id }, category)
- }
-
- async delete(id: number): Promise<void> {
- await this.categoryRepository.delete({ id })
- }
-
- async findAndCount(
- options: FindManyOptions<Category>,
- ): Promise<[Category[], number]> {
- return this.categoryRepository.findAndCount(options)
- }
-
- async findByName(name: string): Promise<Category> {
- return this.findOne({ where: { name }, select: ['name'] })
- }
-
- async findByIds(ids: number[]): Promise<Category[]> {
- return this.categoryRepository.findByIds(ids)
- }
-
- async getCategoryById(id: number) {
- return this.categoryRepository.findOne({ where: { id } })
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/category.entity.ts b/backend/apps/cloud/src/marketplace/categories/category.entity.ts
deleted file mode 100644
index 0aadecf6f..000000000
--- a/backend/apps/cloud/src/marketplace/categories/category.entity.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'
-import { Extension } from '../extensions/entities/extension.entity'
-
-@Entity()
-export class Category {
- @PrimaryGeneratedColumn('increment')
- id: number
-
- @Column({ type: 'varchar', unique: true })
- name: string
-
- @OneToMany(() => Extension, extension => extension.category)
- extensions: Extension[] | []
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/dtos/get-all-categories-queries.dto.ts b/backend/apps/cloud/src/marketplace/categories/dtos/get-all-categories-queries.dto.ts
deleted file mode 100644
index 64c7b3c82..000000000
--- a/backend/apps/cloud/src/marketplace/categories/dtos/get-all-categories-queries.dto.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { IsNumberString, IsOptional } from 'class-validator'
-
-export class GetAllCategoriesQueries {
- @IsNumberString()
- @IsOptional()
- readonly offset?: number
-
- @IsNumberString()
- @IsOptional()
- readonly limit?: number
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/dtos/get-category-params.dto.ts b/backend/apps/cloud/src/marketplace/categories/dtos/get-category-params.dto.ts
deleted file mode 100644
index c68b39326..000000000
--- a/backend/apps/cloud/src/marketplace/categories/dtos/get-category-params.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsNumberString } from 'class-validator'
-
-export class GetCategoryParams {
- @IsNumberString()
- readonly categoryId!: number
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/interfaces/create-category.interface.ts b/backend/apps/cloud/src/marketplace/categories/interfaces/create-category.interface.ts
deleted file mode 100644
index dd8c82588..000000000
--- a/backend/apps/cloud/src/marketplace/categories/interfaces/create-category.interface.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export interface ICreateCategory {
- name: string
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/interfaces/save-category.interface.ts b/backend/apps/cloud/src/marketplace/categories/interfaces/save-category.interface.ts
deleted file mode 100644
index 97de4c368..000000000
--- a/backend/apps/cloud/src/marketplace/categories/interfaces/save-category.interface.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export interface ISaveCategory {
- name: string
-}
diff --git a/backend/apps/cloud/src/marketplace/categories/interfaces/update-category.interface.ts b/backend/apps/cloud/src/marketplace/categories/interfaces/update-category.interface.ts
deleted file mode 100644
index de2cb42ab..000000000
--- a/backend/apps/cloud/src/marketplace/categories/interfaces/update-category.interface.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export interface IUpdateCategory {
- name?: string
-}
diff --git a/backend/apps/cloud/src/marketplace/cdn/cdn.module.ts b/backend/apps/cloud/src/marketplace/cdn/cdn.module.ts
deleted file mode 100644
index 796133e8c..000000000
--- a/backend/apps/cloud/src/marketplace/cdn/cdn.module.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { HttpModule } from '@nestjs/axios'
-import { Module } from '@nestjs/common'
-import { ConfigModule, ConfigService } from '@nestjs/config'
-import { CdnService } from './cdn.service'
-
-@Module({
- imports: [
- HttpModule.registerAsync({
- imports: [ConfigModule],
- inject: [ConfigService],
- useFactory: (configService: ConfigService) => ({
- baseURL: configService.get('CDN_URL'),
- }),
- }),
- ],
- providers: [CdnService],
- exports: [CdnService],
-})
-export class CdnModule {}
diff --git a/backend/apps/cloud/src/marketplace/cdn/cdn.service.ts b/backend/apps/cloud/src/marketplace/cdn/cdn.service.ts
deleted file mode 100644
index 4b263be77..000000000
--- a/backend/apps/cloud/src/marketplace/cdn/cdn.service.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { createReadStream } from 'fs'
-import { unlink, writeFile } from 'fs/promises'
-import { tmpdir } from 'os'
-import { extname } from 'path'
-import { ConfigService } from '@nestjs/config'
-import { Injectable, InternalServerErrorException } from '@nestjs/common'
-import FormData from 'form-data'
-import { HttpService } from '@nestjs/axios'
-import { randomUUID } from 'crypto'
-
-@Injectable()
-export class CdnService {
- constructor(
- private readonly httpService: HttpService,
- private readonly configService: ConfigService,
- ) {}
-
- /**
- * To clarify, in this case the file parameter type was set to "any" because
- * Multer from Express returns the "originalname" property,
- * whereas the nestjs-form-data package uses the "originalName" property.
- */
- async uploadFile(file: any): Promise<{ filename: string }> {
- try {
- // Generate a safe filename using UUID to prevent path traversal attacks
- const fileExtension = extname(file.originalName || '')
- const safeFilename = `${randomUUID()}${fileExtension}`
- const filePath = `${tmpdir()}/${safeFilename}`
- await writeFile(filePath, file.buffer)
-
- const form = new FormData()
- form.append('token', this.configService.get('CDN_ACCESS_TOKEN'))
- form.append('file', createReadStream(filePath))
- const { data } = await this.httpService.axiosRef.post('file', form, {
- headers: {
- 'Content-Type': 'multipart/form-data',
- },
- })
-
- await unlink(filePath)
- return data
- } catch (error) {
- console.error(error)
- throw new InternalServerErrorException(
- 'Failed to upload extension to the CDN.',
- )
- }
- }
-
- async deleteFile(filename: string): Promise<void> {
- try {
- await this.httpService.axiosRef.delete(`file`, {
- data: { token: this.configService.get('CDN_ACCESS_TOKEN'), filename },
- })
- } catch (error) {
- console.error(error)
- }
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/comments.controller.ts b/backend/apps/cloud/src/marketplace/comments/comments.controller.ts
deleted file mode 100644
index 778037743..000000000
--- a/backend/apps/cloud/src/marketplace/comments/comments.controller.ts
+++ /dev/null
@@ -1,228 +0,0 @@
-import {
- Body,
- Controller,
- ConflictException,
- Delete,
- Get,
- NotFoundException,
- Param,
- Post,
- Query,
- Put,
- BadRequestException,
-} from '@nestjs/common'
-import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
-import _includes from 'lodash/includes'
-import _omit from 'lodash/omit'
-import { UserService } from '../../user/user.service'
-import { ExtensionsService } from '../extensions/extensions.service'
-import { Auth, CurrentUserId } from '../../auth/decorators'
-import { CommentsService } from './comments.service'
-import { CreateCommentBodyDto } from './dtos/bodies/create-comment.dto'
-import { DeleteCommentParamDto } from './dtos/params/delete-comment.dto'
-import { GetCommentsQueryDto } from './dtos/queries/get-comments.dto'
-import { Comment } from './entities/comment.entity'
-import { CommentReply } from './entities/comment-reply.entity'
-import { CreateReplyCommentBodyDto } from './dtos/bodies/create-reply.dto'
-import { UpdateCommentReplyBodyDto } from './dtos/bodies/update-reply.dto'
-
-interface IGetComments {
- comments: Comment[]
- count: number
-}
-
-@ApiTags('comments')
-@Controller('comments')
-export class CommentsController {
- constructor(
- private readonly commentsService: CommentsService,
- private readonly extensionsService: ExtensionsService,
- private readonly userService: UserService,
- ) {}
-
- @Auth()
- @Get()
- @ApiQuery({ name: 'offset', required: false, type: String })
- @ApiQuery({ name: 'limit', required: false, type: String })
- @ApiQuery({ name: 'extensionId', required: false, type: String })
- async getComments(
- @Query() queries: GetCommentsQueryDto,
- ): Promise<IGetComments> {
- const [comments, count] = await this.commentsService.getCommentsByExtId(
- queries.extensionId,
- Number(queries.offset) || 0,
- Number(queries.limit) || 25,
- )
-
- return {
- comments,
- count,
- }
- }
-
- @Auth()
- @Post()
- @ApiQuery({ name: 'userId', required: true, type: String })
- async createComment(
- @Body() body: CreateCommentBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<Comment> {
- const user = await this.userService.findOne({ where: { id: userId } })
-
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
- if (!user.nickname) {
- throw new BadRequestException('You must have a nickname to comment.')
- }
-
- const extension = await this.extensionsService.findOne({
- where: { id: body.extensionId },
- relations: ['owner'],
- })
-
- if (!extension || !extension.owner) {
- throw new NotFoundException('Extension not found.')
- }
-
- if (extension.owner.id === userId) {
- throw new ConflictException('You cannot comment on your own extension.')
- }
-
- const comment = await this.commentsService.findOne({
- where: { extensionId: body.extensionId, userId },
- })
-
- if (comment) {
- throw new BadRequestException(
- 'You have already commented on this extension.',
- )
- }
-
- return this.commentsService.save({
- ...body,
- extensionId: extension.id,
- userId,
- })
- }
-
- @Auth()
- @Delete(':commentId')
- @ApiParam({ name: 'commentId', required: true, type: String })
- async deleteComment(
- @Param() params: DeleteCommentParamDto,
- @CurrentUserId() userId: string,
- ): Promise<void> {
- const comment = await this.commentsService.findOne({
- where: { id: params.commentId },
- relations: ['user', 'extension', 'extension.owner'],
- })
-
- if (!comment) {
- throw new NotFoundException('Comment not found.')
- }
-
- if (comment.user.id !== userId) {
- throw new ConflictException('You are not allowed to do this.')
- }
-
- await this.commentsService.delete(params.commentId)
- }
-
- @Auth()
- @Post('reply')
- async createCommentReply(
- @Body() commentReplyDto: CreateReplyCommentBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<CommentReply & { isOwner?: boolean }> {
- const user = await this.userService.findOne({ where: { id: userId } })
-
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
- if (!user.nickname) {
- throw new BadRequestException('You must have a nickname to reply.')
- }
-
- const comment = await this.commentsService.findOne({
- where: { id: commentReplyDto.commentId },
- })
-
- if (!comment) {
- throw new NotFoundException('Comment not found')
- }
-
- const hasUserReplied = await this.commentsService.haveUserRepliedToComment(
- comment.id,
- userId,
- )
-
- if (hasUserReplied) {
- throw new BadRequestException('You have already replied to this comment')
- }
-
- const replyComment = await this.commentsService.createCommentReply(
- commentReplyDto,
- comment,
- userId,
- )
-
- return {
- ...replyComment,
- // @ts-expect-error
- parentComment: _omit(replyComment.parentComment, ['userId']),
- isOwner: true,
- }
- }
-
- @Auth()
- @Put('reply/:id')
- async updateCommentReply(
- @Param('id') id: string,
- @Body() commentReplyDto: UpdateCommentReplyBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<CommentReply & { isOwner: boolean }> {
- const commentReply = await this.commentsService.findCommentReplyById(id)
-
- if (!commentReply) {
- throw new NotFoundException('Comment reply not found')
- }
-
- if (commentReply.user.id !== userId) {
- throw new BadRequestException(
- 'You are not the owner of this comment reply',
- )
- }
-
- const updatedReplyComment = await this.commentsService.updateCommentReply(
- id,
- commentReplyDto,
- )
-
- return {
- ...updatedReplyComment,
- isOwner: updatedReplyComment.user.id === userId,
- }
- }
-
- @Auth()
- @Delete('reply/:id')
- async deleteCommentReply(
- @Param('id') id: string,
- @CurrentUserId() userId: string,
- ): Promise<void> {
- const commentReply = await this.commentsService.findCommentReplyById(id)
-
- if (!commentReply) {
- throw new NotFoundException('Comment reply not found.')
- }
-
- if (commentReply.user.id !== userId) {
- throw new ConflictException('You are not allowed to do this.')
- }
-
- await this.commentsService.deleteCommentReply(id)
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/comments.module.ts b/backend/apps/cloud/src/marketplace/comments/comments.module.ts
deleted file mode 100644
index f4371c595..000000000
--- a/backend/apps/cloud/src/marketplace/comments/comments.module.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Module } from '@nestjs/common'
-import { TypeOrmModule } from '@nestjs/typeorm'
-import { UserModule } from '../../user/user.module'
-import { ExtensionsModule } from '../extensions/extensions.module'
-import { CommentsController } from './comments.controller'
-import { CommentsService } from './comments.service'
-import { Comment } from './entities/comment.entity'
-import { CommentReply } from './entities/comment-reply.entity'
-
-@Module({
- imports: [
- TypeOrmModule.forFeature([Comment, CommentReply]),
- ExtensionsModule,
- UserModule,
- ],
- controllers: [CommentsController],
- providers: [CommentsService],
-})
-export class CommentsModule {}
diff --git a/backend/apps/cloud/src/marketplace/comments/comments.service.ts b/backend/apps/cloud/src/marketplace/comments/comments.service.ts
deleted file mode 100644
index 8abca4607..000000000
--- a/backend/apps/cloud/src/marketplace/comments/comments.service.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import { Injectable } from '@nestjs/common'
-import { InjectRepository } from '@nestjs/typeorm'
-import { FindManyOptions, FindOneOptions, Repository } from 'typeorm'
-import _isEmpty from 'lodash/isEmpty'
-import { Comment } from './entities/comment.entity'
-import { CreateReplyCommentBodyDto } from './dtos/bodies/create-reply.dto'
-import { UpdateCommentReplyBodyDto } from './dtos/bodies/update-reply.dto'
-import { CommentReply } from './entities/comment-reply.entity'
-
-@Injectable()
-export class CommentsService {
- constructor(
- @InjectRepository(Comment)
- private commentsRepository: Repository<Comment>,
- @InjectRepository(CommentReply)
- private commentReplyRepository: Repository<CommentReply>,
- ) {}
-
- async findAndCount(
- options: FindManyOptions<Comment>,
- ): Promise<[Comment[], number]> {
- return this.commentsRepository.findAndCount({ ...options })
- }
-
- async getCommentsByExtId(extensionId: string, skip: number, take: number) {
- return this.commentsRepository
- .createQueryBuilder('comment')
- .where('comment.extensionId = :extensionId', { extensionId })
- .leftJoinAndSelect('comment.replies', 'reply')
- .leftJoinAndSelect('reply.user', 'replyUser')
- .leftJoinAndSelect('comment.user', 'commentUser')
- .select([
- 'comment.id',
- 'comment.text',
- 'comment.addedAt',
- 'comment.extensionId',
- 'comment.rating',
- // 'commentUser.id',
- 'commentUser.nickname',
- 'reply.id',
- 'reply.text',
- 'reply.addedAt',
- 'replyUser.nickname',
- ])
- .skip(skip)
- .take(take)
- .getManyAndCount()
- }
-
- async findOne(options: FindOneOptions<Comment>): Promise<Comment> {
- return this.commentsRepository.findOne({ ...options })
- }
-
- async save(comment: Partial<Comment>): Promise<Comment> {
- return this.commentsRepository.save(comment)
- }
-
- async delete(id: string): Promise<void> {
- await this.commentsRepository.delete(id)
- }
-
- async update(id: string, comment: Partial<Comment>): Promise<Comment> {
- await this.commentsRepository.update(id, comment)
- return this.commentsRepository.findOne({ where: { id } })
- }
-
- async createCommentReply(
- commentReplyDto: CreateReplyCommentBodyDto,
- comment: Comment,
- userId: string,
- ): Promise<CommentReply> {
- const commentReply = this.commentReplyRepository.create({
- text: commentReplyDto.text,
- parentComment: comment,
- userId,
- })
- return this.commentReplyRepository.save(commentReply)
- }
-
- async haveUserRepliedToComment(
- commentId: string,
- userId: string,
- ): Promise<boolean> {
- return !_isEmpty(
- await this.commentReplyRepository
- .createQueryBuilder('reply')
- .where('reply.parentCommentId = :id', { id: commentId })
- .andWhere('reply.userId = :userId', { userId })
- // .leftJoinAndSelect('reply.parentComment', 'parentComment')
- // .leftJoinAndSelect('reply.user', 'user')
- .select(['reply.id'])
- .getOne(),
- )
- }
-
- async findCommentReplyById(id: string) {
- return this.commentReplyRepository
- .createQueryBuilder('reply')
- .where('reply.id = :id', { id })
- .leftJoinAndSelect('reply.user', 'user')
- .select([
- 'reply.id',
- 'reply.text',
- 'reply.addedAt',
- 'user.nickname',
- 'user.id',
- ])
- .getOne()
- }
-
- async updateCommentReply(
- id: string,
- commentReplyDto: UpdateCommentReplyBodyDto,
- ): Promise<CommentReply | undefined> {
- await this.commentReplyRepository.update(id, commentReplyDto)
-
- return this.findCommentReplyById(id)
- }
-
- async deleteCommentReply(id: string): Promise<void> {
- await this.commentReplyRepository.delete(id)
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-comment.dto.ts b/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-comment.dto.ts
deleted file mode 100644
index fa4ff90d3..000000000
--- a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-comment.dto.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNumber, IsString, IsUUID, Max, Min } from 'class-validator'
-
-export class CreateCommentBodyDto {
- @ApiProperty()
- @IsUUID()
- extensionId: string
-
- @ApiProperty()
- @IsString()
- text: string | null
-
- @ApiProperty()
- @IsNumber()
- @Min(0)
- @Max(5)
- rating: number | null
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-reply.dto.ts b/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-reply.dto.ts
deleted file mode 100644
index 6832be80d..000000000
--- a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/create-reply.dto.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty, IsString, IsUUID } from 'class-validator'
-
-export class CreateReplyCommentBodyDto {
- @ApiProperty()
- @IsUUID()
- @IsNotEmpty()
- commentId: string
-
- @ApiProperty()
- @IsString()
- @IsNotEmpty()
- text: string | null
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/update-reply.dto.ts b/backend/apps/cloud/src/marketplace/comments/dtos/bodies/update-reply.dto.ts
deleted file mode 100644
index 40895e9be..000000000
--- a/backend/apps/cloud/src/marketplace/comments/dtos/bodies/update-reply.dto.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty, IsString } from 'class-validator'
-
-export class UpdateCommentReplyBodyDto {
- @ApiProperty()
- @IsString()
- @IsNotEmpty()
- text: string | null
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/dtos/params/delete-comment.dto.ts b/backend/apps/cloud/src/marketplace/comments/dtos/params/delete-comment.dto.ts
deleted file mode 100644
index f74dad185..000000000
--- a/backend/apps/cloud/src/marketplace/comments/dtos/params/delete-comment.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsUUID } from 'class-validator'
-
-export class DeleteCommentParamDto {
- @IsUUID()
- commentId: string
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/dtos/queries/get-comments.dto.ts b/backend/apps/cloud/src/marketplace/comments/dtos/queries/get-comments.dto.ts
deleted file mode 100644
index da12fc364..000000000
--- a/backend/apps/cloud/src/marketplace/comments/dtos/queries/get-comments.dto.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { IsNumberString, IsOptional, IsString, IsUUID } from 'class-validator'
-
-export class GetCommentsQueryDto {
- @IsNumberString()
- @IsOptional()
- offset?: number
-
- @IsNumberString()
- @IsOptional()
- limit?: number
-
- @IsString()
- extensionId: string
-
- @IsString()
- @IsOptional()
- @IsUUID()
- userId?: string
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/entities/comment-reply.entity.ts b/backend/apps/cloud/src/marketplace/comments/entities/comment-reply.entity.ts
deleted file mode 100644
index 8b882f190..000000000
--- a/backend/apps/cloud/src/marketplace/comments/entities/comment-reply.entity.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import {
- Column,
- CreateDateColumn,
- Entity,
- ManyToOne,
- PrimaryGeneratedColumn,
- JoinColumn,
-} from 'typeorm'
-import { Comment } from './comment.entity'
-import { User } from '../../../user/entities/user.entity'
-
-@Entity()
-export class CommentReply {
- @PrimaryGeneratedColumn('uuid')
- id: string
-
- @ManyToOne(() => Comment, comment => comment.replies, { onDelete: 'CASCADE' })
- parentComment: Comment
-
- @Column()
- userId: string
-
- @Column('text')
- text: string
-
- @CreateDateColumn()
- addedAt: Date
-
- @ManyToOne(() => User, user => user.commentReplies, { onDelete: 'CASCADE' })
- @JoinColumn()
- user: User
-}
diff --git a/backend/apps/cloud/src/marketplace/comments/entities/comment.entity.ts b/backend/apps/cloud/src/marketplace/comments/entities/comment.entity.ts
deleted file mode 100644
index 4cdd357bf..000000000
--- a/backend/apps/cloud/src/marketplace/comments/entities/comment.entity.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import {
- Column,
- CreateDateColumn,
- Entity,
- JoinColumn,
- ManyToOne,
- OneToMany,
- PrimaryGeneratedColumn,
-} from 'typeorm'
-import { Extension } from '../../extensions/entities/extension.entity'
-import { User } from '../../../user/entities/user.entity'
-import { CommentReply } from './comment-reply.entity'
-
-@Entity()
-export class Comment {
- @PrimaryGeneratedColumn('uuid')
- id: string
-
- @Column()
- extensionId: string
-
- @Column()
- userId: string
-
- @Column('text', { nullable: true, default: null })
- text: string | null
-
- @Column('int', { nullable: true, default: null })
- rating: number | null
-
- @CreateDateColumn()
- addedAt: Date
-
- @ManyToOne(() => Extension, extension => extension.comments, {
- onDelete: 'CASCADE',
- })
- @JoinColumn()
- extension: Extension
-
- @ManyToOne(() => User, user => user.comments, { onDelete: 'CASCADE' })
- @JoinColumn()
- user: User
-
- @OneToMany(() => CommentReply, reply => reply.parentComment)
- replies: CommentReply[]
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/complaints.controller.ts b/backend/apps/cloud/src/marketplace/complaints/complaints.controller.ts
deleted file mode 100644
index 9a3d161d7..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/complaints.controller.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import {
- Body,
- Controller,
- NotFoundException,
- Post,
- Query,
-} from '@nestjs/common'
-import { ApiQuery, ApiTags } from '@nestjs/swagger'
-import { UserService } from '../../user/user.service'
-import { ExtensionsService } from '../extensions/extensions.service'
-import { ComplaintsService } from './complaints.service'
-import { CreateComplaintBodyDto } from './dtos/bodies/create-complaint.dto'
-import { CreateComplaintQueryDto } from './dtos/queries/create-complaint.dto'
-import { Complaint } from './entities/complaint.entity'
-
-@ApiTags('complaints')
-@Controller('complaints')
-export class ComplaintsController {
- constructor(
- private readonly complaintsService: ComplaintsService,
- private readonly userService: UserService,
- private readonly extensionsService: ExtensionsService,
- ) {}
-
- @Post()
- @ApiQuery({ name: 'userId', required: true, type: String })
- async createComplaint(
- @Query() queries: CreateComplaintQueryDto,
- @Body() body: CreateComplaintBodyDto,
- ): Promise<Complaint> {
- const user = await this.userService.findOne({
- where: { id: queries.userId },
- })
-
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
- const extension = await this.extensionsService.findOne({
- where: { id: body.extensionId.toString() },
- })
-
- if (!extension) {
- throw new NotFoundException('Extension not found.')
- }
-
- return this.complaintsService.save({
- ...body,
- userId: Number(queries.userId),
- extensionId: Number(body.extensionId),
- })
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/complaints.module.ts b/backend/apps/cloud/src/marketplace/complaints/complaints.module.ts
deleted file mode 100644
index 5231c2cca..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/complaints.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Module } from '@nestjs/common'
-import { TypeOrmModule } from '@nestjs/typeorm'
-import { UserModule } from '../../user/user.module'
-import { ExtensionsModule } from '../extensions/extensions.module'
-import { ComplaintsController } from './complaints.controller'
-import { ComplaintsService } from './complaints.service'
-import { Complaint } from './entities/complaint.entity'
-
-@Module({
- imports: [
- TypeOrmModule.forFeature([Complaint]),
- UserModule,
- ExtensionsModule,
- ],
- controllers: [ComplaintsController],
- providers: [ComplaintsService],
-})
-export class ComplaintsModule {}
diff --git a/backend/apps/cloud/src/marketplace/complaints/complaints.service.ts b/backend/apps/cloud/src/marketplace/complaints/complaints.service.ts
deleted file mode 100644
index 09fd4bb75..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/complaints.service.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Injectable } from '@nestjs/common'
-import { InjectRepository } from '@nestjs/typeorm'
-import { FindManyOptions, FindOneOptions, Repository } from 'typeorm'
-import { Complaint } from './entities/complaint.entity'
-
-@Injectable()
-export class ComplaintsService {
- constructor(
- @InjectRepository(Complaint)
- private complaintsRepository: Repository<Complaint>,
- ) {}
-
- async findAndCount(
- options: FindManyOptions<Complaint>,
- ): Promise<[Complaint[], number]> {
- return this.complaintsRepository.findAndCount(options)
- }
-
- async findOne(options: FindOneOptions<Complaint>): Promise<Complaint> {
- return this.complaintsRepository.findOne(options)
- }
-
- async save(complaint: Partial<Complaint>): Promise<Complaint> {
- return this.complaintsRepository.save(complaint)
- }
-
- async update(id: number, complaint: Partial<Complaint>): Promise<void> {
- await this.complaintsRepository.update({ id }, complaint)
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/dtos/bodies/create-complaint.dto.ts b/backend/apps/cloud/src/marketplace/complaints/dtos/bodies/create-complaint.dto.ts
deleted file mode 100644
index 03025c723..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/dtos/bodies/create-complaint.dto.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNumber, IsString } from 'class-validator'
-
-export class CreateComplaintBodyDto {
- @ApiProperty()
- @IsNumber()
- extensionId: number
-
- @ApiProperty()
- @IsString()
- description: string
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/dtos/queries/create-complaint.dto.ts b/backend/apps/cloud/src/marketplace/complaints/dtos/queries/create-complaint.dto.ts
deleted file mode 100644
index 85618fd1a..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/dtos/queries/create-complaint.dto.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger'
-import { IsNumberString } from 'class-validator'
-
-export class CreateComplaintQueryDto {
- @ApiProperty()
- @IsNumberString()
- userId: string
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/entities/complaint.entity.ts b/backend/apps/cloud/src/marketplace/complaints/entities/complaint.entity.ts
deleted file mode 100644
index 5701ddcf7..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/entities/complaint.entity.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import {
- Column,
- CreateDateColumn,
- Entity,
- JoinColumn,
- ManyToOne,
- PrimaryGeneratedColumn,
-} from 'typeorm'
-import { Extension } from '../../extensions/entities/extension.entity'
-import { User } from '../../../user/entities/user.entity'
-import { ComplaintStatus } from '../enums/complaint-status.enum'
-
-@Entity()
-export class Complaint {
- @PrimaryGeneratedColumn()
- id: number
-
- @Column()
- extensionId: number
-
- @Column()
- userId: number
-
- @Column('text')
- description: string
-
- @Column('text', { nullable: true, default: null })
- reply: string | null
-
- @Column('enum', { enum: ComplaintStatus, default: ComplaintStatus.PENDING })
- status: ComplaintStatus
-
- @Column('boolean', { default: false })
- isResolved: boolean
-
- @CreateDateColumn()
- sendedAt: Date
-
- @ManyToOne(() => Extension, extension => extension.complaints, {
- onDelete: 'CASCADE',
- })
- @JoinColumn()
- extension: Extension
-
- @ManyToOne(() => User, user => user.complaints, {
- onDelete: 'CASCADE',
- })
- @JoinColumn()
- user: User
-}
diff --git a/backend/apps/cloud/src/marketplace/complaints/enums/complaint-status.enum.ts b/backend/apps/cloud/src/marketplace/complaints/enums/complaint-status.enum.ts
deleted file mode 100644
index 29a7afe03..000000000
--- a/backend/apps/cloud/src/marketplace/complaints/enums/complaint-status.enum.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export enum ComplaintStatus {
- PENDING = 'pending',
- RESOLVED = 'resolved',
- REJECTED = 'rejected',
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/install-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/install-extension.dto.ts
deleted file mode 100644
index fd7b07b0d..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/install-extension.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { ValidateIf } from 'class-validator'
-
-export class InstallExtensionBodyDto {
- @ValidateIf((_object, value) => value !== undefined)
- readonly projectId: string | null
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/uninstall-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/uninstall-extension.dto.ts
deleted file mode 100644
index 9f3187ebb..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/bodies/uninstall-extension.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { ValidateIf } from 'class-validator'
-
-export class UninstallExtensionBodyDto {
- @ValidateIf((_object, value) => value !== undefined)
- readonly projectId: string | null
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/create-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/create-extension.dto.ts
deleted file mode 100644
index fc13f1d73..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/create-extension.dto.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import type { Express } from 'express'
-import {
- ArrayMaxSize,
- ArrayNotEmpty,
- IsArray,
- IsEnum,
- IsNotEmpty,
- IsNumberString,
- IsOptional,
- IsString,
- IsUrl,
- Length,
-} from 'class-validator'
-import { HasMimeType, IsFile, IsFiles, MaxFileSize } from 'nestjs-form-data'
-
-export class CreateExtensionBodyDto {
- @IsNotEmpty()
- @IsString()
- @Length(1, 255)
- readonly name: string
-
- @IsOptional()
- @IsString()
- @Length(1, 1024)
- readonly description?: string
-
- @IsOptional()
- @IsNumberString()
- readonly price?: string
-
- @IsOptional()
- @IsNumberString()
- readonly categoryId?: string
-
- @IsOptional()
- @IsUrl()
- readonly companyLink?: string
-
- @IsOptional()
- @IsFile()
- @MaxFileSize(10 * 1024 * 1024)
- @HasMimeType(['image/jpeg', 'image/png'])
- readonly mainImage?: Express.Multer.File
-
- @IsOptional()
- @IsFiles()
- @MaxFileSize(10 * 1024 * 1024, { each: true })
- @HasMimeType(['image/jpeg', 'image/png'], { each: true })
- @ArrayMaxSize(5)
- readonly additionalImages?: Express.Multer.File[]
-
- @IsOptional()
- @IsFile()
- @MaxFileSize(10 * 1024 * 1024)
- @HasMimeType([
- 'text/javascript',
- 'application/javascript',
- 'application/x-javascript',
- 'application/octet-stream',
- ])
- readonly extensionScript?: Express.Multer.File
-}
-
-export enum ExtensionVersionType {
- MAJOR = 'major',
- MINOR = 'minor',
- PATCH = 'patch',
-}
-
-export class AdditionalExtensionInfo {
- @IsNotEmpty()
- @IsEnum(ExtensionVersionType)
- readonly version: ExtensionVersionType
-
- @IsNotEmpty()
- @ArrayNotEmpty()
- @IsArray()
- @IsString({ each: true })
- readonly additionalImagesToDelete: string[]
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/delete-extension-params.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/delete-extension-params.dto.ts
deleted file mode 100644
index 86470c2aa..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/delete-extension-params.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsString } from 'class-validator'
-
-export class DeleteExtensionParams {
- @IsString()
- readonly extensionId!: string
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/get-all-extensions-queries.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/get-all-extensions-queries.dto.ts
deleted file mode 100644
index c1bb12989..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/get-all-extensions-queries.dto.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { IsNumberString, IsOptional } from 'class-validator'
-
-export class GetAllExtensionsQueries {
- @IsNumberString()
- @IsOptional()
- readonly offset?: number
-
- @IsNumberString()
- @IsOptional()
- readonly limit?: number
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/get-extension-params.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/get-extension-params.dto.ts
deleted file mode 100644
index 9fee7d1ac..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/get-extension-params.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsString } from 'class-validator'
-
-export class GetExtensionParams {
- @IsString()
- readonly extensionId!: string
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/index.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/index.ts
deleted file mode 100644
index df8608c0d..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './create-extension.dto'
-export * from './update-extension.dto'
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/params/install-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/params/install-extension.dto.ts
deleted file mode 100644
index 228ceba5a..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/params/install-extension.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsUUID } from 'class-validator'
-
-export class InstallExtensionParamsDto {
- @IsUUID()
- readonly extensionId: string
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/params/uninstall-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/params/uninstall-extension.dto.ts
deleted file mode 100644
index 3af3db101..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/params/uninstall-extension.dto.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { IsUUID } from 'class-validator'
-
-export class UninstallExtensionParamsDto {
- @IsUUID()
- readonly extensionId: string
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/queries/get-installed-extensions.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/queries/get-installed-extensions.dto.ts
deleted file mode 100644
index 65b43ec27..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/queries/get-installed-extensions.dto.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { IsNumberString, IsOptional } from 'class-validator'
-
-export class GetInstalledExtensionsQueriesDto {
- @IsNumberString()
- @IsOptional()
- readonly offset?: number
-
- @IsNumberString()
- @IsOptional()
- readonly limit?: number
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/search-extension-queries.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/search-extension-queries.dto.ts
deleted file mode 100644
index 2c34a27e8..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/search-extension-queries.dto.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { IsEnum, IsNumberString, IsOptional, IsString } from 'class-validator'
-import { SortByExtension } from '../enums/sort-by-extension.enum'
-
-export class SearchExtensionQueries {
- @IsString()
- readonly term!: string
-
- @IsString()
- @IsOptional()
- readonly category!: string
-
- @IsEnum(SortByExtension)
- @IsOptional()
- readonly sortBy?: SortByExtension
-
- @IsNumberString()
- @IsOptional()
- readonly offset?: number
-
- @IsNumberString()
- @IsOptional()
- readonly limit?: number
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/dtos/update-extension.dto.ts b/backend/apps/cloud/src/marketplace/extensions/dtos/update-extension.dto.ts
deleted file mode 100644
index 697f4625b..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/dtos/update-extension.dto.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { IntersectionType, PartialType } from '@nestjs/mapped-types'
-import { IsUUID } from 'class-validator'
-import {
- CreateExtensionBodyDto,
- AdditionalExtensionInfo,
-} from './create-extension.dto'
-
-export class UpdateExtensionParamsDto {
- @IsUUID()
- readonly extensionId: string
-}
-
-export class UpdateExtensionBodyDto extends IntersectionType(
- PartialType(CreateExtensionBodyDto),
- PartialType(AdditionalExtensionInfo),
-) {}
diff --git a/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-project.entity.ts b/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-project.entity.ts
deleted file mode 100644
index 72c61e606..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-project.entity.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import {
- Column,
- CreateDateColumn,
- Entity,
- JoinColumn,
- ManyToOne,
- PrimaryGeneratedColumn,
-} from 'typeorm'
-import { Project } from '../../../project/entity/project.entity'
-import { Extension } from './extension.entity'
-
-@Entity()
-export class ExtensionToProject {
- @PrimaryGeneratedColumn('uuid')
- id: string
-
- @Column()
- extensionId: string
-
- @Column()
- projectId: string
-
- @Column('boolean', { default: true })
- isActive: boolean
-
- @ManyToOne(() => Extension, extension => extension.projects)
- @JoinColumn()
- extension: Extension
-
- @ManyToOne(() => Project, project => project.extensions)
- @JoinColumn()
- project: Project
-
- @CreateDateColumn()
- createdAt: Date
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-user.entity.ts b/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-user.entity.ts
deleted file mode 100644
index cb07da089..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/entities/extension-to-user.entity.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import {
- Column,
- Entity,
- JoinColumn,
- ManyToOne,
- PrimaryGeneratedColumn,
-} from 'typeorm'
-import { User } from '../../../user/entities/user.entity'
-import { Extension } from './extension.entity'
-
-@Entity()
-export class ExtensionToUser {
- @PrimaryGeneratedColumn('uuid')
- id: string
-
- @Column()
- extensionId: string
-
- @Column()
- userId: string
-
- @Column('boolean', { default: true })
- isActive: boolean
-
- @ManyToOne(() => Extension, extension => extension.users)
- @JoinColumn()
- extension: Extension
-
- @ManyToOne(() => User, user => user.extensions)
- @JoinColumn()
- user: User
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/entities/extension.entity.ts b/backend/apps/cloud/src/marketplace/extensions/entities/extension.entity.ts
deleted file mode 100644
index 67ac54871..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/entities/extension.entity.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import {
- Column,
- CreateDateColumn,
- Entity,
- JoinTable,
- ManyToOne,
- OneToMany,
- PrimaryGeneratedColumn,
- UpdateDateColumn,
-} from 'typeorm'
-import { User } from '../../../user/entities/user.entity'
-import { ExtensionStatus } from '../enums/extension-status.enum'
-import { Category } from '../../categories/category.entity'
-import { ExtensionToUser } from './extension-to-user.entity'
-import { ExtensionToProject } from './extension-to-project.entity'
-import { Comment } from '../../comments/entities/comment.entity'
-import { Complaint } from '../../complaints/entities/complaint.entity'
-
-@Entity()
-export class Extension {
- @PrimaryGeneratedColumn('uuid')
- id: string
-
- @ManyToOne(() => User, user => user.ownedExtensions)
- owner: User
-
- @Column('varchar')
- name: string
-
- @Column({ type: 'text', nullable: true, default: null })
- description: string | null
-
- @Column('varchar', { default: '0.0.1' })
- version: string
-
- @Column({ type: 'enum', enum: ExtensionStatus })
- status: ExtensionStatus
-
- @Column({ type: 'int', default: 0 })
- price: number
-
- @Column({ type: 'varchar', nullable: true, default: null })
- mainImage: string | null
-
- @Column('simple-array')
- additionalImages: string[] | []
-
- @Column({ type: 'varchar', nullable: true, default: null })
- fileURL: string | null
-
- @Column('varchar', { default: null, nullable: true })
- companyLink: string | null
-
- @CreateDateColumn()
- createdAt: Date
-
- @UpdateDateColumn()
- updatedAt: Date
-
- @ManyToOne(() => Category, category => category.extensions)
- category: Category
-
- @OneToMany(
- () => ExtensionToUser,
- extensionToUser => extensionToUser.extension,
- )
- @JoinTable()
- users: ExtensionToUser[]
-
- @OneToMany(
- () => ExtensionToProject,
- extensionToProject => extensionToProject.extension,
- )
- @JoinTable()
- projects: ExtensionToProject[]
-
- @OneToMany(() => Comment, comment => comment.extension)
- @JoinTable()
- comments: Comment[]
-
- @OneToMany(() => Complaint, complaint => complaint.extension)
- @JoinTable()
- complaints: Complaint[]
-
- @Column({ type: 'simple-array' })
- tags: string[]
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/enums/extension-status.enum.ts b/backend/apps/cloud/src/marketplace/extensions/enums/extension-status.enum.ts
deleted file mode 100644
index f05e87778..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/enums/extension-status.enum.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export enum ExtensionStatus {
- ACCEPTED = 'ACCEPTED',
- REJECTED = 'REJECTED',
- PENDING = 'PENDING',
- NO_EXTENSION_UPLOADED = 'NO_EXTENSION_UPLOADED',
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/enums/sort-by-extension.enum.ts b/backend/apps/cloud/src/marketplace/extensions/enums/sort-by-extension.enum.ts
deleted file mode 100644
index a902d0b0c..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/enums/sort-by-extension.enum.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum SortByExtension {
- CREATED_AT = 'createdAt',
- UPDATED_AT = 'updatedAt',
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/extensions.controller.ts b/backend/apps/cloud/src/marketplace/extensions/extensions.controller.ts
deleted file mode 100644
index ea2ded9e9..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/extensions.controller.ts
+++ /dev/null
@@ -1,536 +0,0 @@
-import {
- BadRequestException,
- Body,
- ConflictException,
- Controller,
- Delete,
- ForbiddenException,
- Get,
- NotFoundException,
- Param,
- Patch,
- Post,
- Query,
- UsePipes,
- ValidationPipe,
-} from '@nestjs/common'
-import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
-import { FormDataRequest } from 'nestjs-form-data'
-import _map from 'lodash/map'
-import _size from 'lodash/size'
-import { CurrentUserId } from '../../auth/decorators/current-user-id.decorator'
-import { Auth } from '../../auth/decorators'
-import { AppLoggerService } from '../../logger/logger.service'
-import { DeleteExtensionParams } from './dtos/delete-extension-params.dto'
-import { GetExtensionParams } from './dtos/get-extension-params.dto'
-import { GetAllExtensionsQueries } from './dtos/get-all-extensions-queries.dto'
-import { ExtensionsService } from './extensions.service'
-import { UserService } from '../../user/user.service'
-import { SearchExtensionQueries } from './dtos/search-extension-queries.dto'
-import { CategoriesService } from '../categories/categories.service'
-import { Extension } from './entities/extension.entity'
-import { GetInstalledExtensionsQueriesDto } from './dtos/queries/get-installed-extensions.dto'
-import { InstallExtensionParamsDto } from './dtos/params/install-extension.dto'
-import { UninstallExtensionParamsDto } from './dtos/params/uninstall-extension.dto'
-import { InstallExtensionBodyDto } from './dtos/bodies/install-extension.dto'
-import { UninstallExtensionBodyDto } from './dtos/bodies/uninstall-extension.dto'
-import { ProjectService } from '../../project/project.service'
-import {
- CreateExtensionBodyDto,
- UpdateExtensionBodyDto,
- UpdateExtensionParamsDto,
-} from './dtos'
-
-@ApiTags('extensions')
-@UsePipes(
- new ValidationPipe({
- forbidNonWhitelisted: true,
- forbidUnknownValues: true,
- transform: true,
- whitelist: true,
- }),
-)
-@Controller('extensions')
-export class ExtensionsController {
- constructor(
- private readonly extensionsService: ExtensionsService,
- private readonly categoriesService: CategoriesService,
- private readonly userService: UserService,
- private readonly logger: AppLoggerService,
- private readonly projectService: ProjectService,
- ) {}
-
- @Get('installed')
- @Auth()
- async getInstalledExtensions(
- @Query() queries: GetInstalledExtensionsQueriesDto,
- @CurrentUserId() userId: string,
- ): Promise<{
- extensions: Extension[]
- count: number
- }> {
- this.logger.log({ queries }, 'GET /extensions/installed')
-
- if (!userId) {
- throw new ForbiddenException(
- 'You must be logged in to access this route.',
- )
- }
-
- const [extensionsToUser, count] =
- await this.extensionsService.findAndCountExtensionToUser(
- {
- where: {
- userId,
- },
- skip: queries.offset || 0,
- take: queries.limit > 100 ? 25 : queries.limit || 25,
- },
- [
- 'extension',
- 'extension.owner',
- 'extension.category',
- 'extension.users',
- ],
- )
-
- let extensions = _map(extensionsToUser, extensionToUser => {
- return extensionToUser.extension
- })
-
- extensions = _map(extensions, extension => {
- // @ts-expect-error
- extension.usersQuantity = _size(extension.users)
- extension.users = undefined
- // @ts-expect-error
- extension.owner = this.extensionsService.filterOwner(extension.owner)
- return extension
- })
-
- // todo: also return projectExtensions - via findAndCountExtensionToProject
-
- // @ts-ignore
- return { extensions, count }
- }
-
- @ApiQuery({
- description: 'Extension offset',
- example: '5',
- name: 'offset',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension limit',
- example: '25',
- name: 'limit',
- required: false,
- type: String,
- })
- @Get()
- async getExtensions(@Query() queries: GetAllExtensionsQueries) {
- let [extensions, count] =
- await this.extensionsService.getExtensions(queries)
-
- extensions = _map(extensions, extension => {
- // @ts-expect-error
- extension.usersQuantity = _size(extension.users)
- extension.users = undefined
- // @ts-expect-error
- extension.owner = this.extensionsService.filterOwner(extension.owner)
- return extension
- })
-
- return { extensions, count }
- }
-
- @ApiQuery({
- description: 'Extension term',
- example: '',
- name: 'term',
- type: String,
- })
- @ApiQuery({
- description: 'Extension category',
- example: '',
- name: 'category',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension sortBy',
- example: 'createdAt',
- name: 'sortBy',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension offset',
- example: '5',
- name: 'offset',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension limit',
- example: '25',
- name: 'limit',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension owner id',
- name: 'ownerId',
- example: 'ea5a0383-e5ba-4dab-989e-3108d5a2e3bc',
- required: false,
- type: String,
- })
- @Get('published')
- @Auth()
- async getAllPublishedExtensions(
- @Query() queries: GetAllExtensionsQueries,
- @CurrentUserId() userId: string,
- ): Promise<{
- extensions: Extension[]
- count: number
- }> {
- if (!userId) {
- throw new ForbiddenException(
- 'You must be logged in to access this route.',
- )
- }
-
- let [extensions, count] = await this.extensionsService.findAndCount({
- skip: queries.offset || 0,
- take: queries.limit > 100 ? 100 : queries.limit || 10,
- where: {
- owner: { id: userId },
- },
- relations: ['owner', 'users', 'category'],
- })
-
- extensions = _map(extensions, extension => {
- // @ts-expect-error
- extension.usersQuantity = _size(extension.users)
- extension.users = undefined
- // @ts-expect-error
- extension.owner = this.extensionsService.filterOwner(extension.owner)
- return extension
- })
-
- return { extensions, count }
- }
-
- @ApiQuery({
- description: 'Extension term',
- example: '',
- name: 'term',
- type: String,
- })
- @ApiQuery({
- description: 'Extension category',
- example: '',
- name: 'category',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension sortBy',
- example: 'createdAt',
- name: 'sortBy',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension offset',
- example: '5',
- name: 'offset',
- required: false,
- type: String,
- })
- @ApiQuery({
- description: 'Extension limit',
- example: '25',
- name: 'limit',
- required: false,
- type: String,
- })
- @Get('search')
- async searchExtension(@Query() queries: SearchExtensionQueries) {
- let [extensions, count] =
- await this.extensionsService.searchExtension(queries)
-
- extensions = _map(extensions, extension => {
- // @ts-expect-error
- extension.usersQuantity = _size(extension.users)
- extension.users = undefined
- // @ts-expect-error
- extension.owner = this.extensionsService.filterOwner(extension.owner)
- return extension
- })
-
- return { extensions, count }
- }
-
- @ApiParam({
- name: 'extensionId',
- description: 'Extension ID',
- example: 'de025965-3221-4d09-ba35-a09da59793a6',
- type: String,
- })
- @Get(':extensionId')
- async getExtension(@Param() params: GetExtensionParams): Promise<Extension> {
- const extension = await this.extensionsService.findOne({
- where: {
- id: params.extensionId,
- },
- relations: ['category'],
- })
-
- if (!extension) {
- throw new NotFoundException('Extension not found.')
- }
-
- return extension
- }
-
- @Post()
- @Auth()
- @FormDataRequest()
- async createExtension(
- @Body() body: CreateExtensionBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<Extension> {
- if (body.categoryId) {
- const category = await this.categoriesService.getCategoryById(
- Number(body.categoryId),
- )
-
- if (!category) {
- throw new BadRequestException('Category not found.')
- }
- }
-
- return this.extensionsService.createExtension({
- ownerId: userId,
- ...body,
- })
- }
-
- @Patch(':extensionId')
- @Auth()
- @FormDataRequest()
- async updateExtension(
- @Param() params: UpdateExtensionParamsDto,
- @Body() body: UpdateExtensionBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<Extension> {
- const extension = await this.extensionsService.findUserExtension(
- params.extensionId,
- userId,
- )
-
- if (!extension) {
- throw new NotFoundException('Extension not found.')
- }
-
- if (body.categoryId) {
- const category = await this.categoriesService.getCategoryById(
- Number(body.categoryId),
- )
-
- if (!category) {
- throw new BadRequestException('Category not found.')
- }
- }
-
- if (Object.keys(body).length === 0) {
- throw new BadRequestException('Extension body is required.')
- }
-
- const extensionBodyAdditionalImagesCount = body.additionalImages
- ? body.additionalImages.length
- : 0
- const extensionAdditionalImagesCount = extension.additionalImages.length
- const maxAdditionalImagesCount = 5
- const additionalImagesToDelete = body.additionalImagesToDelete
- ? body.additionalImagesToDelete.length
- : 0
- const sum =
- extensionAdditionalImagesCount +
- extensionBodyAdditionalImagesCount -
- additionalImagesToDelete
-
- if (sum > maxAdditionalImagesCount || sum < 0) {
- throw new BadRequestException(
- `You can upload maximum ${maxAdditionalImagesCount} additional images.`,
- )
- }
-
- return this.extensionsService.updateExtension(
- params.extensionId,
- body,
- extension.version,
- )
- }
-
- @ApiParam({
- name: 'extensionId',
- description: 'Extension ID',
- example: 'de025965-3221-4d09-ba35-a09da59793a6',
- type: String,
- })
- @Delete(':extensionId')
- async deleteExtension(
- @Param() params: DeleteExtensionParams,
- @CurrentUserId() userId: string,
- ): Promise<void> {
- const { extensionId } = params
-
- this.extensionsService.allowedToManage(userId, extensionId)
-
- await this.extensionsService.delete(extensionId)
- }
-
- @Post(':extensionId/install')
- @Auth()
- async installExtension(
- @Param() params: InstallExtensionParamsDto,
- @Body() body: InstallExtensionBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<any> {
- this.logger.log({ params, body }, 'POST /extensions/:extensionId/install')
-
- if (!userId) {
- throw new ForbiddenException(
- 'You must be logged in to access this route.',
- )
- }
-
- const extension = await this.extensionsService.findOne({
- where: { id: params.extensionId },
- })
- if (!extension) {
- throw new NotFoundException('Extension not found.')
- }
-
- const user = await this.userService.findOne({ where: { id: userId } })
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
- if (!body.projectId) {
- const extensionToUser =
- await this.extensionsService.findOneExtensionToUser({
- where: {
- extensionId: extension.id,
- userId: user.id,
- },
- })
- if (extensionToUser) {
- throw new ConflictException('Extension already installed.')
- }
-
- return this.extensionsService.createExtensionToUser({
- extensionId: extension.id,
- userId: user.id,
- })
- }
-
- const project = await this.projectService.findOne({
- where: { id: body.projectId },
- })
- if (!project) {
- throw new NotFoundException('Project not found.')
- }
-
- this.projectService.allowedToManage(project, userId)
-
- const extensionToProject =
- await this.extensionsService.findOneExtensionToProject({
- where: {
- extensionId: extension.id,
- projectId: project.id,
- },
- })
- if (extensionToProject) {
- await this.extensionsService.deleteExtensionToUser(extension.id, user.id)
- }
-
- return this.extensionsService.createExtensionToProject({
- extensionId: extension.id,
- projectId: project.id,
- })
- }
-
- @Delete(':extensionId/uninstall')
- @Auth()
- async uninstallExtension(
- @Param() params: UninstallExtensionParamsDto,
- @Body() body: UninstallExtensionBodyDto,
- @CurrentUserId() userId: string,
- ): Promise<void> {
- this.logger.log(
- { params, body },
- 'DELETE /extensions/:extensionId/uninstall',
- )
-
- if (!userId) {
- throw new ForbiddenException(
- 'You must be logged in to access this route.',
- )
- }
-
- const extension = await this.extensionsService.findOne({
- where: { id: params.extensionId },
- })
- if (!extension) {
- throw new NotFoundException('Extension not found.')
- }
-
- const user = await this.userService.findOne({ where: { id: userId } })
- if (!user) {
- throw new NotFoundException('User not found.')
- }
-
- if (!body.projectId) {
- const extensionToUser =
- await this.extensionsService.findOneExtensionToUser({
- where: {
- extensionId: extension.id,
- userId: user.id,
- },
- })
- if (!extensionToUser) {
- throw new NotFoundException('Extension not installed.')
- }
-
- return this.extensionsService.deleteExtensionToUser(extension.id, user.id)
- }
-
- const project = await this.projectService.findOne({
- where: { id: body.projectId },
- })
- if (!project) {
- throw new NotFoundException('Project not found.')
- }
-
- this.projectService.allowedToManage(project, userId)
-
- const extensionToProject =
- await this.extensionsService.findOneExtensionToProject({
- where: {
- extensionId: extension.id,
- projectId: project.id,
- },
- })
- if (!extensionToProject) {
- throw new NotFoundException('Extension not installed.')
- }
-
- return this.extensionsService.deleteExtensionToProject(
- extension.id,
- project.id,
- )
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/extensions.module.ts b/backend/apps/cloud/src/marketplace/extensions/extensions.module.ts
deleted file mode 100644
index 05d8c1056..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/extensions.module.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Module } from '@nestjs/common'
-import { TypeOrmModule } from '@nestjs/typeorm'
-import { CategoriesModule } from '../categories/categories.module'
-import { CdnModule } from '../cdn/cdn.module'
-import { ExtensionsController } from './extensions.controller'
-import { ExtensionsService } from './extensions.service'
-import { Extension } from './entities/extension.entity'
-import { ExtensionToProject } from './entities/extension-to-project.entity'
-import { ExtensionToUser } from './entities/extension-to-user.entity'
-import { ProjectModule } from '../../project/project.module'
-import { UserModule } from '../../user/user.module'
-import { AppLoggerModule } from '../../logger/logger.module'
-
-@Module({
- imports: [
- TypeOrmModule.forFeature([Extension, ExtensionToUser, ExtensionToProject]),
- CategoriesModule,
- CdnModule,
- UserModule,
- ProjectModule,
- AppLoggerModule,
- ],
- controllers: [ExtensionsController],
- providers: [ExtensionsService],
- exports: [ExtensionsService],
-})
-export class ExtensionsModule {}
diff --git a/backend/apps/cloud/src/marketplace/extensions/extensions.service.ts b/backend/apps/cloud/src/marketplace/extensions/extensions.service.ts
deleted file mode 100644
index 668bcca2e..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/extensions.service.ts
+++ /dev/null
@@ -1,356 +0,0 @@
-import { ForbiddenException, Injectable } from '@nestjs/common'
-import _pick from 'lodash/pick'
-import { InjectRepository } from '@nestjs/typeorm'
-import { FindManyOptions, FindOneOptions, Like, Repository } from 'typeorm'
-import { UserService } from '../../user/user.service'
-import { ExtensionToProject } from './entities/extension-to-project.entity'
-import { ExtensionToUser } from './entities/extension-to-user.entity'
-import { Extension } from './entities/extension.entity'
-import { ICreateExtension } from './interfaces/create-extension.interface'
-import { ISaveExtension } from './interfaces/save-extension.interface'
-import { User } from '../../user/entities/user.entity'
-import { IUpdateExtension } from './interfaces/update-extension.interface'
-import { CreateExtensionType, UpdateExtensionType } from './types'
-import { ExtensionStatus } from './enums/extension-status.enum'
-import { CdnService } from '../cdn/cdn.service'
-import { VersionTypes } from './interfaces'
-import { SearchExtensionQueries } from './dtos/search-extension-queries.dto'
-import { GetAllExtensionsQueries } from './dtos/get-all-extensions-queries.dto'
-import { ExtensionVersionType } from './dtos/create-extension.dto'
-
-const DEFAULT_EXTENSION_VERSION = '0.0.1'
-
-@Injectable()
-export class ExtensionsService {
- constructor(
- @InjectRepository(Extension)
- private readonly extensionRepository: Repository<Extension>,
- @InjectRepository(ExtensionToProject)
- private readonly extensionToProjectRepository: Repository<ExtensionToProject>,
- @InjectRepository(ExtensionToUser)
- private readonly extensionToUserRepository: Repository<ExtensionToUser>,
- private readonly cdnService: CdnService,
- private readonly userService: UserService,
- ) {}
-
- async findOne(options: FindOneOptions<Extension>): Promise<Extension> {
- return this.extensionRepository.findOne({ ...options })
- }
-
- create(extension: ICreateExtension): Extension {
- return this.extensionRepository.create(extension)
- }
-
- async findOneExtensionToProject(
- options: FindOneOptions<ExtensionToProject>,
- ): Promise<ExtensionToProject> {
- return this.extensionToProjectRepository.findOne({ ...options })
- }
-
- async createExtensionToProject(
- extensionToProject: Pick<ExtensionToProject, 'extensionId' | 'projectId'>,
- ): Promise<
- Pick<ExtensionToProject, 'extensionId' | 'projectId'> & ExtensionToProject
- > {
- return this.extensionToProjectRepository.save(extensionToProject)
- }
-
- async deleteExtensionToProject(
- extensionId: string,
- projectId: string,
- ): Promise<void> {
- await this.extensionToProjectRepository.delete({ extensionId, projectId })
- }
-
- async findAndCountExtensionToProject(
- options: FindManyOptions<ExtensionToProject>,
- relations: string[] = [],
- ): Promise<[ExtensionToProject[], number]> {
- return this.extensionToProjectRepository.findAndCount({
- ...options,
- relations,
- })
- }
-
- async findAndCountExtensionToUser(
- options: FindManyOptions<ExtensionToUser>,
- relations: string[] = [],
- ): Promise<[ExtensionToUser[], number]> {
- return this.extensionToUserRepository.findAndCount({
- ...options,
- relations,
- })
- }
-
- async findOneExtensionToUser(
- options: FindOneOptions<ExtensionToUser>,
- ): Promise<ExtensionToUser> {
- return this.extensionToUserRepository.findOne({ ...options })
- }
-
- async createExtensionToUser(
- extensionToUser: Pick<ExtensionToUser, 'extensionId' | 'userId'>,
- ): Promise<
- Pick<ExtensionToUser, 'extensionId' | 'userId'> & ExtensionToUser
- > {
- return this.extensionToUserRepository.save(extensionToUser)
- }
-
- async deleteExtensionToUser(
- extensionId: string,
- userId: string,
- ): Promise<void> {
- await this.extensionToUserRepository.delete({ extensionId, userId })
- }
-
- filterOwner(owner: User) {
- return _pick(owner, ['nickname'])
- }
-
- // async createInstall(
- // installExtension: InstallExtension,
- // ): Promise<InstallExtension> {
- // return this.InstallExtensionRepository.create(installExtension)
- // }
-
- // async saveInstall(extension: InstallExtension): Promise<InstallExtension> {
- // return await this.InstallExtensionRepository.save(extension)
- // }
-
- // async updateInstall(
- // id: string,
- // installExtension: InstallExtension,
- // ): Promise<any> {
- // return this.InstallExtensionRepository.update(id, installExtension)
- // }
-
- // async deleteInstall(id: string): Promise<any> {
- // return this.InstallExtensionRepository.delete(id)
- // }
-
- // async findInstall(params: object): Promise<InstallExtension[]> {
- // return this.InstallExtensionRepository.find(params)
- // }
-
- // async findOneInstall(
- // id: string,
- // params: Object = {},
- // ): Promise<InstallExtension | null> {
- // return this.InstallExtensionRepository.findOne(id, params)
- // }
-
- async allowedToManage(ownerId: string, id: string): Promise<any> {
- const extension = await this.findOne({
- where: { owner: { id: ownerId }, id },
- })
-
- if (!extension) {
- throw new ForbiddenException(
- 'You are not allowed to manage this extension',
- )
- }
- }
-
- async save(extension: ISaveExtension): Promise<ISaveExtension & Extension> {
- return this.extensionRepository.save(extension)
- }
-
- async findById(id: string): Promise<Extension> {
- return this.findOne({ where: { id } })
- }
-
- async update(id: string, extension: IUpdateExtension) {
- await this.extensionRepository.update({ id }, extension)
- }
-
- async delete(id: string): Promise<void> {
- await this.extensionRepository.delete({ id })
- }
-
- async findAndCount(
- options: FindManyOptions<Extension>,
- ): Promise<[Extension[], number]> {
- return this.extensionRepository.findAndCount(options)
- }
-
- async createExtension(extension: CreateExtensionType) {
- return this.extensionRepository.save({
- owner: { id: extension.ownerId },
- name: extension.name,
- description: extension.description,
- status: extension.extensionScript
- ? ExtensionStatus.PENDING
- : ExtensionStatus.NO_EXTENSION_UPLOADED,
- price: extension.price && Number(extension.price),
- category: { id: extension.categoryId && Number(extension.categoryId) },
- companyLink: extension.companyLink,
- mainImage:
- extension.mainImage &&
- (await this.cdnService.uploadFile(extension.mainImage)).filename,
- additionalImages: extension.additionalImages
- ? [
- ...(await Promise.all(
- extension.additionalImages.map(
- async image =>
- (await this.cdnService.uploadFile(image)).filename,
- ),
- )),
- ]
- : [],
- fileURL:
- extension.extensionScript &&
- (await this.cdnService.uploadFile(extension.extensionScript)).filename,
- version: DEFAULT_EXTENSION_VERSION,
- tags: ['New'],
- })
- }
-
- async findUserExtension(extensionId: string, userId: string) {
- const user = await this.userService.findUserById(userId)
-
- if (!user) return null
-
- return this.extensionRepository.findOne({
- where: { id: extensionId, owner: { id: userId } },
- })
- }
-
- async updateExtension(
- extensionId: string,
- extension: UpdateExtensionType,
- extensionVersion: string,
- ) {
- const oldExtension = await this.extensionRepository.findOne({
- where: { id: extensionId },
- })
-
- const additionalImages = [...oldExtension.additionalImages]
-
- if (extension.additionalImages) {
- additionalImages.push(
- ...(await Promise.all(
- extension.additionalImages.map(
- async image => (await this.cdnService.uploadFile(image)).filename,
- ),
- )),
- )
- }
-
- if (extension.additionalImagesToDelete) {
- extension.additionalImagesToDelete.forEach(async image => {
- const index = additionalImages.indexOf(image)
-
- if (index > -1) {
- additionalImages.splice(index, 1)
- }
-
- if (additionalImages.includes(image)) {
- await this.cdnService.deleteFile(image)
- }
- })
- }
-
- await this.extensionRepository.update(
- { id: extensionId },
- {
- name: extension.name ? extension.name : oldExtension.name,
- description: extension.description
- ? extension.description
- : oldExtension.description,
- version: extension.version
- ? this.extensionVersion(extensionVersion, extension.version)
- : oldExtension.version,
- status: extension.extensionScript
- ? ExtensionStatus.PENDING
- : oldExtension.status,
- price: extension.price ? Number(extension.price) : oldExtension.price,
- category: { id: extension.categoryId && Number(extension.categoryId) },
- companyLink: extension.companyLink,
- mainImage: extension.mainImage
- ? (await this.cdnService.uploadFile(extension.mainImage)).filename
- : oldExtension.mainImage,
- additionalImages,
- fileURL: extension.extensionScript
- ? (await this.cdnService.uploadFile(extension.extensionScript))
- .filename
- : oldExtension.fileURL,
- },
- )
-
- return this.extensionRepository.findOne({
- where: { id: extensionId },
- })
- }
-
- extensionVersion(
- extensionVersion: string,
- versionType: ExtensionVersionType,
- ) {
- const versionTypes: VersionTypes = {
- major: [1, 0, 0],
- minor: [0, 1, 0],
- patch: [0, 0, 1],
- }
-
- const updateVersion: number[] = extensionVersion.split('.').map(Number)
- const versionUpdate: number[] = versionTypes[versionType]
-
- updateVersion[0] += versionUpdate[0]
- updateVersion[1] += versionUpdate[1]
- updateVersion[2] += versionUpdate[2]
-
- const newVersion: string = updateVersion.join('.')
-
- return newVersion
- }
-
- async searchExtension(data: SearchExtensionQueries) {
- return this.extensionRepository.findAndCount({
- skip: data.offset || 0,
- take: data.limit > 100 ? 100 : data.limit || 10,
- where: {
- name: Like(`%${data.term}%`),
- status: ExtensionStatus.ACCEPTED,
- },
- order: {
- createdAt:
- data.sortBy && data.sortBy === 'createdAt' ? 'DESC' : undefined,
- updatedAt:
- data.sortBy && data.sortBy === 'updatedAt' ? 'DESC' : undefined,
- },
- relations: ['owner', 'users', 'category'],
- })
- }
-
- async getExtensions(data: GetAllExtensionsQueries) {
- return this.extensionRepository.findAndCount({
- skip: data.offset || 0,
- take: data.limit > 100 ? 100 : data.limit || 10,
- where: {
- status: ExtensionStatus.ACCEPTED,
- },
- relations: ['owner', 'users', 'category'],
- })
- }
-
- async find(options: FindManyOptions<Extension>): Promise<Extension[]> {
- return this.extensionRepository.find(options)
- }
-
- async getExtensionInstallCount(
- extensionId: string,
- twoWeeksAgo?: Date,
- ): Promise<number> {
- const query = this.extensionToProjectRepository
- .createQueryBuilder('extensionToProject')
- .where('extensionToProject.extensionId = :extensionId', { extensionId })
-
- if (twoWeeksAgo) {
- query.andWhere('extensionToProject.createdAt > :twoWeeksAgo', {
- twoWeeksAgo,
- })
- }
-
- return query.getCount()
- }
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/interfaces/create-extension.interface.ts b/backend/apps/cloud/src/marketplace/extensions/interfaces/create-extension.interface.ts
deleted file mode 100644
index 315d14d5a..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/interfaces/create-extension.interface.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { User } from '../../../user/entities/user.entity'
-import { Category } from '../../categories/category.entity'
-import { ExtensionStatus } from '../enums/extension-status.enum'
-
-export interface ICreateExtension {
- name: string
- description?: string | null
- version: string
- owner: User
- price?: number
- mainImage?: string | null
- additionalImages?: string[] | []
- status?: ExtensionStatus
- fileURL?: string
- category?: Category
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/interfaces/index.ts b/backend/apps/cloud/src/marketplace/extensions/interfaces/index.ts
deleted file mode 100644
index df0bd1ddc..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/interfaces/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './version-types.interface'
diff --git a/backend/apps/cloud/src/marketplace/extensions/interfaces/save-extension.interface.ts b/backend/apps/cloud/src/marketplace/extensions/interfaces/save-extension.interface.ts
deleted file mode 100644
index b99e4ba9d..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/interfaces/save-extension.interface.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Category } from '../../categories/category.entity'
-
-export interface ISaveExtension {
- name: string
- description?: string | null
- version: string
- price?: number
- mainImage?: string | null
- additionalImages?: string[] | []
- category?: Category
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/interfaces/update-extension.interface.ts b/backend/apps/cloud/src/marketplace/extensions/interfaces/update-extension.interface.ts
deleted file mode 100644
index 6d0d8604e..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/interfaces/update-extension.interface.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export interface IUpdateExtension {
- name?: string
- description?: string | null
- version?: string
- price?: number
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/interfaces/version-types.interface.ts b/backend/apps/cloud/src/marketplace/extensions/interfaces/version-types.interface.ts
deleted file mode 100644
index dc528020a..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/interfaces/version-types.interface.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export interface VersionTypes {
- [key: string]: [number, number, number]
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/types/create-extension.type.ts b/backend/apps/cloud/src/marketplace/extensions/types/create-extension.type.ts
deleted file mode 100644
index b4dea2e19..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/types/create-extension.type.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { type Express } from 'express'
-import { type ExtensionVersionType } from '../dtos/create-extension.dto'
-
-export type CreateExtensionType = {
- ownerId: string
- name: string
- description?: string
- price?: string
- categoryId?: string
- companyLink?: string
- mainImage?: Express.Multer.File
- additionalImages?: Express.Multer.File[]
- extensionScript?: Express.Multer.File
-}
-
-export type AdditionalExtensionInfo = {
- version: ExtensionVersionType
- additionalImagesToDelete: string[]
-}
diff --git a/backend/apps/cloud/src/marketplace/extensions/types/index.ts b/backend/apps/cloud/src/marketplace/extensions/types/index.ts
deleted file mode 100644
index ec6fa5bdf..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/types/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './create-extension.type'
-export * from './update-extension.type'
diff --git a/backend/apps/cloud/src/marketplace/extensions/types/update-extension.type.ts b/backend/apps/cloud/src/marketplace/extensions/types/update-extension.type.ts
deleted file mode 100644
index 9b1428bba..000000000
--- a/backend/apps/cloud/src/marketplace/extensions/types/update-extension.type.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import {
- AdditionalExtensionInfo,
- CreateExtensionType,
-} from './create-extension.type'
-
-export type UpdateExtensionType = Partial<CreateExtensionType> &
- Partial<AdditionalExtensionInfo>
diff --git a/backend/apps/cloud/src/marketplace/marketplace.module.ts b/backend/apps/cloud/src/marketplace/marketplace.module.ts
deleted file mode 100644
index 24a3e3c90..000000000
--- a/backend/apps/cloud/src/marketplace/marketplace.module.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Module } from '@nestjs/common'
-import { CategoriesModule } from './categories/categories.module'
-import { ExtensionsModule } from './extensions/extensions.module'
-import { CdnModule } from './cdn/cdn.module'
-import { CommentsModule } from './comments/comments.module'
-import { ComplaintsModule } from './complaints/complaints.module'
-
-@Module({
- imports: [
- CategoriesModule,
- ExtensionsModule,
- CdnModule,
- CommentsModule,
- ComplaintsModule,
- ],
-})
-export class MarketplaceModule {}
diff --git a/backend/apps/cloud/src/project/entity/project.entity.ts b/backend/apps/cloud/src/project/entity/project.entity.ts
index dbcf7ee9c..b4db8c223 100644
--- a/backend/apps/cloud/src/project/entity/project.entity.ts
+++ b/backend/apps/cloud/src/project/entity/project.entity.ts
@@ -1,11 +1,4 @@
-import {
- Entity,
- Column,
- PrimaryColumn,
- ManyToOne,
- OneToMany,
- JoinTable,
-} from 'typeorm'
+import { Entity, Column, PrimaryColumn, ManyToOne, OneToMany } from 'typeorm'
import { ApiProperty } from '@nestjs/swagger'
import { Alert } from '../../alert/entity/alert.entity'
@@ -14,7 +7,6 @@ import { FeatureFlag } from '../../feature-flag/entity/feature-flag.entity'
import { Goal } from '../../goal/entity/goal.entity'
import { User } from '../../user/entities/user.entity'
import { ProjectShare } from './project-share.entity'
-import { ExtensionToProject } from '../../marketplace/extensions/entities/extension-to-project.entity'
import { ProjectSubscriber } from './project-subscriber.entity'
import { Funnel } from './funnel.entity'
import { Annotation } from './annotation.entity'
@@ -102,13 +94,6 @@ export class Project {
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
created: Date
- @OneToMany(
- () => ExtensionToProject,
- extensionToProject => extensionToProject.project,
- )
- @JoinTable()
- extensions: ExtensionToProject[]
-
@OneToMany(() => ProjectSubscriber, subscriber => subscriber.project, {
cascade: true,
})
diff --git a/backend/apps/cloud/src/task-manager/task-manager.module.ts b/backend/apps/cloud/src/task-manager/task-manager.module.ts
index 376830b97..5f9824083 100644
--- a/backend/apps/cloud/src/task-manager/task-manager.module.ts
+++ b/backend/apps/cloud/src/task-manager/task-manager.module.ts
@@ -1,7 +1,6 @@
import { Module, forwardRef } from '@nestjs/common'
import { TypeOrmModule } from '@nestjs/typeorm'
import { AlertModule } from '../alert/alert.module'
-import { ExtensionsModule } from '../marketplace/extensions/extensions.module'
import { TelegramService } from '../integrations/telegram/telegram.service'
import { TaskManagerService } from './task-manager.service'
import { MailerModule } from '../mailer/mailer.module'
@@ -25,7 +24,6 @@ import { RevenueModule } from '../revenue/revenue.module'
ActionTokensModule,
AlertModule,
forwardRef(() => AnalyticsModule),
- ExtensionsModule,
AppLoggerModule,
TypeOrmModule.forFeature([Message]),
PayoutsModule,
diff --git a/backend/apps/cloud/src/task-manager/task-manager.service.ts b/backend/apps/cloud/src/task-manager/task-manager.service.ts
index 143543a02..4b370e285 100644
--- a/backend/apps/cloud/src/task-manager/task-manager.service.ts
+++ b/backend/apps/cloud/src/task-manager/task-manager.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common'
import { Cron, CronExpression } from '@nestjs/schedule'
-import { IsNull, LessThan, In, Not, Between, MoreThan, Like } from 'typeorm'
+import { IsNull, LessThan, In, Not, Between } from 'typeorm'
import { ConfigService } from '@nestjs/config'
import Paypal from '@paypal/payouts-sdk'
import dayjs from 'dayjs'
@@ -17,8 +17,6 @@ import _filter from 'lodash/filter'
import { AlertService } from '../alert/alert.service'
import { QueryCondition, QueryMetric, QueryTime } from '../alert/dto/alert.dto'
-import { ExtensionsService } from '../marketplace/extensions/extensions.service'
-import { Extension } from '../marketplace/extensions/entities/extension.entity'
import { ReportFrequency } from '../project/enums'
import { TelegramService } from '../integrations/telegram/telegram.service'
import { MailerService } from '../mailer/mailer.service'
@@ -322,7 +320,6 @@ export class TaskManagerService {
private readonly projectService: ProjectService,
private readonly actionTokensService: ActionTokensService,
private readonly alertService: AlertService,
- private readonly extensionsService: ExtensionsService,
private readonly logger: AppLoggerService,
private readonly telegramService: TelegramService,
private readonly payoutsService: PayoutsService,
@@ -1835,109 +1832,6 @@ export class TaskManagerService {
}
}
- @Cron('0 * * * *')
- async handleNewExtensions() {
- const twoWeeksAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000)
- const newExtensions = await this.extensionsService.find({
- where: {
- createdAt: MoreThan(twoWeeksAgo),
- },
- })
-
- const newExtensionsPromise = _map(newExtensions, async extension => {
- if (!extension.tags.includes('New')) {
- extension.tags.push('New')
- await this.extensionsService.save(extension)
- }
- })
-
- await Promise.allSettled(newExtensionsPromise).catch(reason => {
- this.logger.error(
- `[CRON WORKER](handleNewExtensions) Error occured: ${reason}`,
- )
- })
-
- const oldExtensions = await this.extensionsService.find({
- where: {
- createdAt: LessThan(twoWeeksAgo),
- tags: Like('%New%'),
- },
- })
-
- const oldExtensionsPromise = _map(oldExtensions, async extension => {
- extension.tags = extension.tags.filter(tag => tag !== 'New')
- await this.extensionsService.save(extension)
- })
-
- await Promise.allSettled(oldExtensionsPromise).catch(reason => {
- this.logger.error(
- `[CRON WORKER](handleNewExtensions) Error occured: ${reason}`,
- )
- })
- }
-
- @Cron('0 * * * *')
- async handleTrendingExtensions() {
- const twoWeeksAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000)
- const extensions = await this.extensionsService.find({
- where: {
- createdAt: MoreThan(twoWeeksAgo),
- },
- })
-
- const promises = _map(extensions, async extension => {
- const currentInstalls =
- await this.extensionsService.getExtensionInstallCount(extension.id)
- const twoWeeksBeforeInstalls =
- await this.extensionsService.getExtensionInstallCount(
- extension.id,
- twoWeeksAgo,
- )
-
- if (
- currentInstalls > twoWeeksBeforeInstalls * 2 &&
- currentInstalls > 0.9 * (await this.getAverageInstalls(extensions))
- ) {
- if (!extension.tags.includes('Trending')) {
- extension.tags.push('Trending')
- await this.extensionsService.save(extension)
- }
- } else if (extension.tags.includes('Trending')) {
- extension.tags = extension.tags.filter(tag => tag !== 'Trending')
- await this.extensionsService.save(extension)
- }
- })
-
- await Promise.allSettled(promises).catch(reason => {
- this.logger.error(
- `[CRON WORKER](handleTrendingExtensions) Error occured: ${reason}`,
- )
- })
- }
-
- private async getAverageInstalls(
- extensions: Extension[],
- twoWeeksAgo?: Date,
- ) {
- let totalInstalls = 0
-
- const promises = _map(extensions, async extension => {
- totalInstalls += await this.extensionsService.getExtensionInstallCount(
- extension.id,
- twoWeeksAgo,
- )
- })
-
- await Promise.allSettled(promises).catch(reason => {
- this.logger.error(
- `[CRON WORKER](getAverageInstalls) Error occured: ${reason}`,
- )
- return 0
- })
-
- return totalInstalls / extensions.length
- }
-
@Cron(CronExpression.EVERY_5_SECONDS)
async sendTelegramMessages() {
try {
diff --git a/backend/apps/cloud/src/user/entities/user.entity.ts b/backend/apps/cloud/src/user/entities/user.entity.ts
index 684402676..236af5b1a 100644
--- a/backend/apps/cloud/src/user/entities/user.entity.ts
+++ b/backend/apps/cloud/src/user/entities/user.entity.ts
@@ -9,12 +9,7 @@ import {
import { ActionToken } from '../../action-tokens/action-token.entity'
import { Project } from '../../project/entity/project.entity'
import { ProjectShare } from '../../project/entity/project-share.entity'
-import { Extension } from '../../marketplace/extensions/entities/extension.entity'
-import { ExtensionToUser } from '../../marketplace/extensions/entities/extension-to-user.entity'
import { Payout } from '../../payouts/entities/payouts.entity'
-import { Comment } from '../../marketplace/comments/entities/comment.entity'
-import { CommentReply } from '../../marketplace/comments/entities/comment-reply.entity'
-import { Complaint } from '../../marketplace/complaints/entities/complaint.entity'
import { RefreshToken } from './refresh-token.entity'
import { OrganisationMember } from '../../organisation/entity/organisation-member.entity'
@@ -352,9 +347,6 @@ export class User {
@OneToMany(() => ActionToken, actionToken => actionToken.user)
actionTokens: ActionToken[]
- @OneToMany(() => Extension, extension => extension.owner)
- ownedExtensions: Extension[]
-
@Column({
type: 'enum',
enum: BillingFrequency,
@@ -448,22 +440,6 @@ export class User {
@Column({ default: false })
registeredWithGithub: boolean
- @OneToMany(() => ExtensionToUser, extensionToUser => extensionToUser.user)
- @JoinTable()
- extensions: ExtensionToUser[]
-
- @OneToMany(() => Comment, comment => comment.user)
- @JoinTable()
- comments: Comment[]
-
- @OneToMany(() => CommentReply, comment => comment.user)
- @JoinTable()
- commentReplies: CommentReply[]
-
- @OneToMany(() => Complaint, complaint => complaint.user)
- @JoinTable()
- complaints: Complaint[]
-
@OneToMany(() => RefreshToken, refreshToken => refreshToken.user)
@JoinTable()
refreshTokens: RefreshToken[]
diff --git a/backend/migrations/mysql/2025_12_21_remove_extensions.sql b/backend/migrations/mysql/2025_12_21_remove_extensions.sql
new file mode 100644
index 000000000..49c4356ac
--- /dev/null
+++ b/backend/migrations/mysql/2025_12_21_remove_extensions.sql
@@ -0,0 +1,8 @@
+DROP TABLE IF EXISTS extension_categories_category;
+DROP TABLE IF EXISTS extension_to_project;
+DROP TABLE IF EXISTS extension_to_user;
+DROP TABLE IF EXISTS comment_reply;
+DROP TABLE IF EXISTS complaint;
+DROP TABLE IF EXISTS comment;
+DROP TABLE IF EXISTS extension;
+DROP TABLE IF EXISTS category;
diff --git a/web/app/api/index.ts b/web/app/api/index.ts
index 2997cb960..b8089e96c 100644
--- a/web/app/api/index.ts
+++ b/web/app/api/index.ts
@@ -14,7 +14,6 @@ import {
Overall,
LiveStats,
Funnel,
- Extension,
SwetrixError,
SwetrixErrorDetails,
SessionDetails,
@@ -1142,21 +1141,6 @@ export const deleteApiKey = () =>
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getInstalledExtensions = (limit = 100, offset = 0, config?: AxiosRequestConfig) =>
- api
- .get(`/extensions/installed?limit=${limit}&offset=${offset}`, config)
- .then(
- (
- response,
- ): {
- count: number
- extensions: Extension[]
- } => response.data,
- )
- .catch((error) => {
- throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
- })
-
export interface GetLiveVisitorsInfo {
psid: string
dv: string
diff --git a/web/app/components/marketing/ComparisonTable.tsx b/web/app/components/marketing/ComparisonTable.tsx
index 19669063d..02d16db00 100644
--- a/web/app/components/marketing/ComparisonTable.tsx
+++ b/web/app/components/marketing/ComparisonTable.tsx
@@ -15,7 +15,6 @@ const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
'main.competitiveFeatures.usfl': true, // User Flow
'main.competitiveFeatures.funnels': true, // Funnels
'main.competitiveFeatures.sessionAnalysis': true, // Session analysis
- 'main.competitiveFeatures.ext': true, // Custom extensions
'main.competitiveFeatures.alrt': true, // Custom alerts
'main.competitiveFeatures.pbld': true, // Public dashboards
'main.competitiveFeatures.shad': true, // Dashboard sharing
@@ -30,7 +29,6 @@ const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
'main.competitiveFeatures.usfl': true,
'main.competitiveFeatures.funnels': true,
'main.competitiveFeatures.sessionAnalysis': false,
- 'main.competitiveFeatures.ext': false,
'main.competitiveFeatures.alrt': false,
'main.competitiveFeatures.pbld': false,
'main.competitiveFeatures.shad': false,
@@ -45,7 +43,6 @@ const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
'main.competitiveFeatures.usfl': false,
'main.competitiveFeatures.funnels': false,
'main.competitiveFeatures.sessionAnalysis': false,
- 'main.competitiveFeatures.ext': false,
'main.competitiveFeatures.alrt': true,
'main.competitiveFeatures.pbld': true,
'main.competitiveFeatures.shad': true,
@@ -60,7 +57,6 @@ const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
'main.competitiveFeatures.usfl': false,
'main.competitiveFeatures.funnels': true,
'main.competitiveFeatures.sessionAnalysis': false,
- 'main.competitiveFeatures.ext': false,
'main.competitiveFeatures.alrt': false,
'main.competitiveFeatures.pbld': true,
'main.competitiveFeatures.shad': true,
@@ -75,7 +71,6 @@ const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
'main.competitiveFeatures.usfl': false,
'main.competitiveFeatures.funnels': false,
'main.competitiveFeatures.sessionAnalysis': false,
- 'main.competitiveFeatures.ext': false,
'main.competitiveFeatures.alrt': false,
'main.competitiveFeatures.pbld': true,
'main.competitiveFeatures.shad': false,
diff --git a/web/app/lib/models/Project.ts b/web/app/lib/models/Project.ts
index caf00afca..ff4a466a9 100644
--- a/web/app/lib/models/Project.ts
+++ b/web/app/lib/models/Project.ts
@@ -211,27 +211,3 @@ export interface Project {
isPinned?: boolean
revenueCurrency?: string
}
-
-export interface Extension {
- id: string
- name: string
- description: string
- version: string
- status: string
- price: number
- mainImage: string
- additionalImages: string[]
- fileURL: string
- companyLink: string | null
- createdAt: string
- updatedAt: string
- tags: string[]
- owner: {
- nickname: string
- }
- category: {
- id: number
- name: string
- }
- usersQuantity: number
-}
diff --git a/web/app/providers/CurrentProjectProvider.tsx b/web/app/providers/CurrentProjectProvider.tsx
index c07c0f451..09d8ad1b3 100644
--- a/web/app/providers/CurrentProjectProvider.tsx
+++ b/web/app/providers/CurrentProjectProvider.tsx
@@ -4,15 +4,9 @@ import { useTranslation } from 'react-i18next'
import { useNavigate, useSearchParams } from 'react-router'
import { toast } from 'sonner'
-import { checkPassword, getInstalledExtensions, getLiveVisitors, getProject } from '~/api'
-import {
- isSelfhosted,
- LIVE_VISITORS_UPDATE_INTERVAL,
- LS_PROJECTS_PROTECTED_KEY,
- Period,
- TimeBucket,
-} from '~/lib/constants'
-import { Extension, type Project } from '~/lib/models/Project'
+import { checkPassword, getLiveVisitors, getProject } from '~/api'
+import { LIVE_VISITORS_UPDATE_INTERVAL, LS_PROJECTS_PROTECTED_KEY, Period, TimeBucket } from '~/lib/constants'
+import { type Project } from '~/lib/models/Project'
import { getItemJSON, removeItem } from '~/utils/localstorage'
import routes from '~/utils/routes'
@@ -25,7 +19,6 @@ interface CurrentProjectContextType {
id: string
project: Project | null
preferences: ProjectPreferences
- extensions: Extension[]
allowedToManage: boolean
updatePreferences: (prefs: ProjectPreferences) => void
mergeProject: (project: Partial<Project>) => void
@@ -225,29 +218,9 @@ const useLiveVisitors = (project: Project | null) => {
export const CurrentProjectProvider = ({ children, id }: CurrentProjectProviderProps) => {
const { project, mergeProject, isPasswordRequired, submitPassword } = useProject(id)
- const { isAuthenticated } = useAuth()
const { preferences, updatePreferences } = useProjectPreferences(id)
- const [extensions, setExtensions] = useState<Extension[]>([])
const { liveVisitors, updateLiveVisitors } = useLiveVisitors(project)
- useEffect(() => {
- if (!project || isSelfhosted || !isAuthenticated) {
- return
- }
-
- const abortController = new AbortController()
-
- getInstalledExtensions(100, 0, { signal: abortController.signal })
- .then(({ extensions }) => {
- setExtensions(extensions)
- })
- .catch((reason) => {
- console.error('[ERROR] (CurrentProjectProvider -> getInstalledExtensions)', reason)
- })
-
- return () => abortController.abort()
- }, [project, isAuthenticated])
-
return (
<CurrentProjectContext.Provider
value={{
@@ -255,7 +228,6 @@ export const CurrentProjectProvider = ({ children, id }: CurrentProjectProviderP
project,
preferences,
updatePreferences,
- extensions,
mergeProject,
allowedToManage: project?.role === 'owner' || project?.role === 'admin',
liveVisitors,
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 60af7278a..4317e47cc 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -536,7 +536,6 @@
"whyUseSwetrix": "Why use <swetrix>Swetrix</swetrix> if there is <competitor></competitor>?",
"competitiveFeatures": {
"perf": "Performance monitoring",
- "ext": "Custom extensions",
"gdpr": "GDPR-compatible",
"usfl": "User flow",
"funnels": "Funnels",