diff --git a/projects/bp-gallery/package.json b/projects/bp-gallery/package.json index cf07f8271..0f02a7dee 100755 --- a/projects/bp-gallery/package.json +++ b/projects/bp-gallery/package.json @@ -45,6 +45,7 @@ "react-device-detect": "^2.2.2", "react-dom": "^18.2.0", "react-dropzone": "^12.0.5", + "react-grid-gallery": "^1.0.0", "react-html-parser": "^2.0.2", "react-i18next": "^11.13.0", "react-leaflet": "^4.2.1", diff --git a/projects/bp-gallery/src/components/App.tsx b/projects/bp-gallery/src/components/App.tsx index b52a01d8f..c1157edfc 100644 --- a/projects/bp-gallery/src/components/App.tsx +++ b/projects/bp-gallery/src/components/App.tsx @@ -32,7 +32,6 @@ const apolloClient = new ApolloClient({ 'Exhibition', 'ExhibitionPicture', 'ExhibitionSection', - 'ExhibitionSource', 'FaceTag', 'KeywordTag', 'Link', diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionOverview.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionOverview.tsx index c3c35ef98..5d0e4c5bf 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionOverview.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionOverview.tsx @@ -1,7 +1,7 @@ -import { Delete } from '@mui/icons-material'; +import { ArrowForwardIos, Delete } from '@mui/icons-material'; import { Box, Button, Card, CardContent, CardMedia, IconButton, Modal } from '@mui/material'; import { t } from 'i18next'; -import { Dispatch, SetStateAction, useContext, useEffect, useState } from 'react'; +import { Dispatch, SetStateAction, useContext, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useCanRunCreateExhibitionMutation, @@ -13,7 +13,6 @@ import { useSimplifiedQueryResponseData } from '../../../graphql/queryUtils'; import { asUploadPath } from '../../../helpers/app-helpers'; import { useVisit } from '../../../helpers/history'; import { useCanEditMultipleExhibitions } from '../../../hooks/can-do-hooks'; -import { useAuth } from '../../../hooks/context-hooks'; import { FlatExhibition } from '../../../types/additionalFlatTypes'; import RichText from '../../common/RichText'; import { MobileContext } from '../../provider/MobileProvider'; @@ -85,30 +84,35 @@ const ExhibitionBigCard = ({ const { t } = useTranslation(); const { visit } = useVisit(); return ( -
- exhibition picture +
!canEdit && visit(link)} + > +
+ exhibition picture +
{exhibitionTitle}
+ {canEdit && ( +
+ -
- - {canEdit && ( - )} -
+
+ )}
{canEdit && (
@@ -247,27 +251,9 @@ const ExhibitionOverview = ({ }); const exhibitions: FlatExhibition[] | undefined = useSimplifiedQueryResponseData(exhibitionsData)?.exhibitions; - const { userId } = useAuth(); const { visit } = useVisit(); const { t } = useTranslation(); const { isMobile } = useContext(MobileContext); - const [showMore, setShowMore] = useState(false); - const isOverflow = (node: HTMLDivElement | null) => { - if (!node) return false; - return node.offsetWidth < node.scrollWidth; - }; - - const [exhibitionsContainer, setExhibitionsContainer] = useState(null); - useEffect(() => { - if (!exhibitionsContainer) { - return; - } - setShowMore(isOverflow(exhibitionsContainer) && (exhibitions?.length ?? 0) > 1); - }, [ - exhibitionsContainer, - exhibitions, - /* content of exhibitionsContainer changes depending on permissions of user */ userId, - ]); const [createExhibition] = useCreateExhibitionMutation(); const { canRun: canCreateExhibition } = useCanRunCreateExhibitionMutation({ @@ -298,12 +284,9 @@ const ExhibitionOverview = ({ {showTitle && (filteredExhibitions?.length ?? 0) > 0 && (

{t('exhibition.overview.our-exhibitions')}

)} -
+
-
+
{filteredExhibitions?.map(([exhibition, canEdit], index) => ( ))}
- {showMore && !isMobile && ( -
- )}
- {showMore ? ( -
- + {canCreateExhibition && archiveId && !isMobile && ( + - {canCreateExhibition && archiveId && !isMobile && ( - - )} -
- ) : ( -
- {canCreateExhibition && archiveId && ( - - )} -
- )} + )} +
)} diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx index 9937d5b05..09fb5bfe4 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionTool.tsx @@ -3,11 +3,14 @@ import { DragEndEvent, DragOverlay, DragStartEvent, + DraggableAttributes, UniqueIdentifier, + closestCenter, useDroppable, } from '@dnd-kit/core'; -import { SortableContext } from '@dnd-kit/sortable'; -import { ExpandLess, ExpandMore } from '@mui/icons-material'; +import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'; +import { CSS } from '@dnd-kit/utilities'; +import { Delete, DragIndicator, ExpandLess, ExpandMore, SwapHoriz } from '@mui/icons-material'; import { Button, IconButton, Paper, TextField } from '@mui/material'; import { UIEventHandler, useContext, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -28,6 +31,8 @@ import { ExhibitionSetContext, ExhibitionStateManager, } from './ExhibitonUtils'; +import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities'; +import { useMouseAndTouchSensors } from '../../../hooks/sensors.hook'; const Idealot = () => { const { t } = useTranslation(); @@ -52,11 +57,9 @@ const DropZone = ({ id }: { id: string }) => { const { t } = useTranslation(); const { setNodeRef } = useDroppable({ id }); const section = useContext(ExhibitionGetContext).getSection(id); - const { getSorting, setSorting, swapSectionDraggables } = useContext( + const { getSorting, setSorting, moveSectionDraggables } = useContext( ExhibitionSectionUtilsContext ); - const itemIds = section?.dragElements.map(elem => elem.id); - const dragItems = section?.dragElements; const [activeId, setActiveId] = useState(undefined); const activeSortable = section?.dragElements.find(elem => elem.id === activeId)?.sortableElement; @@ -67,7 +70,7 @@ const DropZone = ({ id }: { id: string }) => { const oldIndex = section?.dragElements.findIndex(x => x.id === active.id); const newIndex = section?.dragElements.findIndex(x => x.id === over.id); if (oldIndex !== undefined && newIndex !== undefined) - swapSectionDraggables(oldIndex, newIndex, id); + moveSectionDraggables(oldIndex, newIndex, id); setActiveId(undefined); } }; @@ -77,6 +80,7 @@ const DropZone = ({ id }: { id: string }) => { setActiveId(active.id); }; + const sensors = useMouseAndTouchSensors(); return (
{
-
- {getSorting() && itemIds ? ( - + {getSorting() ? ( + {activeId && activeSortable} - - {dragItems?.map(item => + + {section?.dragElements.map(item => item.id === activeId ? (
{item.sortableElement} @@ -110,7 +124,7 @@ const DropZone = ({ id }: { id: string }) => { ) : ( - <>{dragItems?.map(item => item.element)} + <>{section?.dragElements.map(elem => elem.element)} )}
); @@ -136,7 +150,8 @@ const TitleDropzone = () => { const ExhibitionManipulator = () => { const { t } = useTranslation(); const sections = useContext(ExhibitionGetContext).getAllSections(); - const addSection = useContext(ExhibitionSectionUtilsContext).addSection; + const { getSectionTitle } = useContext(ExhibitionGetContext); + const { addSection, moveSections } = useContext(ExhibitionSectionUtilsContext); const scroll = useRef(0); const scrollDivRef = useRef(null); @@ -144,7 +159,22 @@ const ExhibitionManipulator = () => { if (node.currentTarget.scrollTop !== 0) scroll.current = Number(node.currentTarget.scrollTop); }; + const [activeId, setActiveId] = useState(undefined); + const [isDragMode, setIsDragMode] = useState(false); + + const dragStart = (event: DragStartEvent) => { + setActiveId(String(event.active.id)); + }; + const dragEnd = (event: DragEndEvent) => { + const { active, over } = event; + if (over && active.id !== over.id) { + moveSections(active.id.toString(), over.id.toString()); + } + setActiveId(undefined); + }; + useEffect(() => scrollDivRef.current?.scrollTo(0, scroll.current)); + const sensors = useMouseAndTouchSensors(); return (
@@ -157,20 +187,127 @@ const ExhibitionManipulator = () => { onScroll={handleScroll} > - {sections?.map(section => ( -
- ))} + {isDragMode ? ( + + + {sections!.map(section => ( + { + setIsDragMode(false); + }} + isGrayedOut={section.id === activeId ? true : false} + /> + ))} + + + {activeId ? ( + + ) : null} + + + ) : ( + <> + {sections?.map(section => ( +
setIsDragMode(true)} /> + ))} + + )}
-
); }; +const SortableSectionUI = ({ + sectionTitle, + deleteThisSection, + setNodeRef, + attributes, + listeners, + style, + isGrayedOut, + closeThisDrag, +}: { + sectionTitle: string | undefined; + deleteThisSection?: () => void; + setNodeRef?: (node: HTMLElement | null) => void; + attributes?: DraggableAttributes | undefined; + listeners?: SyntheticListenerMap | undefined; + style?: { transform: string | undefined; transition: string | undefined }; + isGrayedOut?: boolean; + closeThisDrag?: () => void; +}) => { + const { t } = useTranslation(); + return ( + +
+
+ + + + + + + + + + +
+
+
+ ); +}; +const SortableSection = ({ + id, + closeDrag, + isGrayedOut, +}: { + id: string; + closeDrag: (sectionId: string) => void; + isGrayedOut?: boolean; +}) => { + const { getSectionTitle } = useContext(ExhibitionGetContext); + const { deleteSection } = useContext(ExhibitionSectionUtilsContext); + const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ + id: id, + data: { + type: 'section', + }, + }); + const style = { + transform: CSS.Transform.toString(transform), + transition, + }; + + return ( + deleteSection(id)} + setNodeRef={setNodeRef} + attributes={attributes} + listeners={listeners} + style={style} + isGrayedOut={isGrayedOut} + closeThisDrag={() => closeDrag(id)} + /> + ); +}; const Introduction = () => { const { t } = useTranslation(); const { getTitle, getIntroduction } = useContext(ExhibitionGetContext); @@ -210,14 +347,14 @@ const Introduction = () => { ); }; -const Section = ({ id }: { id: string }) => { +const Section = ({ id, dragClick }: { id: string; dragClick: (sectionId: string) => void }) => { const { t } = useTranslation(); const [isOpen, setIsOpen] = useState(true); const section = useContext(ExhibitionGetContext).getSection(id); const { getSectionTitle, getSectionText } = useContext(ExhibitionGetContext); const { setSectionTitle, setSectionText } = useContext(ExhibitionSetContext); - + const { deleteSection } = useContext(ExhibitionSectionUtilsContext); const extraOptions = { preset: undefined, placeholder: t('exhibition.manipulator.section.text-placeholder'), @@ -230,6 +367,9 @@ const Section = ({ id }: { id: string }) => {
+ dragClick(id)}> + + { defaultValue={getSectionTitle(id)} onBlur={event => setSectionTitle(id, event.target.value)} /> + deleteSection(id)}> + + setIsOpen(!isOpen)}> {isOpen ? : } @@ -256,49 +399,6 @@ const Section = ({ id }: { id: string }) => { ); }; -const EndCard = () => { - const { t } = useTranslation(); - const { getEpilog, getSources } = useContext(ExhibitionGetContext); - - const { setEpilog, setSource, addSource } = useContext(ExhibitionSetContext); - - const extraOptions = { - height: 300, - allowReziseX: false, - allowReziseY: false, - preset: undefined, - placeholder: t('exhibition.manipulator.epilog.text-placeholder'), - statusbar: false, - tabIndex: 0, - className: 'z-0', - }; - - return ( -
- - setEpilog(text)} - /> - - {getSources()?.map((source, index) => ( - event.target.value} - onBlur={event => setSource(event.target.value, source.id)} - /> - ))} -
- -
-
- ); -}; - const PublishButton = () => { const { t } = useTranslation(); const { getIsPublished } = useContext(ExhibitionGetContext); diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionViewer.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionViewer.tsx index 381eecc1c..a67dfee16 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitionViewer.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitionViewer.tsx @@ -1,21 +1,20 @@ import { Portal } from '@mui/material'; import { useContext, useState } from 'react'; -import { useTranslation } from 'react-i18next'; import { Redirect } from 'react-router-dom'; import { useGetExhibitionQuery } from '../../../graphql/APIConnector'; import { useSimplifiedQueryResponseData } from '../../../graphql/queryUtils'; import { asUploadPath, root } from '../../../helpers/app-helpers'; -import { pushHistoryWithoutRouter } from '../../../helpers/history'; import { useCanEditExhibition } from '../../../hooks/can-do-hooks'; import { FlatExhibition } from '../../../types/additionalFlatTypes'; import Loading from '../../common/Loading'; import ProtectedRoute from '../../common/ProtectedRoute'; import QueryErrorDisplay from '../../common/QueryErrorDisplay'; import RichText from '../../common/RichText'; -import PicturePreview from '../../common/picture-gallery/PicturePreview'; import { FALLBACK_PATH } from '../../routes'; import PictureView from '../picture/PictureView'; import { ExhibitionGetContext, ExhibitionStateViewer } from './ExhibitonUtils'; +import { Gallery } from 'react-grid-gallery'; +import { pushHistoryWithoutRouter } from '../../../helpers/history'; const Title = () => { const { getTitlePicture, getTitle, getIntroduction } = useContext(ExhibitionGetContext); @@ -48,7 +47,12 @@ const Section = ({ sectionId }: { sectionId: string }) => { const { getSection } = useContext(ExhibitionGetContext); const mySection = getSection(sectionId); const [focusedPicture, setFocusedPicture] = useState(); - + const images = mySection?.dragElements.map(elem => ({ + src: asUploadPath(elem.picture.media), + width: elem.picture.media?.width ?? 0, + height: elem.picture.media?.height ?? 0, + id: elem.picture.id, + })); return ( <> {focusedPicture && ( @@ -66,51 +70,21 @@ const Section = ({ sectionId }: { sectionId: string }) => {
{mySection.title}
-
- {mySection.dragElements.map((drag, index) => ( -
- { - setFocusedPicture(drag.picture.id); - pushHistoryWithoutRouter(`/picture/${drag.picture.id}`); - }} - /> -
- ))} -
+ { + setFocusedPicture(item.id); + pushHistoryWithoutRouter(`/picture/${item.id}`); + }} + />
)} ); }; -const EndCard = () => { - const { t } = useTranslation(); - const { getEpilog, getSources } = useContext(ExhibitionGetContext); - const epilog = getEpilog(); - const sources = getSources(); - return ( -
- {epilog && ( -
-
{t('exhibition.viewer.epilog')}
- -
- )} - {sources && sources.length > 0 && ( -
-
{t('exhibition.viewer.sources')}
-
    - {sources.map((source, key) => source.source &&
  • {source.source}
  • )} -
-
- )} -
- ); -}; - const MainPart = () => { const { getAllSections } = useContext(ExhibitionGetContext); const sectionsWithContent = getAllSections()?.filter( @@ -152,7 +126,6 @@ const ExhibitionViewer = ({ exhibitionId }: { exhibitionId: string }) => {
<MainPart /> - <EndCard /> </div> </div> </ExhibitionStateViewer> diff --git a/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx b/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx index 3b5c13351..16bc68798 100644 --- a/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx +++ b/projects/bp-gallery/src/components/views/exhibitions/ExhibitonUtils.tsx @@ -3,6 +3,7 @@ import { PropsWithChildren, SetStateAction, createContext, + useContext, useEffect, useState, } from 'react'; @@ -21,28 +22,23 @@ import { DragStartEvent, } from '@dnd-kit/core'; import { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities'; -import { useSortable } from '@dnd-kit/sortable'; +import { useSortable, arrayMove } from '@dnd-kit/sortable'; import PicturePreview from '../../common/picture-gallery/PicturePreview'; import { useCreateExhibitionPictureMutation, useCreateExhibitionSectionMutation, - useCreateExhibitionSourceMutation, + useDeleteExhibitionPictureMutation, + useDeleteExhibitionSectionMutation, useUpdateExhibitionMutation, useUpdateExhibitionPictureMutation, useUpdateExhibitionSectionMutation, - useUpdateExhibitionSourceMutation, } from '../../../graphql/APIConnector'; - -interface ExhibitionSource { - id: string; - source: string; -} +import { Delete } from '@mui/icons-material'; +import { IconButton } from '@mui/material'; interface ExhibitionText { title: string; introduction: string; - epilog: string; - sources: ExhibitionSource[]; isPublished: boolean; } @@ -70,8 +66,6 @@ export const ExhibitionGetContext = createContext<{ getIntroduction: () => string; getSectionTitle: (sectionId: string) => string | undefined; getSectionText: (sectionId: string) => string | undefined; - getEpilog: () => string | undefined; - getSources: () => ExhibitionSource[] | undefined; getIsPublished: () => boolean; getSection: (sectionId: string) => SectionState | undefined; getAllSections: () => SectionState[] | undefined; @@ -83,8 +77,6 @@ export const ExhibitionGetContext = createContext<{ getIntroduction: () => '', getSectionTitle: () => '', getSectionText: () => '', - getEpilog: () => '', - getSources: () => [], getIsPublished: () => false, getSection: () => undefined, getAllSections: () => undefined, @@ -97,33 +89,33 @@ export const ExhibitionSetContext = createContext<{ setIntroduction: (introduction: string) => void; setSectionTitle: (sectionId: string, title: string) => void; setSectionText: (sectionId: string, text: string) => void; - setEpilog: (epilog: string) => void; - setSource: (source: string, sourceId: string) => void; - addSource: () => void; toggleIsPublished: () => void; + deleteExhibitionPicture: (exhibitionPictureId: string) => void; }>({ setTitle: () => {}, setIntroduction: () => {}, setSectionTitle: () => {}, setSectionText: () => {}, - setEpilog: () => {}, - setSource: () => {}, - addSource: () => {}, toggleIsPublished: () => {}, + deleteExhibitionPicture: () => {}, }); export const ExhibitionSectionUtilsContext = createContext<{ - swapSectionDraggables: (oldIndex: number, newIndex: number, sectionId: string) => void; + moveSections: (oldSectionId: string, newSectionId: string) => void; + moveSectionDraggables: (oldIndex: number, newIndex: number, sectionId: string) => void; getSorting: () => boolean; setSorting: (isSorting: boolean) => void; getDraggable: (dragElementId: string) => DragElement | undefined; addSection: () => void; + deleteSection: (sectionId: string) => void; }>({ - swapSectionDraggables: () => {}, + moveSections: () => {}, + moveSectionDraggables: () => {}, getSorting: () => false, setSorting: () => {}, getDraggable: () => undefined, addSection: () => {}, + deleteSection: () => {}, }); const DraggablePicture = ({ @@ -185,9 +177,22 @@ const ExhibitionPicture = ({ attributes: DraggableAttributes; }) => { const picture = exhibitionPicture.picture; + const { deleteExhibitionPicture } = useContext(ExhibitionSetContext); return ( - <div className='z-[9] relative' ref={setNodeRef} {...listeners} {...attributes}> - {picture && <PicturePreview height='9rem' picture={picture} onClick={() => {}} />} + <div className='relative'> + <div className='z-[99] absolute top-0 right-0'> + <IconButton + style={{ backgroundColor: 'white' }} + onClick={() => { + deleteExhibitionPicture(exhibitionPicture.id); + }} + > + <Delete /> + </IconButton> + </div> + <div className='z-[9]' ref={setNodeRef} {...listeners} {...attributes}> + {picture && <PicturePreview height='9rem' picture={picture} onClick={() => {}} />} + </div> </div> ); }; @@ -239,11 +244,6 @@ const buildExhibitionTextState = (exhibition: FlatExhibition) => { return { title: exhibition.title ?? '', introduction: exhibition.introduction ?? '', - epilog: exhibition.epilog ?? '', - sources: - exhibition.exhibition_sources?.map(source => { - return { id: source.id, source: source.source ?? '' } as ExhibitionSource; - }) ?? [], isPublished: exhibition.is_published ?? false, }; }; @@ -300,16 +300,6 @@ export const ExhibitionStateGetter = ({ return exhibitionText.introduction; }; - //getter and setter for epilog in exhibitionText - const getEpilog = () => { - return exhibitionText.epilog; - }; - - //getter and setter for sources in exhibitionText - const getSources = () => { - return exhibitionText.sources; - }; - const getIsPublished = () => { return exhibitionText.isPublished; }; @@ -322,8 +312,6 @@ export const ExhibitionStateGetter = ({ getIntroduction, getSectionTitle, getSectionText, - getEpilog, - getSources, getSection, getAllSections, getIdealot, @@ -343,6 +331,8 @@ export const ExhibitionStateChanger = ({ sections, setSections, databaseSaver, + setTitlePicture, + setIdealot, children, }: PropsWithChildren<{ exhibitionId: string; @@ -351,7 +341,23 @@ export const ExhibitionStateChanger = ({ sections: SectionState[]; setSections: Dispatch<SetStateAction<SectionState[]>>; databaseSaver: ReturnType<typeof useExhibitionDatabaseSaver>; + setTitlePicture: Dispatch<SetStateAction<DragElement | undefined>>; + setIdealot: Dispatch<SetStateAction<DragElement[]>>; }>) => { + const deleteExhibitionPicture = (exhibitionPictureId: string) => { + databaseSaver.deletePicture(exhibitionPictureId); + setSections( + sections.map(section => ({ + ...section, + dragElements: section.dragElements.filter(elem => elem.id !== exhibitionPictureId), + })) + ); + setTitlePicture(titlePicture => + titlePicture?.id === exhibitionPictureId ? undefined : titlePicture + ); + setIdealot(idealot => idealot.filter(elem => elem.id !== exhibitionPictureId)); + }; + const setSectionText = (sectionId: string, text: string) => { databaseSaver.setSectionText(sectionId, text); setSections( @@ -376,29 +382,6 @@ export const ExhibitionStateChanger = ({ setExhibitionText({ ...exhibitionText, introduction: introduction }); }; - const setEpilog = (epilog: string) => { - databaseSaver.setEpilog(exhibitionId, epilog); - setExhibitionText({ ...exhibitionText, epilog: epilog }); - }; - - const setSource = (source: string, sourceId: string) => { - setExhibitionText({ - ...exhibitionText, - sources: exhibitionText.sources.map(s => - s.id === sourceId ? { id: s.id, source: source } : s - ), - }); - }; - - const addSource = async () => { - const id = await databaseSaver.addSource(exhibitionId); - id && - setExhibitionText({ - ...exhibitionText, - sources: [...exhibitionText.sources.concat({ id: id, source: '' })], - }); - }; - const toggleIsPublished = () => { databaseSaver.setIsPublished(!exhibitionText.isPublished, exhibitionId); setExhibitionText({ ...exhibitionText, isPublished: !exhibitionText.isPublished }); @@ -411,10 +394,8 @@ export const ExhibitionStateChanger = ({ setIntroduction, setSectionTitle, setSectionText, - setEpilog, - setSource, - addSource, toggleIsPublished, + deleteExhibitionPicture, }} > {children} @@ -444,23 +425,25 @@ const ExhibitionDragNDrop = ({ }>) => { const [isSorting, setIsSorting] = useState(false); - const swapSectionDraggables = (oldIndex: number, newIndex: number, sectionId: string) => { - databaseSaver.swapOrderInExhibitionPicture(sections, oldIndex, newIndex, sectionId); - setSections( - sections.map(section => - section.id === sectionId - ? ({ - id: section.id, - text: section.text, - dragElements: section.dragElements.map((elem, index) => { - if (index === oldIndex) return section.dragElements[newIndex]; - if (index === newIndex) return section.dragElements[oldIndex]; - return elem; - }), - } as SectionState) - : section - ) + const moveSections = (oldSectionId: string, newSectionId: string) => { + const oldIndex = sections.findIndex(section => section.id === oldSectionId); + const newIndex = sections.findIndex(section => section.id === newSectionId); + const newSectionOrder = arrayMove(sections, oldIndex, newIndex); + databaseSaver.updateSectionsOrder(newSectionOrder); + setSections(newSectionOrder); + }; + const deleteSection = (sectionId: string) => { + databaseSaver.deleteSection(sectionId); + setSections(sections => sections.filter(section => section.id !== sectionId)); + }; + const moveSectionDraggables = (oldIndex: number, newIndex: number, sectionId: string) => { + const newDraggablesOrder = sections.map(section => + section.id === sectionId + ? { ...section, dragElements: arrayMove(section.dragElements, oldIndex, newIndex) } + : section ); + setSections(newDraggablesOrder); + databaseSaver.moveOrderInExhibitionPicture(newDraggablesOrder, sectionId); }; const getSorting = () => { @@ -488,12 +471,11 @@ const ExhibitionDragNDrop = ({ ) => { if (sectionId) return addToSection(dragElement, sectionId); if (isTitle) { - if (idealot && titlePicture) setIdealot([...idealot, titlePicture]); - setTitlePicture(dragElement); if (titlePicture) { - databaseSaver.addToIdealot(exhibitionId, idealot, dragElement.id); + databaseSaver.addToIdealot(exhibitionId, idealot, titlePicture.id); } databaseSaver.setTitlePicture(exhibitionId, dragElement.id); + setTitlePicture(dragElement); return; } if (isIdeaLot && idealot) { @@ -565,11 +547,13 @@ const ExhibitionDragNDrop = ({ return ( <ExhibitionSectionUtilsContext.Provider value={{ - swapSectionDraggables, + moveSectionDraggables, setSorting, getSorting, getDraggable, addSection, + deleteSection, + moveSections, }} > <DragNDropHandler @@ -593,20 +577,29 @@ const useExhibitionDatabaseSaver = () => { refetchQueries: ['getExhibition'], }); - const [updateExhibitionSource] = useUpdateExhibitionSourceMutation({ - refetchQueries: ['getExhibition'], - }); - const [updateExhibition] = useUpdateExhibitionMutation({ refetchQueries: ['getExhibition'] }); - const [createSource] = useCreateExhibitionSourceMutation({ refetchQueries: ['getExhibition'] }); - const [createSection] = useCreateExhibitionSectionMutation({ refetchQueries: ['getExhibition'] }); const [createExhibitionPicture] = useCreateExhibitionPictureMutation({ refetchQueries: ['getExhibition'], }); + + const [deleteExhibitionPicture] = useDeleteExhibitionPictureMutation({ + refetchQueries: ['getExhibition'], + }); + const [deleteExhibitionSection] = useDeleteExhibitionSectionMutation({ + refetchQueries: ['getExhibition'], + }); return { + deleteSection: (id: string) => { + deleteExhibitionSection({ variables: { id: id } }); + }, + deletePicture: (id: string) => { + deleteExhibitionPicture({ + variables: { id: id }, + }); + }, setSectionText: (id: string, text: string) => { updateExhibitionSection({ variables: { @@ -698,38 +691,21 @@ const useExhibitionDatabaseSaver = () => { }, }); }, - swapOrderInExhibitionPicture: ( - sections: SectionState[], - oldIndex: number, - newIndex: number, - sectionId: string - ) => { - const currentDragElement = sections.find(section => section.id === sectionId)?.dragElements[ - oldIndex - ]; - const otherDragElement = sections.find(section => section.id === sectionId)?.dragElements[ - newIndex - ]; - currentDragElement && - updateExhibitionPicture({ - variables: { - id: currentDragElement.id, - data: { - order: newIndex, - subtitle: currentDragElement.subtitle, - }, - }, - }); - otherDragElement && - updateExhibitionPicture({ + moveOrderInExhibitionPicture: (sections: SectionState[], sectionId: string) => { + const currentSection = sections.find(section => section.id === sectionId); + currentSection?.dragElements.forEach((elem, index) => + updateExhibitionPicture({ variables: { id: elem.id, data: { order: index } } }) + ); + }, + updateSectionsOrder: (sections: SectionState[]) => { + sections.forEach((section, index) => { + updateExhibitionSection({ variables: { - id: otherDragElement.id, - data: { - order: oldIndex, - subtitle: otherDragElement.subtitle, - }, + id: section.id, + order: index, }, }); + }); }, setSectionTitle: (sectionId: string, title: string) => { @@ -775,28 +751,6 @@ const useExhibitionDatabaseSaver = () => { }); }, - setEpilog: (exhibitionId: string, epilog: string) => { - updateExhibition({ - variables: { - id: exhibitionId, - data: { - epilog: epilog, - }, - }, - }); - }, - - setSource: (source: string, sourceId: string) => { - updateExhibitionSource({ variables: { id: sourceId, source: source } }); - }, - - addSource: async (exhibitionId: string) => { - const result = await createSource({ - variables: { exhibitionId: exhibitionId, publishedAt: new Date().toISOString() }, - }); - const id = result.data?.createExhibitionSource?.data?.id; - return id; - }, setIsPublished: (isPublished: boolean, exhibitionId: string) => { updateExhibition({ variables: { @@ -858,6 +812,8 @@ export const ExhibitionStateManager = ({ sections={sections} setSections={setSections} databaseSaver={databaseSaver} + setTitlePicture={setTitlePicture} + setIdealot={setIdealot} > <ExhibitionDragNDrop sections={sections} diff --git a/projects/bp-gallery/src/components/views/search/SearchView.tsx b/projects/bp-gallery/src/components/views/search/SearchView.tsx index 2d10aeefd..a982f37bd 100644 --- a/projects/bp-gallery/src/components/views/search/SearchView.tsx +++ b/projects/bp-gallery/src/components/views/search/SearchView.tsx @@ -47,6 +47,7 @@ const SearchView = () => { // Builds query from search params in the path const queryParams = useMemo(() => { + searchParams.delete('exhibitionId'); const allSearchTerms = searchParams .getAll(toURLSearchParam(SearchType.ALL)) .map(decodeURIComponent); diff --git a/projects/bp-gallery/src/graphql/APIConnector.tsx b/projects/bp-gallery/src/graphql/APIConnector.tsx index 0655984a7..06ae59cac 100644 --- a/projects/bp-gallery/src/graphql/APIConnector.tsx +++ b/projects/bp-gallery/src/graphql/APIConnector.tsx @@ -436,9 +436,7 @@ export type DescriptionRelationResponseCollection = { export type Exhibition = { archive_tag?: Maybe<ArchiveTagEntityResponse>; createdAt?: Maybe<Scalars['DateTime']>; - epilog?: Maybe<Scalars['String']>; exhibition_sections?: Maybe<ExhibitionSectionRelationResponseCollection>; - exhibition_sources?: Maybe<ExhibitionSourceRelationResponseCollection>; idealot_pictures?: Maybe<ExhibitionPictureRelationResponseCollection>; introduction?: Maybe<Scalars['String']>; is_published?: Maybe<Scalars['Boolean']>; @@ -455,13 +453,6 @@ export type ExhibitionExhibition_SectionsArgs = { sort?: InputMaybe<Array<InputMaybe<Scalars['String']>>>; }; -export type ExhibitionExhibition_SourcesArgs = { - filters?: InputMaybe<ExhibitionSourceFiltersInput>; - pagination?: InputMaybe<PaginationArg>; - publicationState?: InputMaybe<PublicationState>; - sort?: InputMaybe<Array<InputMaybe<Scalars['String']>>>; -}; - export type ExhibitionIdealot_PicturesArgs = { filters?: InputMaybe<ExhibitionPictureFiltersInput>; pagination?: InputMaybe<PaginationArg>; @@ -487,9 +478,7 @@ export type ExhibitionFiltersInput = { and?: InputMaybe<Array<InputMaybe<ExhibitionFiltersInput>>>; archive_tag?: InputMaybe<ArchiveTagFiltersInput>; createdAt?: InputMaybe<DateTimeFilterInput>; - epilog?: InputMaybe<StringFilterInput>; exhibition_sections?: InputMaybe<ExhibitionSectionFiltersInput>; - exhibition_sources?: InputMaybe<ExhibitionSourceFiltersInput>; id?: InputMaybe<IdFilterInput>; idealot_pictures?: InputMaybe<ExhibitionPictureFiltersInput>; introduction?: InputMaybe<StringFilterInput>; @@ -504,7 +493,6 @@ export type ExhibitionFiltersInput = { export type ExhibitionInput = { archive_tag?: InputMaybe<Scalars['ID']>; - epilog?: InputMaybe<Scalars['String']>; exhibition_sections?: InputMaybe<Array<InputMaybe<Scalars['ID']>>>; exhibition_sources?: InputMaybe<Array<InputMaybe<Scalars['ID']>>>; idealot_pictures?: InputMaybe<Array<InputMaybe<Scalars['ID']>>>; @@ -632,50 +620,6 @@ export type ExhibitionSectionRelationResponseCollection = { data: Array<ExhibitionSectionEntity>; }; -export type ExhibitionSource = { - createdAt?: Maybe<Scalars['DateTime']>; - exhibition?: Maybe<ExhibitionEntityResponse>; - publishedAt?: Maybe<Scalars['DateTime']>; - source?: Maybe<Scalars['String']>; - updatedAt?: Maybe<Scalars['DateTime']>; -}; - -export type ExhibitionSourceEntity = { - attributes?: Maybe<ExhibitionSource>; - id?: Maybe<Scalars['ID']>; -}; - -export type ExhibitionSourceEntityResponse = { - data?: Maybe<ExhibitionSourceEntity>; -}; - -export type ExhibitionSourceEntityResponseCollection = { - data: Array<ExhibitionSourceEntity>; - meta: ResponseCollectionMeta; -}; - -export type ExhibitionSourceFiltersInput = { - and?: InputMaybe<Array<InputMaybe<ExhibitionSourceFiltersInput>>>; - createdAt?: InputMaybe<DateTimeFilterInput>; - exhibition?: InputMaybe<ExhibitionFiltersInput>; - id?: InputMaybe<IdFilterInput>; - not?: InputMaybe<ExhibitionSourceFiltersInput>; - or?: InputMaybe<Array<InputMaybe<ExhibitionSourceFiltersInput>>>; - publishedAt?: InputMaybe<DateTimeFilterInput>; - source?: InputMaybe<StringFilterInput>; - updatedAt?: InputMaybe<DateTimeFilterInput>; -}; - -export type ExhibitionSourceInput = { - exhibition?: InputMaybe<Scalars['ID']>; - publishedAt?: InputMaybe<Scalars['DateTime']>; - source?: InputMaybe<Scalars['String']>; -}; - -export type ExhibitionSourceRelationResponseCollection = { - data: Array<ExhibitionSourceEntity>; -}; - export type FaceTag = { createdAt?: Maybe<Scalars['DateTime']>; person_tag?: Maybe<PersonTagEntityResponse>; @@ -767,7 +711,6 @@ export type GenericMorph = | Exhibition | ExhibitionPicture | ExhibitionSection - | ExhibitionSource | FaceTag | KeywordTag | Link @@ -1081,7 +1024,6 @@ export type Mutation = { createExhibition?: Maybe<ExhibitionEntityResponse>; createExhibitionPicture?: Maybe<ExhibitionPictureEntityResponse>; createExhibitionSection?: Maybe<ExhibitionSectionEntityResponse>; - createExhibitionSource?: Maybe<ExhibitionSourceEntityResponse>; createFaceTag?: Maybe<FaceTagEntityResponse>; createKeywordTag?: Maybe<KeywordTagEntityResponse>; createLink?: Maybe<LinkEntityResponse>; @@ -1106,7 +1048,6 @@ export type Mutation = { deleteExhibition?: Maybe<ExhibitionEntityResponse>; deleteExhibitionPicture?: Maybe<ExhibitionPictureEntityResponse>; deleteExhibitionSection?: Maybe<ExhibitionSectionEntityResponse>; - deleteExhibitionSource?: Maybe<ExhibitionSourceEntityResponse>; deleteFaceTag?: Maybe<FaceTagEntityResponse>; deleteKeywordTag?: Maybe<KeywordTagEntityResponse>; deleteLink?: Maybe<LinkEntityResponse>; @@ -1151,7 +1092,6 @@ export type Mutation = { updateExhibition?: Maybe<ExhibitionEntityResponse>; updateExhibitionPicture?: Maybe<ExhibitionPictureEntityResponse>; updateExhibitionSection?: Maybe<ExhibitionSectionEntityResponse>; - updateExhibitionSource?: Maybe<ExhibitionSourceEntityResponse>; updateFaceTag?: Maybe<FaceTagEntityResponse>; updateFileInfo: UploadFileEntityResponse; updateKeywordTag?: Maybe<KeywordTagEntityResponse>; @@ -1232,10 +1172,6 @@ export type MutationCreateExhibitionSectionArgs = { data: ExhibitionSectionInput; }; -export type MutationCreateExhibitionSourceArgs = { - data: ExhibitionSourceInput; -}; - export type MutationCreateFaceTagArgs = { data: FaceTagInput; }; @@ -1320,10 +1256,6 @@ export type MutationDeleteExhibitionSectionArgs = { id: Scalars['ID']; }; -export type MutationDeleteExhibitionSourceArgs = { - id: Scalars['ID']; -}; - export type MutationDeleteFaceTagArgs = { id: Scalars['ID']; }; @@ -1494,11 +1426,6 @@ export type MutationUpdateExhibitionSectionArgs = { id: Scalars['ID']; }; -export type MutationUpdateExhibitionSourceArgs = { - data: ExhibitionSourceInput; - id: Scalars['ID']; -}; - export type MutationUpdateFaceTagArgs = { data: FaceTagInput; id: Scalars['ID']; @@ -2031,8 +1958,6 @@ export type Query = { exhibitionPictures?: Maybe<ExhibitionPictureEntityResponseCollection>; exhibitionSection?: Maybe<ExhibitionSectionEntityResponse>; exhibitionSections?: Maybe<ExhibitionSectionEntityResponseCollection>; - exhibitionSource?: Maybe<ExhibitionSourceEntityResponse>; - exhibitionSources?: Maybe<ExhibitionSourceEntityResponseCollection>; exhibitions?: Maybe<ExhibitionEntityResponseCollection>; faceTag?: Maybe<FaceTagEntityResponse>; faceTags?: Maybe<FaceTagEntityResponseCollection>; @@ -2148,17 +2073,6 @@ export type QueryExhibitionSectionsArgs = { sort?: InputMaybe<Array<InputMaybe<Scalars['String']>>>; }; -export type QueryExhibitionSourceArgs = { - id?: InputMaybe<Scalars['ID']>; -}; - -export type QueryExhibitionSourcesArgs = { - filters?: InputMaybe<ExhibitionSourceFiltersInput>; - pagination?: InputMaybe<PaginationArg>; - publicationState?: InputMaybe<PublicationState>; - sort?: InputMaybe<Array<InputMaybe<Scalars['String']>>>; -}; - export type QueryExhibitionsArgs = { filters?: InputMaybe<ExhibitionFiltersInput>; pagination?: InputMaybe<PaginationArg>; @@ -3090,7 +3004,6 @@ export type GetExhibitionQuery = { attributes?: { title?: string | null; introduction?: string | null; - epilog?: string | null; is_published?: boolean | null; title_picture?: { data?: { @@ -3187,9 +3100,6 @@ export type GetExhibitionQuery = { } | null; }>; } | null; - exhibition_sources?: { - data: Array<{ id?: string | null; attributes?: { source?: string | null } | null }>; - } | null; } | null; } | null; } | null; @@ -3969,15 +3879,6 @@ export type CreateExhibitionSectionMutation = { createExhibitionSection?: { data?: { id?: string | null } | null } | null; }; -export type CreateExhibitionSourceMutationVariables = Exact<{ - exhibitionId: Scalars['ID']; - publishedAt: Scalars['DateTime']; -}>; - -export type CreateExhibitionSourceMutation = { - createExhibitionSource?: { data?: { id?: string | null } | null } | null; -}; - export type CreateFaceTagMutationVariables = Exact<{ pictureId: Scalars['ID']; personTagId: Scalars['ID']; @@ -4084,6 +3985,22 @@ export type DeleteExhibitionMutation = { deleteExhibition?: { data?: { id?: string | null } | null } | null; }; +export type DeleteExhibitionPictureMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + +export type DeleteExhibitionPictureMutation = { + deleteExhibitionPicture?: { data?: { id?: string | null } | null } | null; +}; + +export type DeleteExhibitionSectionMutationVariables = Exact<{ + id: Scalars['ID']; +}>; + +export type DeleteExhibitionSectionMutation = { + deleteExhibitionSection?: { data?: { id?: string | null } | null } | null; +}; + export type DeleteFaceTagMutationVariables = Exact<{ id: Scalars['ID']; }>; @@ -4329,15 +4246,6 @@ export type UpdateExhibitionSectionMutation = { updateExhibitionSection?: { data?: { id?: string | null } | null } | null; }; -export type UpdateExhibitionSourceMutationVariables = Exact<{ - id: Scalars['ID']; - source: Scalars['String']; -}>; - -export type UpdateExhibitionSourceMutation = { - updateExhibitionSource?: { data?: { id?: string | null } | null } | null; -}; - export type UpdateFaceTagDirectionMutationVariables = Exact<{ faceTagId: Scalars['ID']; tag_direction?: InputMaybe<Scalars['Int']>; @@ -5649,7 +5557,6 @@ export const GetExhibitionDocument = gql` attributes { title introduction - epilog is_published title_picture { data { @@ -5746,14 +5653,6 @@ export const GetExhibitionDocument = gql` } } } - exhibition_sources { - data { - id - attributes { - source - } - } - } } } } @@ -5806,7 +5705,7 @@ export type GetExhibitionQueryResult = Apollo.QueryResult< >; export const GetExhibitionsDocument = gql` - query getExhibitions($archiveId: ID, $sortBy: [String] = ["createdAt:desc"]) { + query getExhibitions($archiveId: ID, $sortBy: [String] = ["updatedAt:desc"]) { exhibitions(filters: { archive_tag: { id: { eq: $archiveId } } }, sort: $sortBy) { data { id @@ -8341,64 +8240,6 @@ export type CreateExhibitionSectionMutationOptions = Apollo.BaseMutationOptions< CreateExhibitionSectionMutationVariables >; -export const CreateExhibitionSourceDocument = gql` - mutation createExhibitionSource($exhibitionId: ID!, $publishedAt: DateTime!) { - createExhibitionSource(data: { exhibition: $exhibitionId, publishedAt: $publishedAt }) { - data { - id - } - } - } -`; - -export type CreateExhibitionSourceMutationFn = Apollo.MutationFunction< - CreateExhibitionSourceMutation, - CreateExhibitionSourceMutationVariables ->; - -/** - * __useCreateExhibitionSourceMutation__ - * - * To run a mutation, you first call `useCreateExhibitionSourceMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useCreateExhibitionSourceMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [createExhibitionSourceMutation, { data, loading, error }] = useCreateExhibitionSourceMutation({ - * variables: { - * exhibitionId: // value for 'exhibitionId' - * publishedAt: // value for 'publishedAt' - * }, - * }); - */ -export function useCreateExhibitionSourceMutation( - baseOptions?: Apollo.MutationHookOptions< - CreateExhibitionSourceMutation, - CreateExhibitionSourceMutationVariables - > -) { - const options = { ...defaultOptions, ...baseOptions }; - return Apollo.useMutation< - CreateExhibitionSourceMutation, - CreateExhibitionSourceMutationVariables - >(CreateExhibitionSourceDocument, options); -} - -export type CreateExhibitionSourceMutationHookResult = ReturnType< - typeof useCreateExhibitionSourceMutation ->; - -export type CreateExhibitionSourceMutationResult = - Apollo.MutationResult<CreateExhibitionSourceMutation>; - -export type CreateExhibitionSourceMutationOptions = Apollo.BaseMutationOptions< - CreateExhibitionSourceMutation, - CreateExhibitionSourceMutationVariables ->; - export const CreateFaceTagDocument = gql` mutation createFaceTag( $pictureId: ID! @@ -9085,6 +8926,120 @@ export type DeleteExhibitionMutationOptions = Apollo.BaseMutationOptions< DeleteExhibitionMutationVariables >; +export const DeleteExhibitionPictureDocument = gql` + mutation deleteExhibitionPicture($id: ID!) { + deleteExhibitionPicture(id: $id) { + data { + id + } + } + } +`; + +export type DeleteExhibitionPictureMutationFn = Apollo.MutationFunction< + DeleteExhibitionPictureMutation, + DeleteExhibitionPictureMutationVariables +>; + +/** + * __useDeleteExhibitionPictureMutation__ + * + * To run a mutation, you first call `useDeleteExhibitionPictureMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useDeleteExhibitionPictureMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [deleteExhibitionPictureMutation, { data, loading, error }] = useDeleteExhibitionPictureMutation({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useDeleteExhibitionPictureMutation( + baseOptions?: Apollo.MutationHookOptions< + DeleteExhibitionPictureMutation, + DeleteExhibitionPictureMutationVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + DeleteExhibitionPictureMutation, + DeleteExhibitionPictureMutationVariables + >(DeleteExhibitionPictureDocument, options); +} + +export type DeleteExhibitionPictureMutationHookResult = ReturnType< + typeof useDeleteExhibitionPictureMutation +>; + +export type DeleteExhibitionPictureMutationResult = + Apollo.MutationResult<DeleteExhibitionPictureMutation>; + +export type DeleteExhibitionPictureMutationOptions = Apollo.BaseMutationOptions< + DeleteExhibitionPictureMutation, + DeleteExhibitionPictureMutationVariables +>; + +export const DeleteExhibitionSectionDocument = gql` + mutation deleteExhibitionSection($id: ID!) { + deleteExhibitionSection(id: $id) { + data { + id + } + } + } +`; + +export type DeleteExhibitionSectionMutationFn = Apollo.MutationFunction< + DeleteExhibitionSectionMutation, + DeleteExhibitionSectionMutationVariables +>; + +/** + * __useDeleteExhibitionSectionMutation__ + * + * To run a mutation, you first call `useDeleteExhibitionSectionMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useDeleteExhibitionSectionMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [deleteExhibitionSectionMutation, { data, loading, error }] = useDeleteExhibitionSectionMutation({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useDeleteExhibitionSectionMutation( + baseOptions?: Apollo.MutationHookOptions< + DeleteExhibitionSectionMutation, + DeleteExhibitionSectionMutationVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + DeleteExhibitionSectionMutation, + DeleteExhibitionSectionMutationVariables + >(DeleteExhibitionSectionDocument, options); +} + +export type DeleteExhibitionSectionMutationHookResult = ReturnType< + typeof useDeleteExhibitionSectionMutation +>; + +export type DeleteExhibitionSectionMutationResult = + Apollo.MutationResult<DeleteExhibitionSectionMutation>; + +export type DeleteExhibitionSectionMutationOptions = Apollo.BaseMutationOptions< + DeleteExhibitionSectionMutation, + DeleteExhibitionSectionMutationVariables +>; + export const DeleteFaceTagDocument = gql` mutation deleteFaceTag($id: ID!) { deleteFaceTag(id: $id) { @@ -10738,64 +10693,6 @@ export type UpdateExhibitionSectionMutationOptions = Apollo.BaseMutationOptions< UpdateExhibitionSectionMutationVariables >; -export const UpdateExhibitionSourceDocument = gql` - mutation updateExhibitionSource($id: ID!, $source: String!) { - updateExhibitionSource(id: $id, data: { source: $source }) { - data { - id - } - } - } -`; - -export type UpdateExhibitionSourceMutationFn = Apollo.MutationFunction< - UpdateExhibitionSourceMutation, - UpdateExhibitionSourceMutationVariables ->; - -/** - * __useUpdateExhibitionSourceMutation__ - * - * To run a mutation, you first call `useUpdateExhibitionSourceMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useUpdateExhibitionSourceMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [updateExhibitionSourceMutation, { data, loading, error }] = useUpdateExhibitionSourceMutation({ - * variables: { - * id: // value for 'id' - * source: // value for 'source' - * }, - * }); - */ -export function useUpdateExhibitionSourceMutation( - baseOptions?: Apollo.MutationHookOptions< - UpdateExhibitionSourceMutation, - UpdateExhibitionSourceMutationVariables - > -) { - const options = { ...defaultOptions, ...baseOptions }; - return Apollo.useMutation< - UpdateExhibitionSourceMutation, - UpdateExhibitionSourceMutationVariables - >(UpdateExhibitionSourceDocument, options); -} - -export type UpdateExhibitionSourceMutationHookResult = ReturnType< - typeof useUpdateExhibitionSourceMutation ->; - -export type UpdateExhibitionSourceMutationResult = - Apollo.MutationResult<UpdateExhibitionSourceMutation>; - -export type UpdateExhibitionSourceMutationOptions = Apollo.BaseMutationOptions< - UpdateExhibitionSourceMutation, - UpdateExhibitionSourceMutationVariables ->; - export const UpdateFaceTagDirectionDocument = gql` mutation updateFaceTagDirection($faceTagId: ID!, $tag_direction: Int) { updateFaceTag(id: $faceTagId, data: { tag_direction: $tag_direction }) { @@ -13923,50 +13820,6 @@ export function useCanRunMultipleCreateExhibitionSectionMutations( }; } -export function useCanRunCreateExhibitionSourceMutation( - options?: Omit< - Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, - 'variables' - > & { - variables?: Partial<CreateExhibitionSourceMutationVariables>; - withSomeVariables?: boolean; - } -) { - const { data, loading, refetch } = useCanRunOperationQuery({ - ...options, - variables: { - operation: CreateExhibitionSourceDocument.loc?.source.body ?? '', - variableSets: [options?.variables ?? {}], - withSomeVariables: options?.withSomeVariables, - }, - }); - useAuthChangeEffect(refetch); - return { canRun: data?.canRunOperation?.[0] ?? (loading ? false : true), loading }; -} - -export function useCanRunMultipleCreateExhibitionSourceMutations( - options: Omit< - Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, - 'variables' - > & { - variableSets: Partial<CreateExhibitionSourceMutationVariables>[]; - } -) { - const { data, loading, refetch } = useCanRunOperationQuery({ - ...options, - variables: { - operation: CreateExhibitionSourceDocument.loc?.source.body ?? '', - variableSets: options.variableSets, - }, - }); - useAuthChangeEffect(refetch); - return { - canRunMultiple: - data?.canRunOperation ?? options.variableSets.map(_ => (loading ? false : true)), - loading, - }; -} - export function useCanRunCreateFaceTagMutation( options?: Omit< Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, @@ -14495,6 +14348,94 @@ export function useCanRunMultipleDeleteExhibitionMutations( }; } +export function useCanRunDeleteExhibitionPictureMutation( + options?: Omit< + Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, + 'variables' + > & { + variables?: Partial<DeleteExhibitionPictureMutationVariables>; + withSomeVariables?: boolean; + } +) { + const { data, loading, refetch } = useCanRunOperationQuery({ + ...options, + variables: { + operation: DeleteExhibitionPictureDocument.loc?.source.body ?? '', + variableSets: [options?.variables ?? {}], + withSomeVariables: options?.withSomeVariables, + }, + }); + useAuthChangeEffect(refetch); + return { canRun: data?.canRunOperation?.[0] ?? (loading ? false : true), loading }; +} + +export function useCanRunMultipleDeleteExhibitionPictureMutations( + options: Omit< + Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, + 'variables' + > & { + variableSets: Partial<DeleteExhibitionPictureMutationVariables>[]; + } +) { + const { data, loading, refetch } = useCanRunOperationQuery({ + ...options, + variables: { + operation: DeleteExhibitionPictureDocument.loc?.source.body ?? '', + variableSets: options.variableSets, + }, + }); + useAuthChangeEffect(refetch); + return { + canRunMultiple: + data?.canRunOperation ?? options.variableSets.map(_ => (loading ? false : true)), + loading, + }; +} + +export function useCanRunDeleteExhibitionSectionMutation( + options?: Omit< + Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, + 'variables' + > & { + variables?: Partial<DeleteExhibitionSectionMutationVariables>; + withSomeVariables?: boolean; + } +) { + const { data, loading, refetch } = useCanRunOperationQuery({ + ...options, + variables: { + operation: DeleteExhibitionSectionDocument.loc?.source.body ?? '', + variableSets: [options?.variables ?? {}], + withSomeVariables: options?.withSomeVariables, + }, + }); + useAuthChangeEffect(refetch); + return { canRun: data?.canRunOperation?.[0] ?? (loading ? false : true), loading }; +} + +export function useCanRunMultipleDeleteExhibitionSectionMutations( + options: Omit< + Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, + 'variables' + > & { + variableSets: Partial<DeleteExhibitionSectionMutationVariables>[]; + } +) { + const { data, loading, refetch } = useCanRunOperationQuery({ + ...options, + variables: { + operation: DeleteExhibitionSectionDocument.loc?.source.body ?? '', + variableSets: options.variableSets, + }, + }); + useAuthChangeEffect(refetch); + return { + canRunMultiple: + data?.canRunOperation ?? options.variableSets.map(_ => (loading ? false : true)), + loading, + }; +} + export function useCanRunDeleteFaceTagMutation( options?: Omit< Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, @@ -15859,50 +15800,6 @@ export function useCanRunMultipleUpdateExhibitionSectionMutations( }; } -export function useCanRunUpdateExhibitionSourceMutation( - options?: Omit< - Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, - 'variables' - > & { - variables?: Partial<UpdateExhibitionSourceMutationVariables>; - withSomeVariables?: boolean; - } -) { - const { data, loading, refetch } = useCanRunOperationQuery({ - ...options, - variables: { - operation: UpdateExhibitionSourceDocument.loc?.source.body ?? '', - variableSets: [options?.variables ?? {}], - withSomeVariables: options?.withSomeVariables, - }, - }); - useAuthChangeEffect(refetch); - return { canRun: data?.canRunOperation?.[0] ?? (loading ? false : true), loading }; -} - -export function useCanRunMultipleUpdateExhibitionSourceMutations( - options: Omit< - Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, - 'variables' - > & { - variableSets: Partial<UpdateExhibitionSourceMutationVariables>[]; - } -) { - const { data, loading, refetch } = useCanRunOperationQuery({ - ...options, - variables: { - operation: UpdateExhibitionSourceDocument.loc?.source.body ?? '', - variableSets: options.variableSets, - }, - }); - useAuthChangeEffect(refetch); - return { - canRunMultiple: - data?.canRunOperation ?? options.variableSets.map(_ => (loading ? false : true)), - loading, - }; -} - export function useCanRunUpdateFaceTagDirectionMutation( options?: Omit< Apollo.QueryHookOptions<CanRunOperationQuery, CanRunOperationQueryVariables>, diff --git a/projects/bp-gallery/src/graphql/operation.graphql b/projects/bp-gallery/src/graphql/operation.graphql index ca81c6a8c..2f5532baa 100644 --- a/projects/bp-gallery/src/graphql/operation.graphql +++ b/projects/bp-gallery/src/graphql/operation.graphql @@ -13,8 +13,8 @@ query getCollectionInfoById($collectionId: ID!) { collection(id: $collectionId) query getCollectionInfoByName($collectionName: String) { collections(filters: { name: { eq: $collectionName } } publicationState: PREVIEW) { data { id attributes { name description child_collections(sort: "name:asc" publicationState: PREVIEW) { data { id attributes { name thumbnail publishedAt } } } } } } } query getDailyPictureInfo($pictureId: ID!) { picture(id: $pictureId) { data { id attributes { descriptions(sort: "createdAt:asc") { data { id attributes { text } } } time_range_tag { data { id attributes { start end isEstimate } } } verified_time_range_tag { data { id attributes { start end isEstimate } } } comments { data { id } } likes media { data { id attributes { url updatedAt provider } } } archive_tag { data { id attributes { name restrictImageDownloading } } } } } } } query getDecadePreviewThumbnails( $filter40s: PictureFiltersInput! $filter50s: PictureFiltersInput! $filter60s: PictureFiltersInput! $filter70s: PictureFiltersInput! $filter80s: PictureFiltersInput! $filter90s: PictureFiltersInput! ) { decade40s: pictures( filters: { and: [$filter40s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } decade50s: pictures( filters: { and: [$filter50s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } decade60s: pictures( filters: { and: [$filter60s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } decade70s: pictures( filters: { and: [$filter70s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } decade80s: pictures( filters: { and: [$filter80s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } decade90s: pictures( filters: { and: [$filter90s { or: [{ is_text: { eq: false } } { is_text: { null: true } }] }] } pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } } -query getExhibition($exhibitionId: ID!) { exhibition(id: $exhibitionId) { data { id attributes { title introduction epilog is_published title_picture { data { id attributes { subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } idealot_pictures { data { id attributes { subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } exhibition_sections(sort: "order:asc") { data { id attributes { title text order exhibition_pictures(sort: "order:asc") { data { id attributes { order subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } } } } exhibition_sources { data { id attributes { source } } } } } } } -query getExhibitions($archiveId: ID $sortBy: [String] = ["createdAt:desc"]) { exhibitions(filters: { archive_tag: { id: { eq: $archiveId } } } sort: $sortBy) { data { id attributes { title introduction is_published archive_tag { data { id } } title_picture { data { id attributes { picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } } } } } +query getExhibition($exhibitionId: ID!) { exhibition(id: $exhibitionId) { data { id attributes { title introduction is_published title_picture { data { id attributes { subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } idealot_pictures { data { id attributes { subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } exhibition_sections(sort: "order:asc") { data { id attributes { title text order exhibition_pictures(sort: "order:asc") { data { id attributes { order subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } } } } } } } } +query getExhibitions($archiveId: ID $sortBy: [String] = ["updatedAt:desc"]) { exhibitions(filters: { archive_tag: { id: { eq: $archiveId } } } sort: $sortBy) { data { id attributes { title introduction is_published archive_tag { data { id } } title_picture { data { id attributes { picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } } } } } query getFaceTags($pictureId: ID!) { faceTags(filters: { picture: { id: { eq: $pictureId } } }) { data { id attributes { x y tag_direction person_tag { data { id attributes { name } } } } } } } query getIdeaLotContent($exhibitionId: ID!) { exhibition(id: $exhibitionId) { data { id attributes { idealot_pictures { data { id attributes { subtitle picture { data { id attributes { media { data { id attributes { width height formats url updatedAt provider } } } } } } } } } } } } } query getKeywordTagsWithThumbnail( $filters: KeywordTagFiltersInput = {} $thumbnailFilters: PictureFiltersInput = {} $pagination: PaginationArg! $sortBy: [String] ) { keywordTags(filters: $filters pagination: $pagination sort: $sortBy) { data { id attributes { name thumbnail: pictures(filters: $thumbnailFilters pagination: { limit: 1 }) { data { attributes { media { data { attributes { formats provider } } } } } } verified_thumbnail: verified_pictures( filters: $thumbnailFilters pagination: { limit: 1 } ) { data { attributes { media { data { attributes { formats provider } } } } } } } } } } @@ -46,7 +46,6 @@ mutation contact( $recipient: String! $sender_name: String! $reply_email: String mutation createExhibition($archiveId: ID! $publishedAt: DateTime!) { createExhibition(data: { archive_tag: $archiveId publishedAt: $publishedAt }) { data { id } } } mutation createExhibitionPicture( $exhibitionIdealotId: ID! $pictureId: ID! $publishedAt: DateTime! ) { createExhibitionPicture( data: { exhibition_idealot: $exhibitionIdealotId picture: $pictureId publishedAt: $publishedAt } ) { data { id } } } mutation createExhibitionSection($exhibitionId: ID! $order: Int $publishedAt: DateTime!) { createExhibitionSection( data: { exhibition: $exhibitionId order: $order publishedAt: $publishedAt } ) { data { id } } } -mutation createExhibitionSource($exhibitionId: ID! $publishedAt: DateTime!) { createExhibitionSource(data: { exhibition: $exhibitionId publishedAt: $publishedAt }) { data { id } } } mutation createFaceTag( $pictureId: ID! $personTagId: ID! $x: Float $y: Float $tag_direction: Int ) { createFaceTag( data: { picture: $pictureId person_tag: $personTagId x: $x y: $y tag_direction: $tag_direction } ) { data { id } } } mutation createKeywordTag($name: String!) { createKeywordTag(data: { name: $name }) { data { id } } } mutation createLink($title: String! $url: String! $archive_tag: ID!) { createLink(data: { title: $title url: $url archive_tag: $archive_tag }) { data { id } } } @@ -59,6 +58,8 @@ mutation createSubCollection($name: String! $parentId: ID! $publishedAt: DateTim mutation declineComment($commentId: ID!) { deleteComment(id: $commentId) { data { id } } } mutation deleteCollection($collectionId: ID!) { deleteCollection(id: $collectionId) { data { id } } } mutation deleteExhibition($id: ID!) { deleteExhibition(id: $id) { data { id } } } +mutation deleteExhibitionPicture($id: ID!) { deleteExhibitionPicture(id: $id) { data { id } } } +mutation deleteExhibitionSection($id: ID!) { deleteExhibitionSection(id: $id) { data { id } } } mutation deleteFaceTag($id: ID!) { deleteFaceTag(id: $id) { data { id } } } mutation deleteKeywordTag($id: ID!) { deleteKeywordTag(id: $id) { data { id } } } mutation deleteLink($id: ID!) { deleteLink(id: $id) { data { id } } } @@ -90,7 +91,6 @@ mutation updateCollectionParents($collectionId: ID! $parentCollectionIds: [ID]!) mutation updateExhibition($id: ID! $data: ExhibitionInput!) { updateExhibition(id: $id data: $data) { data { id } } } mutation updateExhibitionPicture($id: ID! $data: ExhibitionPictureInput!) { updateExhibitionPicture(id: $id data: $data) { data { id } } } mutation updateExhibitionSection( $id: ID! $title: String $text: String $order: Int $exhibitionPictureIds: [ID] ) { updateExhibitionSection( id: $id data: { title: $title text: $text exhibition_pictures: $exhibitionPictureIds order: $order } ) { data { id } } } -mutation updateExhibitionSource($id: ID! $source: String!) { updateExhibitionSource(id: $id data: { source: $source }) { data { id } } } mutation updateFaceTagDirection($faceTagId: ID! $tag_direction: Int) { updateFaceTag(id: $faceTagId data: { tag_direction: $tag_direction }) { data { id } } } mutation updateKeywordName($tagId: ID! $name: String!) { updateKeywordTag(id: $tagId data: { name: $name }) { data { id } } } mutation updateKeywordSynonyms($tagId: ID! $synonyms: [ComponentCommonSynonymsInput]!) { updateKeywordTag(id: $tagId data: { synonyms: $synonyms }) { data { id } } } diff --git a/projects/bp-gallery/src/graphql/schema/schema.json b/projects/bp-gallery/src/graphql/schema/schema.json index 9feb72f65..c5a46ca3f 100644 --- a/projects/bp-gallery/src/graphql/schema/schema.json +++ b/projects/bp-gallery/src/graphql/schema/schema.json @@ -7544,26 +7544,6 @@ }, "defaultValue": null }, - { - "name": "epilog", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "StringFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "exhibition_sources", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - }, - "defaultValue": null - }, { "name": "idealot_pictures", "description": null, @@ -7717,16 +7697,6 @@ }, "defaultValue": null }, - { - "name": "epilog", - "description": null, - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, { "name": "exhibition_sources", "description": null, @@ -7888,75 +7858,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "epilog", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "exhibition_sources", - "description": null, - "args": [ - { - "name": "filters", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pagination", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "PaginationArg", - "ofType": null - }, - "defaultValue": "{}" - }, - { - "name": "sort", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": "[]" - }, - { - "name": "publicationState", - "description": null, - "type": { - "kind": "ENUM", - "name": "PublicationState", - "ofType": null - }, - "defaultValue": "LIVE" - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceRelationResponseCollection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "idealot_pictures", "description": null, @@ -8922,453 +8823,88 @@ "args": [], "type": { "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "exhibition_pictures", - "description": null, - "args": [ - { - "name": "filters", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionPictureFiltersInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pagination", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "PaginationArg", - "ofType": null - }, - "defaultValue": "{}" - }, - { - "name": "sort", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": "[]" - }, - { - "name": "publicationState", - "description": null, - "type": { - "kind": "ENUM", - "name": "PublicationState", - "ofType": null - }, - "defaultValue": "LIVE" - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionPictureRelationResponseCollection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "exhibition", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExhibitionEntityResponse", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "order", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExhibitionSectionEntity", - "description": null, - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "attributes", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExhibitionSectionEntityResponse", - "description": null, - "fields": [ - { - "name": "data", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSectionEntity", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExhibitionSectionEntityResponseCollection", - "description": null, - "fields": [ - { - "name": "data", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ExhibitionSectionEntity", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "meta", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ResponseCollectionMeta", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExhibitionSectionRelationResponseCollection", - "description": null, - "fields": [ - { - "name": "data", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ExhibitionSectionEntity", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "description": null, - "fields": null, - "inputFields": [ - { - "name": "id", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "IDFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "source", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "StringFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "exhibition", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionFiltersInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "createdAt", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "DateTimeFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "updatedAt", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "DateTimeFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "publishedAt", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "DateTimeFilterInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "and", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "or", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "not", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceInput", - "description": null, - "fields": null, - "inputFields": [ - { - "name": "source", - "description": null, - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "exhibition", - "description": null, - "type": { - "kind": "SCALAR", - "name": "ID", + "name": "String", "ofType": null }, - "defaultValue": null + "isDeprecated": false, + "deprecationReason": null }, { - "name": "publishedAt", + "name": "exhibition_pictures", "description": null, + "args": [ + { + "name": "filters", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "ExhibitionPictureFiltersInput", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "pagination", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "PaginationArg", + "ofType": null + }, + "defaultValue": "{}" + }, + { + "name": "sort", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": "[]" + }, + { + "name": "publicationState", + "description": null, + "type": { + "kind": "ENUM", + "name": "PublicationState", + "ofType": null + }, + "defaultValue": "LIVE" + } + ], "type": { - "kind": "SCALAR", - "name": "DateTime", + "kind": "OBJECT", + "name": "ExhibitionPictureRelationResponseCollection", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExhibitionSource", - "description": null, - "fields": [ + "isDeprecated": false, + "deprecationReason": null + }, { - "name": "source", + "name": "exhibition", "description": null, "args": [], "type": { - "kind": "SCALAR", - "name": "String", + "kind": "OBJECT", + "name": "ExhibitionEntityResponse", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "exhibition", + "name": "order", "description": null, "args": [], "type": { - "kind": "OBJECT", - "name": "ExhibitionEntityResponse", + "kind": "SCALAR", + "name": "Int", "ofType": null }, "isDeprecated": false, @@ -9418,7 +8954,7 @@ }, { "kind": "OBJECT", - "name": "ExhibitionSourceEntity", + "name": "ExhibitionSectionEntity", "description": null, "fields": [ { @@ -9439,7 +8975,7 @@ "args": [], "type": { "kind": "OBJECT", - "name": "ExhibitionSource", + "name": "ExhibitionSection", "ofType": null }, "isDeprecated": false, @@ -9453,7 +8989,7 @@ }, { "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponse", + "name": "ExhibitionSectionEntityResponse", "description": null, "fields": [ { @@ -9462,7 +8998,7 @@ "args": [], "type": { "kind": "OBJECT", - "name": "ExhibitionSourceEntity", + "name": "ExhibitionSectionEntity", "ofType": null }, "isDeprecated": false, @@ -9476,7 +9012,7 @@ }, { "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponseCollection", + "name": "ExhibitionSectionEntityResponseCollection", "description": null, "fields": [ { @@ -9494,7 +9030,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "ExhibitionSourceEntity", + "name": "ExhibitionSectionEntity", "ofType": null } } @@ -9527,7 +9063,7 @@ }, { "kind": "OBJECT", - "name": "ExhibitionSourceRelationResponseCollection", + "name": "ExhibitionSectionRelationResponseCollection", "description": null, "fields": [ { @@ -9545,7 +9081,7 @@ "name": null, "ofType": { "kind": "OBJECT", - "name": "ExhibitionSourceEntity", + "name": "ExhibitionSectionEntity", "ofType": null } } @@ -15677,11 +15213,6 @@ "name": "ExhibitionSection", "ofType": null }, - { - "kind": "OBJECT", - "name": "ExhibitionSource", - "ofType": null - }, { "kind": "OBJECT", "name": "FaceTag", @@ -17190,86 +16721,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "exhibitionSource", - "description": null, - "args": [ - { - "name": "id", - "description": null, - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponse", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "exhibitionSources", - "description": null, - "args": [ - { - "name": "filters", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceFiltersInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pagination", - "description": null, - "type": { - "kind": "INPUT_OBJECT", - "name": "PaginationArg", - "ofType": null - }, - "defaultValue": "{}" - }, - { - "name": "sort", - "description": null, - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": "[]" - }, - { - "name": "publicationState", - "description": null, - "type": { - "kind": "ENUM", - "name": "PublicationState", - "ofType": null - }, - "defaultValue": "LIVE" - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponseCollection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "faceTag", "description": null, @@ -19108,101 +18559,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "createExhibitionSource", - "description": null, - "args": [ - { - "name": "data", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponse", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateExhibitionSource", - "description": null, - "args": [ - { - "name": "id", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "data", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "ExhibitionSourceInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponse", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteExhibitionSource", - "description": null, - "args": [ - { - "name": "id", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "ExhibitionSourceEntityResponse", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "createFaceTag", "description": null, diff --git a/projects/bp-gallery/src/shared/locales/de.json b/projects/bp-gallery/src/shared/locales/de.json index 154444a07..f664f62c4 100755 --- a/projects/bp-gallery/src/shared/locales/de.json +++ b/projects/bp-gallery/src/shared/locales/de.json @@ -620,10 +620,6 @@ "delete-title": "Möchten Sie wirklich die Geschichte \"{{exhibitionName}}\" löschen?", "new-exhibition": "Neue Geschichte" }, - "viewer": { - "epilog": "Epilog", - "sources": "Weiterführende Quellen" - }, "buttons": { "publish": "Veröffentlichen", "unPublish": "Privat stellen", @@ -647,12 +643,6 @@ "exit-sort": "Fertig sortiert", "add-section": "Neuer Abschnitt", "dropzone": "Ziehe hier Bilder hinein" - }, - "epilog": { - "title": "Epilog", - "text-placeholder": "Epilogtext", - "sources": "Quellen", - "add-source": "Quelle hinzufügen" } } }, diff --git a/projects/bp-gallery/src/types/additionalFlatTypes.ts b/projects/bp-gallery/src/types/additionalFlatTypes.ts index 67c1d4565..51ffac132 100755 --- a/projects/bp-gallery/src/types/additionalFlatTypes.ts +++ b/projects/bp-gallery/src/types/additionalFlatTypes.ts @@ -8,7 +8,6 @@ import { Exhibition, ExhibitionPicture, ExhibitionSection, - ExhibitionSource, FaceTag, KeywordTag, Link, @@ -44,16 +43,11 @@ type FlatExhibitionPictureWithoutRelations = ID & Omit<ExhibitionPicture, 'picture' | 'exhibition_section' | 'exhibition_idealot'>; type FlatExhibitionWithoutRelations = ID & - Omit< - Exhibition, - 'title_picture' | 'exhibition_sections' | 'exhibition_sources' | 'idealot_pictures' - >; + Omit<Exhibition, 'title_picture' | 'exhibition_sections' | 'idealot_pictures'>; type FlatExhibitionSectionWithoutRelations = ID & Omit<ExhibitionSection, 'exhibition' | 'exhibition_pictures'>; -type FlatExhibitionSourceWithoutRelations = ID & Omit<ExhibitionSource, 'exhibition'>; - type FlatPictureWithoutRelations = ID & Omit< Picture, @@ -106,10 +100,6 @@ export type FlatUsersPermissionsUserWithoutRelations = ID & Omit<UsersPermission export type FlatParameterizedPermissionWithoutRelations = ID & Omit<ParameterizedPermission, 'users_permissions_user' | 'archive_tag'>; -export type FlatExhibitionSource = FlatExhibitionSourceWithoutRelations & { - exhibition?: FlatExhibition; -}; - export type FlatExhibitionSection = FlatExhibitionSectionWithoutRelations & { exhibition_pictures?: FlatExhibitionPicture[]; exhibition?: FlatExhibition; @@ -124,7 +114,6 @@ export type FlatExhibitionPicture = FlatExhibitionPictureWithoutRelations & { export type FlatExhibition = FlatExhibitionWithoutRelations & { title_picture?: FlatExhibitionPicture; exhibition_sections?: FlatExhibitionSection[]; - exhibition_sources?: FlatExhibitionSource[]; idealot_pictures?: FlatExhibitionPicture[]; }; diff --git a/projects/bp-gallery/tailwind.config.cjs b/projects/bp-gallery/tailwind.config.cjs index b30afddc8..90e459343 100644 --- a/projects/bp-gallery/tailwind.config.cjs +++ b/projects/bp-gallery/tailwind.config.cjs @@ -7,7 +7,7 @@ module.exports = { theme: { extend: { gridTemplateColumns: { - 'autofit-card': 'repeat(auto-fit, minmax(20rem, 1fr))', + 'autofill-card': 'repeat(auto-fill, minmax(20rem, 1fr))', }, height: { '50vh': '50vh', diff --git a/projects/bp-gallery/yarn.lock b/projects/bp-gallery/yarn.lock index ae2125096..53dce0dfd 100755 --- a/projects/bp-gallery/yarn.lock +++ b/projects/bp-gallery/yarn.lock @@ -2165,9 +2165,9 @@ integrity sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w== "@types/node@^18.16.0": - version "18.16.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" - integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== + version "18.18.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.3.tgz#e5188135fc2909b46530c798ef49be65083be3fd" + integrity sha512-0OVfGupTl3NBFr8+iXpfZ8NR7jfFO+P1Q+IO/q0wbo02wYkP5gy36phojeYWpLQ6WAMjl+VfmqUk2YbUfp0irA== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -7088,6 +7088,11 @@ react-dropzone@^12.0.5: file-selector "^0.5.0" prop-types "^15.8.1" +react-grid-gallery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/react-grid-gallery/-/react-grid-gallery-1.0.0.tgz#31604b9488dfa75a899aa39bc8884138f0409a12" + integrity sha512-S1gr6WXBlPFVrE0x2BHuu7jhyaB61mabcMQyx+8KCgAyKzGza0WF67AfAnS9Q00aurFEq4IP8eqb2Bk5F4RAmQ== + react-html-parser@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/react-html-parser/-/react-html-parser-2.0.2.tgz#6dbe1ddd2cebc1b34ca15215158021db5fc5685e" diff --git a/projects/bp-graphql/src/DB.ts b/projects/bp-graphql/src/DB.ts index 399b534ef..403fbb12b 100644 --- a/projects/bp-graphql/src/DB.ts +++ b/projects/bp-graphql/src/DB.ts @@ -3,7 +3,6 @@ import { Exhibition, ExhibitionPicture, ExhibitionSection, - ExhibitionSource, FaceTag, Link, ParameterizedPermission, @@ -57,7 +56,6 @@ export class DB { private exhibitionLoader: Loader<Exhibition>; private exhibitionSectionLoader: Loader<ExhibitionSection>; private exhibitionPictureLoader: Loader<ExhibitionPicture>; - private exhibitionSourceLoader: Loader<ExhibitionSource>; public constructor(queries: { picture: Query<Picture>; @@ -68,7 +66,6 @@ export class DB { exhibition: Query<Exhibition>; exhibitionSection: Query<ExhibitionSection>; exhibitionPicture: Query<ExhibitionPicture>; - exhibitionSource: Query<ExhibitionSource>; }) { this.pictureLoader = new Loader(queries.picture, { archive_tag: true }); this.commentLoader = new Loader(queries.comment, { picture: true }); @@ -87,9 +84,6 @@ export class DB { this.exhibitionPictureLoader = new Loader(queries.exhibitionPicture, { exhibition_section: true, }); - this.exhibitionSourceLoader = new Loader(queries.exhibitionSource, { - exhibition: true, - }); } public async pictureToArchive(pictureId: ID) { @@ -140,16 +134,6 @@ export class DB { ); } - public async exhibitionSourceToExhibition(exhibitionSourceId: ID) { - return (await this.exhibitionSourceLoader.load(exhibitionSourceId))?.exhibition?.id; - } - - public async exhibitionSourceToArchive(exhibitionSourceId: ID) { - return await this.exhibitionToArchive( - await this.exhibitionSourceToExhibition(exhibitionSourceId) - ); - } - public async mediaToPictures(mediaId: ID) { return ( await this.pictureLoader.where({ diff --git a/projects/bp-graphql/src/db-types.ts b/projects/bp-graphql/src/db-types.ts index 4a92c7a18..6d4fb0ce5 100644 --- a/projects/bp-graphql/src/db-types.ts +++ b/projects/bp-graphql/src/db-types.ts @@ -45,7 +45,3 @@ export type ExhibitionSection = ID & { export type ExhibitionPicture = ID & { exhibition_section: Maybe<ExhibitionSection>; }; - -export type ExhibitionSource = ID & { - exhibition: Maybe<Exhibition>; -}; diff --git a/projects/bp-graphql/src/isAllowedHelpers.ts b/projects/bp-graphql/src/isAllowedHelpers.ts index 50facfeeb..f90907ba1 100644 --- a/projects/bp-graphql/src/isAllowedHelpers.ts +++ b/projects/bp-graphql/src/isAllowedHelpers.ts @@ -119,8 +119,6 @@ export const checkExhibitionSection = createCheckEntityFactory('exhibitionSectio export const checkExhibitionPicture = createCheckEntityFactory('exhibitionPictureToArchive'); -export const checkExhibitionSource = createCheckEntityFactory('exhibitionSourceToArchive'); - const equalOrBothNullish = <T>(a: Maybe<T> | undefined, b: Maybe<T> | undefined) => (a ?? null) === (b ?? null); diff --git a/projects/bp-graphql/src/operations.ts b/projects/bp-graphql/src/operations.ts index eb8f7e643..c83bbaa91 100644 --- a/projects/bp-graphql/src/operations.ts +++ b/projects/bp-graphql/src/operations.ts @@ -10,7 +10,6 @@ export { default as contact } from './operations/contact.js'; export { default as createExhibition } from './operations/createExhibition.js'; export { default as createExhibitionPicture } from './operations/createExhibitionPicture.js'; export { default as createExhibitionSection } from './operations/createExhibitionSection.js'; -export { default as createExhibitionSource } from './operations/createExhibitionSource.js'; export { default as createFaceTag } from './operations/createFaceTag.js'; export { default as createKeywordTag } from './operations/createKeywordTag.js'; export { default as createLink } from './operations/createLink.js'; @@ -23,6 +22,8 @@ export { default as createSubCollection } from './operations/createSubCollection export { default as declineComment } from './operations/declineComment.js'; export { default as deleteCollection } from './operations/deleteCollection.js'; export { default as deleteExhibition } from './operations/deleteExhibition.js'; +export { default as deleteExhibitionPicture } from './operations/deleteExhibitionPicture.js'; +export { default as deleteExhibitionSection } from './operations/deleteExhibitionSection.js'; export { default as deleteFaceTag } from './operations/deleteFaceTag.js'; export { default as deleteKeywordTag } from './operations/deleteKeywordTag.js'; export { default as deleteLink } from './operations/deleteLink.js'; @@ -90,7 +91,6 @@ export { default as updateCollectionParents } from './operations/updateCollectio export { default as updateExhibition } from './operations/updateExhibition.js'; export { default as updateExhibitionPicture } from './operations/updateExhibitionPicture.js'; export { default as updateExhibitionSection } from './operations/updateExhibitionSection.js'; -export { default as updateExhibitionSource } from './operations/updateExhibitionSource.js'; export { default as updateFaceTagDirection } from './operations/updateFaceTagDirection.js'; export { default as updateKeywordName } from './operations/updateKeywordName.js'; export { default as updateKeywordSynonyms } from './operations/updateKeywordSynonyms.js'; diff --git a/projects/bp-graphql/src/operations/createExhibitionSource.ts b/projects/bp-graphql/src/operations/deleteExhibitionPicture.ts similarity index 53% rename from projects/bp-graphql/src/operations/createExhibitionSource.ts rename to projects/bp-graphql/src/operations/deleteExhibitionPicture.ts index 11431dc01..3c4fe63f7 100644 --- a/projects/bp-graphql/src/operations/createExhibitionSource.ts +++ b/projects/bp-graphql/src/operations/deleteExhibitionPicture.ts @@ -3,10 +3,10 @@ import { checkExhibition } from '../isAllowedHelpers.js'; export default { group: 'exhibition', - isAllowed: checkExhibition('exhibitionId'), + isAllowed: checkExhibition('id'), document: graphql` - mutation createExhibitionSource($exhibitionId: ID!, $publishedAt: DateTime!) { - createExhibitionSource(data: { exhibition: $exhibitionId, publishedAt: $publishedAt }) { + mutation deleteExhibitionPicture($id: ID!) { + deleteExhibitionPicture(id: $id) { data { id } diff --git a/projects/bp-graphql/src/operations/deleteExhibitionSection.ts b/projects/bp-graphql/src/operations/deleteExhibitionSection.ts new file mode 100644 index 000000000..0da4b637f --- /dev/null +++ b/projects/bp-graphql/src/operations/deleteExhibitionSection.ts @@ -0,0 +1,16 @@ +import { Operation, graphql } from '../Operation.js'; +import { checkExhibition } from '../isAllowedHelpers.js'; + +export default { + group: 'exhibition', + isAllowed: checkExhibition('id'), + document: graphql` + mutation deleteExhibitionSection($id: ID!) { + deleteExhibitionSection(id: $id) { + data { + id + } + } + } + `, +} satisfies Operation; diff --git a/projects/bp-graphql/src/operations/getExhibition.ts b/projects/bp-graphql/src/operations/getExhibition.ts index d3be59488..f10ae6cb1 100644 --- a/projects/bp-graphql/src/operations/getExhibition.ts +++ b/projects/bp-graphql/src/operations/getExhibition.ts @@ -10,7 +10,6 @@ export default { attributes { title introduction - epilog is_published title_picture { data { @@ -107,14 +106,6 @@ export default { } } } - exhibition_sources { - data { - id - attributes { - source - } - } - } } } } diff --git a/projects/bp-graphql/src/operations/getExhibitions.ts b/projects/bp-graphql/src/operations/getExhibitions.ts index 43192a37b..118a55c90 100644 --- a/projects/bp-graphql/src/operations/getExhibitions.ts +++ b/projects/bp-graphql/src/operations/getExhibitions.ts @@ -3,7 +3,7 @@ import { Operation, graphql } from '../Operation.js'; export default { isEssential: true, document: graphql` - query getExhibitions($archiveId: ID, $sortBy: [String] = ["createdAt:desc"]) { + query getExhibitions($archiveId: ID, $sortBy: [String] = ["updatedAt:desc"]) { exhibitions(filters: { archive_tag: { id: { eq: $archiveId } } }, sort: $sortBy) { data { id diff --git a/projects/bp-graphql/src/operations/updateExhibitionSource.ts b/projects/bp-graphql/src/operations/updateExhibitionSource.ts deleted file mode 100644 index 2008cc436..000000000 --- a/projects/bp-graphql/src/operations/updateExhibitionSource.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Operation, graphql } from '../Operation.js'; -import { checkExhibitionSource } from '../isAllowedHelpers.js'; - -export default { - group: 'exhibition', - isAllowed: checkExhibitionSource('id'), - document: graphql` - mutation updateExhibitionSource($id: ID!, $source: String!) { - updateExhibitionSource(id: $id, data: { source: $source }) { - data { - id - } - } - } - `, -} satisfies Operation; diff --git a/projects/bp-strapi/schemas.d.ts b/projects/bp-strapi/schemas.d.ts index 75493f0ea..d75546df6 100644 --- a/projects/bp-strapi/schemas.d.ts +++ b/projects/bp-strapi/schemas.d.ts @@ -640,12 +640,6 @@ export interface ApiExhibitionExhibition extends CollectionTypeSchema { 'oneToMany', 'api::exhibition-section.exhibition-section' >; - epilog: RichTextAttribute; - exhibition_sources: RelationAttribute< - 'api::exhibition.exhibition', - 'oneToMany', - 'api::exhibition-source.exhibition-source' - >; idealot_pictures: RelationAttribute< 'api::exhibition.exhibition', 'oneToMany', @@ -755,40 +749,6 @@ export interface ApiExhibitionSectionExhibitionSection extends CollectionTypeSch }; } -export interface ApiExhibitionSourceExhibitionSource extends CollectionTypeSchema { - info: { - singularName: 'exhibition-source'; - pluralName: 'exhibition-sources'; - displayName: 'Exhibition_Source'; - }; - options: { - draftAndPublish: true; - }; - attributes: { - source: StringAttribute; - exhibition: RelationAttribute< - 'api::exhibition-source.exhibition-source', - 'manyToOne', - 'api::exhibition.exhibition' - >; - createdAt: DateTimeAttribute; - updatedAt: DateTimeAttribute; - publishedAt: DateTimeAttribute; - createdBy: RelationAttribute< - 'api::exhibition-source.exhibition-source', - 'oneToOne', - 'admin::user' - > & - PrivateAttribute; - updatedBy: RelationAttribute< - 'api::exhibition-source.exhibition-source', - 'oneToOne', - 'admin::user' - > & - PrivateAttribute; - }; -} - export interface ApiFaceTagFaceTag extends CollectionTypeSchema { info: { singularName: 'face-tag'; @@ -1208,7 +1168,6 @@ declare global { 'api::exhibition.exhibition': ApiExhibitionExhibition; 'api::exhibition-picture.exhibition-picture': ApiExhibitionPictureExhibitionPicture; 'api::exhibition-section.exhibition-section': ApiExhibitionSectionExhibitionSection; - 'api::exhibition-source.exhibition-source': ApiExhibitionSourceExhibitionSource; 'api::face-tag.face-tag': ApiFaceTagFaceTag; 'api::keyword-tag.keyword-tag': ApiKeywordTagKeywordTag; 'api::link.link': ApiLinkLink; diff --git a/projects/bp-strapi/src/api/exhibition-source/content-types/exhibition-source/schema.json b/projects/bp-strapi/src/api/exhibition-source/content-types/exhibition-source/schema.json deleted file mode 100644 index 6a72f16c1..000000000 --- a/projects/bp-strapi/src/api/exhibition-source/content-types/exhibition-source/schema.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "kind": "collectionType", - "collectionName": "exhibition_sources", - "info": { - "singularName": "exhibition-source", - "pluralName": "exhibition-sources", - "displayName": "Exhibition_Source" - }, - "options": { - "draftAndPublish": true - }, - "attributes": { - "source": { - "type": "string" - }, - "exhibition": { - "type": "relation", - "relation": "manyToOne", - "target": "api::exhibition.exhibition", - "inversedBy": "exhibition_sources" - } - } -} diff --git a/projects/bp-strapi/src/api/exhibition-source/controllers/exhibition-source.js b/projects/bp-strapi/src/api/exhibition-source/controllers/exhibition-source.js deleted file mode 100644 index 05525ebc3..000000000 --- a/projects/bp-strapi/src/api/exhibition-source/controllers/exhibition-source.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -/** - * exhibition-source controller - */ - -const { createCoreController } = require('@strapi/strapi').factories; - -module.exports = createCoreController('api::exhibition-source.exhibition-source'); - - diff --git a/projects/bp-strapi/src/api/exhibition-source/routes/exhibition-source.js b/projects/bp-strapi/src/api/exhibition-source/routes/exhibition-source.js deleted file mode 100644 index 57303ab18..000000000 --- a/projects/bp-strapi/src/api/exhibition-source/routes/exhibition-source.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -/** - * exhibition-source router. - */ - -const { createCoreRouter } = require('@strapi/strapi').factories; - -module.exports = createCoreRouter('api::exhibition-source.exhibition-source'); - - diff --git a/projects/bp-strapi/src/api/exhibition-source/services/exhibition-source.js b/projects/bp-strapi/src/api/exhibition-source/services/exhibition-source.js deleted file mode 100644 index 610397cc2..000000000 --- a/projects/bp-strapi/src/api/exhibition-source/services/exhibition-source.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -/** - * exhibition-source service. - */ - -const { createCoreService } = require('@strapi/strapi').factories; - -module.exports = createCoreService('api::exhibition-source.exhibition-source'); - - diff --git a/projects/bp-strapi/src/api/exhibition/content-types/exhibition/schema.json b/projects/bp-strapi/src/api/exhibition/content-types/exhibition/schema.json index 3ebbed146..43989bbb7 100644 --- a/projects/bp-strapi/src/api/exhibition/content-types/exhibition/schema.json +++ b/projects/bp-strapi/src/api/exhibition/content-types/exhibition/schema.json @@ -28,15 +28,6 @@ "target": "api::exhibition-section.exhibition-section", "mappedBy": "exhibition" }, - "epilog": { - "type": "richtext" - }, - "exhibition_sources": { - "type": "relation", - "relation": "oneToMany", - "target": "api::exhibition-source.exhibition-source", - "mappedBy": "exhibition" - }, "idealot_pictures": { "type": "relation", "relation": "oneToMany", diff --git a/projects/bp-strapi/src/parameterizedPermissions/checkAllowed.ts b/projects/bp-strapi/src/parameterizedPermissions/checkAllowed.ts index 14a3168c5..6f7ec4630 100644 --- a/projects/bp-strapi/src/parameterizedPermissions/checkAllowed.ts +++ b/projects/bp-strapi/src/parameterizedPermissions/checkAllowed.ts @@ -17,7 +17,6 @@ export const checkAllowed = async ( exhibition: strapi.db.query('api::exhibition.exhibition'), exhibitionSection: strapi.db.query('api::exhibition-section.exhibition-section'), exhibitionPicture: strapi.db.query('api::exhibition-picture.exhibition-picture'), - exhibitionSource: strapi.db.query('api::exhibition-source.exhibition-source'), }); const operation = operations[operationName]; diff --git a/projects/bp-strapi/yarn.lock b/projects/bp-strapi/yarn.lock index ecb2907f6..f7053d553 100755 --- a/projects/bp-strapi/yarn.lock +++ b/projects/bp-strapi/yarn.lock @@ -3937,9 +3937,9 @@ integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== "@types/node@^18.16.0": - version "18.16.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" - integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== + version "18.18.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.3.tgz#e5188135fc2909b46530c798ef49be65083be3fd" + integrity sha512-0OVfGupTl3NBFr8+iXpfZ8NR7jfFO+P1Q+IO/q0wbo02wYkP5gy36phojeYWpLQ6WAMjl+VfmqUk2YbUfp0irA== "@types/parse-json@^4.0.0": version "4.0.0"