Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions backend/src/database/repositories/tenantRepository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import lodash from 'lodash'
import moment from 'moment'
import Sequelize, { QueryTypes } from 'sequelize'
import { getCleanString } from '@crowd/common'
import { Edition } from '@crowd/types'
Expand Down Expand Up @@ -63,10 +62,6 @@ class TenantRepository {
throw new Error400(options.language, 'tenant.url.exists')
}

const trialEndsAt = moment().add(14, 'days').isAfter('2023-01-15')
? moment().add(14, 'days').toISOString()
: '2023-01-15'

const record = await options.database.tenant.create(
{
...lodash.pick(data, [
Expand All @@ -78,9 +73,7 @@ class TenantRepository {
'integrationsRequired',
'importHash',
]),
plan: API_CONFIG.edition === Edition.LFX ? Plans.values.enterprise : Plans.values.growth,
isTrialPlan: API_CONFIG.edition !== Edition.LFX,
trialEndsAt: API_CONFIG.edition !== Edition.LFX ? trialEndsAt : null,
plan: API_CONFIG.edition === Edition.LFX ? Plans.values.enterprise : Plans.values.essential,
createdById: currentUser.id,
updatedById: currentUser.id,
},
Expand Down
7 changes: 3 additions & 4 deletions backend/src/services/__tests__/tenantService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,14 @@ describe('TenantService tests', () => {

tenantCreatedPlain.createdAt = tenantCreatedPlain.createdAt.toISOString().split('T')[0]
tenantCreatedPlain.updatedAt = tenantCreatedPlain.updatedAt.toISOString().split('T')[0]
tenantCreatedPlain.trialEndsAt = tenantCreatedPlain.trialEndsAt.toISOString().split('T')[0]

const tenantExpected = {
id: tenantCreatedPlain.id,
name: 'testName',
url: 'testUrl',
plan: Plans.values.growth,
isTrialPlan: true,
trialEndsAt: moment().add(14, 'days').toISOString().split('T')[0],
plan: Plans.values.essential,
isTrialPlan: false,
trialEndsAt: null,
onboardedAt: null,
integrationsRequired: ['github', 'discord'],
hasSampleData: false,
Expand Down