Skip to content

Commit

Permalink
fixx more imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcasey committed Feb 24, 2025
1 parent ad42103 commit da21833
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { BlockWithDetails } from 'lib/databases/block';
import type { BoardFields, IPropertyTemplate } from 'lib/databases/board';
import { createMissingCards } from 'lib/databases/proposalsSource/createMissingCards';
import { getCardPropertyTemplates } from 'lib/databases/proposalsSource/getCardProperties';
import { updateBoardProperties } from 'lib/databases/proposalsSource/updateBoardProperties';

let adminSpace: Space;

Expand Down Expand Up @@ -562,7 +563,10 @@ describe('GET /api/blocks/[id]/subtree - proposal databases', () => {
createdBy: admin.id,
spaceId: space.id,
viewDataSource: 'proposals',
cardCount: 0,
cardCount: 0
});
await updateBoardProperties({
boardId: proposalsDatabase.id,
selectedProperties: {
defaults: ['proposalStep', 'proposalEvaluationType'],
customProperties: [],
Expand Down
16 changes: 9 additions & 7 deletions packages/testing/src/generateBoardStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { typedKeys } from '@packages/utils/types';
import type { BoardFields, DataSourceType, IPropertyOption, IPropertyTemplate } from '@root/lib/databases/board';
import type { BoardViewFields, IViewType } from '@root/lib/databases/boardView';
import type { CardFields } from '@root/lib/databases/card';
import { Constants } from '@root/lib/databases/constants';
// import { Constants } from '@root/lib/databases/constants';
import type { RelatedPageData } from '@root/lib/templates/exportWorkspacePages';
import { v4 } from 'uuid';

import { pageContentStub } from './generatePageStub';

const titleColumnId = '__title';

export type CustomBoardProps = {
propertyTemplates: (Omit<IPropertyTemplate, 'options'> & { options?: IPropertyOption[] | undefined })[];
cardPropertyValues: Record<string, any> | Record<string, any>[];
Expand Down Expand Up @@ -94,8 +96,8 @@ export function boardWithCardsArgs({
updatedBy: createdBy,
title:
(Array.isArray(customProps?.cardPropertyValues)
? customProps?.cardPropertyValues[0]?.[Constants.titleColumnId]
: customProps?.cardPropertyValues?.[Constants.titleColumnId]) ?? 'Beer to Web3',
? customProps?.cardPropertyValues[0]?.[titleColumnId]
: customProps?.cardPropertyValues?.[titleColumnId]) ?? 'Beer to Web3',
content: {
type: 'doc',
content: [
Expand Down Expand Up @@ -158,8 +160,8 @@ export function boardWithCardsArgs({
updatedBy: createdBy,
title:
(Array.isArray(customProps?.cardPropertyValues)
? customProps?.cardPropertyValues[1]?.[Constants.titleColumnId]
: customProps?.cardPropertyValues?.[Constants.titleColumnId]) ?? 'How to web3 in Uni?',
? customProps?.cardPropertyValues[1]?.[titleColumnId]
: customProps?.cardPropertyValues?.[titleColumnId]) ?? 'How to web3 in Uni?',
content: {
type: 'doc',
content: [
Expand Down Expand Up @@ -292,8 +294,8 @@ export function boardWithCardsArgs({
for (let i = 2; i < cardCount; i++) {
const title =
(Array.isArray(customProps?.cardPropertyValues)
? customProps?.cardPropertyValues[i]?.[Constants.titleColumnId]
: customProps?.cardPropertyValues?.[Constants.titleColumnId]) ?? cardPages[i % 2 === 0 ? 0 : 1].title;
? customProps?.cardPropertyValues[i]?.[titleColumnId]
: customProps?.cardPropertyValues?.[titleColumnId]) ?? cardPages[i % 2 === 0 ? 0 : 1].title;

if (i % 2 === 0) {
cardPages.push({ ...cardPages[0], createdAt: new Date().toISOString(), id: cardIds[i] || v4(), title });
Expand Down
12 changes: 1 addition & 11 deletions packages/testing/src/setupDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { uid } from '@packages/utils/strings';
import { typedKeys } from '@packages/utils/types';
import type { DataSourceType } from '@root/lib/databases/board';
import type { IViewType } from '@root/lib/databases/boardView';
import { updateBoardProperties } from '@root/lib/databases/proposalsSource/updateBoardProperties';
import type { NotificationToggles } from '@root/lib/notifications/notificationToggles';
import type { TargetPermissionGroup, AssignablePermissionGroupsWithPublic } from '@root/lib/permissions/interfaces';
import type { ProposalWithUsersAndRubric } from '@root/lib/proposals/interfaces';
Expand Down Expand Up @@ -1073,10 +1072,8 @@ export async function generateBoard({
linkedSourceId,
customProps,
deletedAt,
permissions,
selectedProperties
permissions
}: {
selectedProperties?: SelectedProposalProperties;
createdBy: string;
spaceId: string;
cardCount?: number;
Expand Down Expand Up @@ -1157,13 +1154,6 @@ export async function generateBoard({
permissionsToCreate
]).then((result) => result.filter((r) => (r as Page).boardId)[0] as Page);

if (selectedProperties) {
await updateBoardProperties({
boardId: createdBoard.id,
selectedProperties
});
}

return createdBoard;
}

Expand Down

0 comments on commit da21833

Please sign in to comment.