Skip to content

Commit

Permalink
adding venue v2 config
Browse files Browse the repository at this point in the history
  • Loading branch information
RudiThoeni committed May 28, 2024
1 parent addbab3 commit a90046c
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 0 deletions.
2 changes: 2 additions & 0 deletions databrowser/src/config/tourism/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { snowReportConfig } from './snowReport/snowReport.config';
import { sourceConfig } from './source/source.config';
import { tourismAssociationListConfig } from './tourismAssociationList/tourismAssociationList.config';
import { venueConfig } from './venue/venue.config';
import { venuev2Config } from './venuev2/venuev2.config';
import { weatherConfig } from './weather/weather.config';
import { weatherDistrictConfig } from './weatherDistrict/weatherDistrict.config';
import { weatherInfoConfig } from './weatherInfo/weatherInfo.config';
Expand All @@ -53,6 +54,7 @@ export const tourismEmbeddedDatasetConfigs = [
weatherForecastConfig,
gastronomyConfig,
venueConfig,
venuev2Config,
weatherInfoConfig,
municipalityConfig,
districtConfig,
Expand Down
19 changes: 19 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { DatasetConfig } from '../../../domain/datasets/config/types';
import { domainWithOpenApiDocument } from '../../../domain/openApi';
import { venuev2Description } from './venuev2.description';
import { venuev2Operations } from './venuev2.operations';
import { venuev2Views } from './venuev2.views';
import { venuev2Route } from './venuev2.route';

export const venuev2Config: DatasetConfig = {
source: 'embedded',
baseUrl: domainWithOpenApiDocument.tourism.baseUrl,
route: venuev2Route,
description: venuev2Description,
views: venuev2Views,
operations: venuev2Operations,
};
13 changes: 13 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.description.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { DatasetDescription } from '../../../domain/datasets/config/types';

export const venuev2Description: DatasetDescription = {
title: 'Venue V2',
subtitle:
'This dataset contains information about events and their location.',
description:
'This dataset contains events location provided by LTS such as info about a location (e.g. number of seats, number of seats for disabled people, venue, etc.) or info to book an event location (e.g. prices, room configuration, etc.). Data are accessible in AlpineBits DestinationData format.',
};
49 changes: 49 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.listView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { CellComponent } from '../../../domain/cellComponents/types';
import { ListViewConfig } from '../../../domain/datasets/config/types';
import {
imageTableCell,
titleTableCell,
sourceTableCell,
languageTableCell,
lastChangesTableCell,
publishedOnTableCell,
pushDataTableCell,
} from '../../builder/tourism';

export const venuev2ListView: ListViewConfig = {
elements: [
imageTableCell(),
titleTableCell(),
{
title: 'Category',
component: CellComponent.StringCell,
class: 'w-60',
objectMapping: { text: 'VenueCategory.0.VenueCode' },
},
{
title: 'Location',
component: CellComponent.StringCell,
class: 'w-40',
objectMapping: {
text: 'LocationInfo.MunicipalityInfo.Name.{language}',
},
},
languageTableCell(),
lastChangesTableCell(),
sourceTableCell(),
{
title: 'Source state',
component: CellComponent.StateCell,
class: 'w-40',
objectMapping: {
state: 'Active',
},
},
publishedOnTableCell(),
pushDataTableCell(),
],
};
29 changes: 29 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.operations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { Operations } from '../../../domain/datasets/config/types';
import {
extendCreateRoles,
extendDeleteRoles,
extendUpdateRoles,
ROLE_READ,
} from '../roles';

export const venuev2Operations: Operations = {
readAll: {
rolesAllowed: ROLE_READ,
},
read: {
rolesAllowed: ROLE_READ,
},
create: {
rolesAllowed: extendCreateRoles(['VenueManager', 'VenueCreate']),
},
update: {
rolesAllowed: extendUpdateRoles(['VenueManager', 'VenueUpdate']),
},
delete: {
rolesAllowed: extendDeleteRoles(['VenueManager', 'VenueDelete']),
},
};
10 changes: 10 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { DatasetRoute } from '../../../domain/datasets/config/types';

export const venuev2Route: DatasetRoute = {
domain: 'tourism',
pathSegments: ['v1', 'VenueV2'],
};
73 changes: 73 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.sharedView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { CellComponent } from '../../../domain/cellComponents/types';
import {
DetailViewConfig,
EditViewConfig,
} from '../../../domain/datasets/config/types';
import {
contactCategory,
textInfoCategory,
gpsDataCategory,
idReadOnlyCell,
imageGalleryCategory,
logoWithMainImageCells,
locationCategory,
odhTagCategory,
shortnameCell,
dataStatesSubCategory,
sourceSubCategoryWithDistinct,
licenseInfoCategory,
mappingCategory,
} from '../../builder/tourism';

export const venuev2SharedView = (): DetailViewConfig | EditViewConfig => ({
elements: [
{
name: 'Main data',
slug: 'main-data',
subcategories: [
{
name: 'General data',
properties: [shortnameCell(), ...logoWithMainImageCells()],
},
{
name: 'IDs',
properties: [idReadOnlyCell()],
},
{
name: '',
properties: [
{
title: 'Room Details',
component: CellComponent.EditRoomVenueCell,
arrayMapping: {
pathToParent: 'RoomDetails',
objectMapping: {
Shortname: 'Shortname',
Indoor: 'Indoor',
SquareMeters: 'SquareMeters',
Capacity: 'VenueSetup.0.Capacity',
SetupType: 'VenueSetup.0.VenueCode',
},
targetPropertyName: 'roomVenue',
},
},
],
},
dataStatesSubCategory(),
sourceSubCategoryWithDistinct('venue'),
],
},
textInfoCategory(),
contactCategory(),
imageGalleryCategory(),
locationCategory(),
gpsDataCategory(),
odhTagCategory('venue'),
licenseInfoCategory(),
mappingCategory(),
],
});
13 changes: 13 additions & 0 deletions databrowser/src/config/tourism/venuev2/venuev2.views.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: NOI Techpark <digital@noi.bz.it>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

import { venuev2ListView } from './venuev2.listView';
import { venuev2SharedView } from './venuev2.sharedView';

export const venuev2Views = {
table: venuev2ListView,
detail: venuev2SharedView(),
edit: venuev2SharedView(),
new: venuev2SharedView(),
};

0 comments on commit a90046c

Please sign in to comment.