Skip to content

Commit

Permalink
fix: fix item tag and item category types
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Jan 20, 2023
1 parent 2ce1b10 commit 81f39b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
12 changes: 8 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export type QueryClientConfig = {
// time before cache labeled as inactive to be garbage collected
cacheTime: number;
retry?:
| number
| boolean
| ((failureCount: number, error: Error) => boolean);
| number
| boolean
| ((failureCount: number, error: Error) => boolean);
refetchOnWindowFocus?: boolean;
keepPreviousData?: boolean;
refetchOnMount?: boolean;
Expand All @@ -58,8 +58,10 @@ export type ItemMembershipRecord = RecordOf<ItemMembership>;

export type ItemTag = {
id: UUID;
path: string;
itemPath: string;
tagId: UUID;
createdAt: string;
creator: string;
};

export type ItemTagRecord = RecordOf<ItemTag>;
Expand All @@ -83,6 +85,8 @@ export type ItemCategory = {
id: UUID;
itemId: UUID;
categoryId: UUID;
createdAt: string;
creator: string;
};

export type ItemCategoryRecord = RecordOf<ItemCategory>;
Expand Down
16 changes: 10 additions & 6 deletions test/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import {
MessageItemChatRecord,
Status,
StatusRecord,
Tag,
Tag as TagType,
TagRecord,
UUID,
} from '../src/types';
Expand Down Expand Up @@ -445,11 +445,11 @@ const FLAG_2: FlagRecord = createMockFlags({

export const FLAGS: List<FlagRecord> = List([FLAG_1, FLAG_2]);

const defaultTagsValues: Tag = {
const defaultTagsValues: TagType = {
id: 'item-login-tag-id',
name: 'item-login',
};
const createMockTags: Record.Factory<Tag> = Record(defaultTagsValues);
const createMockTags: Record.Factory<TagType> = Record(defaultTagsValues);

const TAG_1: TagRecord = createMockTags({
id: 'item-login-tag-id',
Expand All @@ -465,22 +465,24 @@ export const TAGS: List<TagRecord> = List([TAG_1, TAG_2]);

const defaultItemTagsValues: ItemTag = {
id: 'tag-id',
path: 'somepath',
itemPath: 'somepath',
tagId: 'tag-id',
createdAt: 'createdAt',
creator: 'creator-id'
};
const createMockItemTags: Record.Factory<ItemTag> = Record(
defaultItemTagsValues,
);

const ITEM_TAG_1: ItemTagRecord = createMockItemTags({
id: 'tag-id',
path: 'somepath',
itemPath: 'somepath',
tagId: 'tag-id',
});

const ITEM_TAG_2: ItemTagRecord = createMockItemTags({
id: 'tag-id1',
path: 'somepath1',
itemPath: 'somepath1',
tagId: 'tag-id1',
});

Expand Down Expand Up @@ -559,6 +561,8 @@ const defaultItemCategoryValues: ItemCategory = {
id: 'id1',
itemId: 'item-id',
categoryId: 'category-id1',
createdAt: 'somedate',
creator: 'creator-id'
};
const createMockItemCategory: Record.Factory<ItemCategory> = Record(
defaultItemCategoryValues,
Expand Down

0 comments on commit 81f39b9

Please sign in to comment.