diff --git a/server/src/@types/db-types.d.ts b/server/src/@types/db-types.d.ts index a92bd813..961b45ce 100644 --- a/server/src/@types/db-types.d.ts +++ b/server/src/@types/db-types.d.ts @@ -251,6 +251,7 @@ interface DbAddon { user_id: string, resource_id: string, type: addon_t, + display_name: string, description: string, author: string, tags: string[], diff --git a/server/src/@types/types.d.ts b/server/src/@types/types.d.ts index 10b3c34f..de7d6088 100644 --- a/server/src/@types/types.d.ts +++ b/server/src/@types/types.d.ts @@ -152,6 +152,7 @@ interface Addon { userId: string, resourceId: string, type: AddonType, + displayName: string, description: string, author: string, tags: string[], diff --git a/server/src/controllers/analytics-controller.ts b/server/src/controllers/analytics-controller.ts index e1034f60..4e99b844 100644 --- a/server/src/controllers/analytics-controller.ts +++ b/server/src/controllers/analytics-controller.ts @@ -186,6 +186,7 @@ export class AnalyticsController extends Controller { this.mixpanel.track('viewed profile', { distinct_id: profile.userId, profile: profile.id, + handle: profile.handle }); } else { await this.analyticsService.createAnonymousVisit("page"); @@ -194,6 +195,7 @@ export class AnalyticsController extends Controller { this.mixpanel.track('viewed profile', { distinct_id: Constants.ANONYMOUS_USER_ID, profile: profile.id, + handle: profile.handle }); } diff --git a/server/src/controllers/marketplace-controller.ts b/server/src/controllers/marketplace-controller.ts index 533aaabb..d923fa74 100644 --- a/server/src/controllers/marketplace-controller.ts +++ b/server/src/controllers/marketplace-controller.ts @@ -199,6 +199,8 @@ export class MarketplaceController extends Controller { if (this.mixpanel) this.mixpanel.track('addon viewed', { distinct_id: request.body.authUser.id, + addon: addon.id, + name: addon.displayName ?? undefined }); if (request.body.detailed) diff --git a/server/src/services/marketplace-service.ts b/server/src/services/marketplace-service.ts index 3b49f7a2..fdb71f03 100644 --- a/server/src/services/marketplace-service.ts +++ b/server/src/services/marketplace-service.ts @@ -89,9 +89,10 @@ export class MarketplaceService extends DatabaseService { */ async createAddon(addon: Partial): Promise { //language=PostgreSQL - let queryStr = `insert into marketplace.addons(user_id, resource_id, type, description, author, tags, price, + let queryStr = `insert into marketplace.addons(user_id, resource_id, type, display_name, description, author, tags, + price, payment_frequency, global, version, last_updated) - values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, current_timestamp) + values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, current_timestamp) returning *`; if (!addon.global) { @@ -103,6 +104,7 @@ export class MarketplaceService extends DatabaseService { addon.userId, addon.resourceId, addon.type, + addon.displayName, addon.description, addon.author, addon.tags, @@ -126,14 +128,15 @@ export class MarketplaceService extends DatabaseService { let queryStr = `update marketplace.addons set resource_id=coalesce($2, resource_id), type=coalesce($3, type), - description=$4, - author=$5, - tags=$6, - featured_sorting=coalesce($7, featured_sorting), - price=$8, - payment_frequency=$9, - global=coalesce($10, global), - version=$11, + display_name=$4, + description=$5, + author=$6, + tags=$7, + featured_sorting=coalesce($8, featured_sorting), + price=$9, + payment_frequency=$10, + global=coalesce($11, global), + version=$12, last_updated=current_timestamp where id = $1 returning *`; @@ -143,6 +146,7 @@ export class MarketplaceService extends DatabaseService { addon.id, addon.resourceId, addon.type, + addon.displayName, addon.description, addon.author, addon.tags, diff --git a/server/src/sql/setup-marketplace.sql b/server/src/sql/setup-marketplace.sql index 6a5ff6e0..c29ce187 100644 --- a/server/src/sql/setup-marketplace.sql +++ b/server/src/sql/setup-marketplace.sql @@ -13,6 +13,7 @@ create table if not exists marketplace.addons user_id bigint references app.users (id) on update cascade on delete no action, resource_id bigint unique not null, -- The id of the resource this addon is related to type addon_t not null, -- The type of resource this is + display_name text, -- The name of this resource description text, author text, tags text[], @@ -26,6 +27,7 @@ create table if not exists marketplace.addons ); create index if not exists addons_type on marketplace.addons (type); +create index if not exists addons_display_name on marketplace.addons (display_name); create index if not exists addons_description on marketplace.addons (description); create index if not exists addons_author on marketplace.addons (author); create index if not exists addons_tags on marketplace.addons (tags); diff --git a/server/src/utils/db-type-converter.ts b/server/src/utils/db-type-converter.ts index b37bece8..88b85f7b 100644 --- a/server/src/utils/db-type-converter.ts +++ b/server/src/utils/db-type-converter.ts @@ -135,6 +135,7 @@ export class DbTypeConverter { userId: addon.user_id, resourceId: addon.resource_id, type: addon.type, + displayName: addon.display_name, description: addon.description, author: addon.author, tags: addon.tags,