Backfill package json for custom and standard app (#17681)
# Backfill application package files for custom and standard apps - Backfill `package.json` / `yarn.lock` (and related fields) for existing workspaces; new standard/custom apps get default dependency files. - Default package files under `application/constants/default-package-files/`; util with hardcoded checksums (comment on how to regenerate). - New **FileFolder.Dependencies** for app dependency files; **writeFile_v2** accepts optional `queryRunner` for transactional writes. Usages: - **Upgrade command** `upgrade:1-17:backfill-application-package-files`: standard/custom apps → default files; other apps → from logic function layer. - **Workspace creation**: create workspace with `workspaceCustomApplicationId` first, then create application (enables same-transaction insert). Migration makes workspace/application/file FKs deferrable. - dev seeder
This commit is contained in:
@@ -465,26 +465,19 @@ export class SignInUpService {
|
||||
isWorkEmailFound && (await isLogoUrlValid()) ? logoUrl : undefined;
|
||||
|
||||
const workspaceId = v4();
|
||||
const workspaceCustomApplicationId = v4();
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
try {
|
||||
const workspaceCustomApplication =
|
||||
await this.applicationService.createWorkspaceCustomApplication(
|
||||
{
|
||||
workspaceId,
|
||||
},
|
||||
queryRunner,
|
||||
);
|
||||
|
||||
const workspaceToCreate = this.workspaceRepository.create({
|
||||
id: workspaceId,
|
||||
subdomain: await this.subdomainManagerService.generateSubdomain(
|
||||
isWorkEmailFound ? { userEmail: email } : {},
|
||||
),
|
||||
workspaceCustomApplicationId: workspaceCustomApplication.id,
|
||||
workspaceCustomApplicationId,
|
||||
displayName: '',
|
||||
inviteHash: v4(),
|
||||
activationStatus: WorkspaceActivationStatus.PENDING_CREATION,
|
||||
@@ -496,6 +489,14 @@ export class SignInUpService {
|
||||
workspaceToCreate,
|
||||
);
|
||||
|
||||
await this.applicationService.createWorkspaceCustomApplication(
|
||||
{
|
||||
workspaceId,
|
||||
applicationId: workspaceCustomApplicationId,
|
||||
},
|
||||
queryRunner,
|
||||
);
|
||||
|
||||
const isExistingUser = userData.type === 'existingUser';
|
||||
const user = isExistingUser
|
||||
? userData.existingUser
|
||||
|
||||
Reference in New Issue
Block a user