Skip to content

Commit

Permalink
feat!: deprecate get tags (#968)
Browse files Browse the repository at this point in the history
* refactor: deprecate get tags

* feat: remove use tags hooks
  • Loading branch information
pyphilia authored Oct 23, 2024
1 parent 0f8a1ca commit 3da2541
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 253 deletions.
29 changes: 2 additions & 27 deletions src/api/itemTag.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
import { ItemTag, ItemTagType, ResultOf, UUID } from '@graasp/sdk';
import { ItemTag, ItemTagType, UUID } from '@graasp/sdk';

import {
GET_TAGS_ROUTE,
buildDeleteItemTagRoute,
buildGetItemTagsRoute,
buildGetItemsTagsRoute,
buildPostItemTagRoute,
} from '../routes.js';
import { buildDeleteItemTagRoute, buildPostItemTagRoute } from '../routes.js';
import { PartialQueryConfigForApi } from '../types.js';
import { verifyAuthentication } from './axios.js';

export const getTags = async ({ API_HOST, axios }: PartialQueryConfigForApi) =>
axios.get(`${API_HOST}/${GET_TAGS_ROUTE}`).then(({ data }) => data);

export const getItemTags = async (
id: UUID,
{ API_HOST, axios }: PartialQueryConfigForApi,
) =>
axios
.get<ItemTag[]>(`${API_HOST}/${buildGetItemTagsRoute(id)}`)
.then(({ data }) => data);

export const getItemsTags = async (
ids: UUID[],
{ API_HOST, axios }: PartialQueryConfigForApi,
) =>
axios
.get<ResultOf<ItemTag[]>>(`${API_HOST}/${buildGetItemsTagsRoute(ids)}`)
.then(({ data }) => data);

// payload: tagId, itemPath, creator
export const postItemTag = async (
{ itemId, type }: { itemId: UUID; type: ItemTagType },
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import configureItemGeolocationHooks from './itemGeolocation.js';
import configureItemLikeHooks from './itemLike.js';
import configureItemLoginHooks from './itemLogin.js';
import configureItemPublishedHooks from './itemPublish.js';
import configureItemTagHooks from './itemTag.js';
import configureItemValidationHooks from './itemValidation.js';
import configureMembershipHooks from './membership.js';
import configureMentionsHooks from './mention.js';
Expand All @@ -45,7 +44,6 @@ export default (
...configureMembershipHooks(queryConfig, websocketClient),
...configureItemHooks(queryConfig, websocketClient),
...configureEtherpadHooks(queryConfig),
...configureItemTagHooks(queryConfig),
...configureCategoryHooks(queryConfig),
...configureKeywordSearchHooks(queryConfig),
...configureItemLikeHooks(queryConfig),
Expand Down
173 changes: 0 additions & 173 deletions src/hooks/itemTag.test.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/hooks/itemTag.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ export const SIGN_IN_ROUTE = '/login';
export const SIGN_IN_WITH_PASSWORD_ROUTE = '/login-password';
export const SIGN_UP_ROUTE = '/register';
export const SIGN_OUT_ROUTE = '/logout';
export const buildGetItemTagsRoute = (id: UUID) => `${ITEMS_ROUTE}/${id}/tags`;
export const buildGetItemsTagsRoute = (ids: UUID[]) =>
`${ITEMS_ROUTE}/tags?${new URLSearchParams(ids.map((id) => ['id', id]))}`;
export const buildPostItemTagRoute = ({
itemId,
type,
Expand Down Expand Up @@ -395,7 +392,6 @@ export const API_ROUTES = {
buildGetItemMembershipsForItemsRoute,
buildGetItemPublishedInformationRoute,
buildGetItemsInCategoryRoute,
buildGetItemTagsRoute,
buildGetLastItemValidationGroupRoute,
buildGetLikesForMemberRoute,
buildGetMostLikedPublishedItemsRoute,
Expand Down

0 comments on commit 3da2541

Please sign in to comment.