Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit fcbf0a8

Browse files
committed
add: unit group column to Units table
1 parent 3ca5aeb commit fcbf0a8

9 files changed

Lines changed: 168 additions & 4 deletions

File tree

apps/admin-ui/gql/gql-types.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ export type Query = {
18801880
taxPercentages?: Maybe<TaxPercentageNodeConnection>;
18811881
termsOfUse?: Maybe<TermsOfUseNodeConnection>;
18821882
unit?: Maybe<UnitNode>;
1883+
unitGroups?: Maybe<UnitGroupNodeConnection>;
18831884
units?: Maybe<UnitNodeConnection>;
18841885
user?: Maybe<UserNode>;
18851886
};
@@ -2431,6 +2432,14 @@ export type QueryUnitArgs = {
24312432
id: Scalars["ID"]["input"];
24322433
};
24332434

2435+
export type QueryUnitGroupsArgs = {
2436+
after?: InputMaybe<Scalars["String"]["input"]>;
2437+
before?: InputMaybe<Scalars["String"]["input"]>;
2438+
first?: InputMaybe<Scalars["Int"]["input"]>;
2439+
last?: InputMaybe<Scalars["Int"]["input"]>;
2440+
offset?: InputMaybe<Scalars["Int"]["input"]>;
2441+
};
2442+
24342443
export type QueryUnitsArgs = {
24352444
after?: InputMaybe<Scalars["String"]["input"]>;
24362445
before?: InputMaybe<Scalars["String"]["input"]>;
@@ -4907,6 +4916,22 @@ export type UnitGroupNodeUnitsArgs = {
49074916
serviceSector?: InputMaybe<Scalars["Decimal"]["input"]>;
49084917
};
49094918

4919+
export type UnitGroupNodeConnection = {
4920+
/** Contains the nodes in this connection. */
4921+
edges: Array<Maybe<UnitGroupNodeEdge>>;
4922+
/** Pagination data for this connection. */
4923+
pageInfo: PageInfo;
4924+
totalCount?: Maybe<Scalars["Int"]["output"]>;
4925+
};
4926+
4927+
/** A Relay edge containing a `UnitGroupNode` and its cursor. */
4928+
export type UnitGroupNodeEdge = {
4929+
/** A cursor for use in pagination */
4930+
cursor: Scalars["String"]["output"];
4931+
/** The item at the end of the edge */
4932+
node?: Maybe<UnitGroupNode>;
4933+
};
4934+
49104935
export type UnitNode = Node & {
49114936
description: Scalars["String"]["output"];
49124937
descriptionEn?: Maybe<Scalars["String"]["output"]>;
@@ -4931,6 +4956,7 @@ export type UnitNode = Node & {
49314956
shortDescriptionSv?: Maybe<Scalars["String"]["output"]>;
49324957
spaces: Array<SpaceNode>;
49334958
tprekId?: Maybe<Scalars["String"]["output"]>;
4959+
unitGroups: Array<UnitGroupNode>;
49344960
webPage: Scalars["String"]["output"];
49354961
};
49364962

@@ -5032,6 +5058,10 @@ export enum UnitOrderingChoices {
50325058
RankDesc = "rankDesc",
50335059
ReservationCountAsc = "reservationCountAsc",
50345060
ReservationCountDesc = "reservationCountDesc",
5061+
ReservationUnitsCountAsc = "reservationUnitsCountAsc",
5062+
ReservationUnitsCountDesc = "reservationUnitsCountDesc",
5063+
UnitGroupNameAsc = "unitGroupNameAsc",
5064+
UnitGroupNameDesc = "unitGroupNameDesc",
50355065
}
50365066

50375067
/** An enumeration. */
@@ -6606,6 +6636,7 @@ export type UnitsQuery = {
66066636
id: string;
66076637
nameFi?: string | null;
66086638
pk?: number | null;
6639+
unitGroups: Array<{ id: string; nameFi?: string | null }>;
66096640
reservationunitSet: Array<{ id: string; pk?: number | null }>;
66106641
} | null;
66116642
} | null>;
@@ -11001,6 +11032,10 @@ export const UnitsDocument = gql`
1100111032
id
1100211033
nameFi
1100311034
pk
11035+
unitGroups {
11036+
id
11037+
nameFi
11038+
}
1100411039
reservationunitSet {
1100511040
id
1100611041
pk

apps/admin-ui/src/component/Unit/UnitsDataLoader.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ function transformSortString(orderBy: string | null): UnitOrderingChoices[] {
7979
return [UnitOrderingChoices.NameFiAsc];
8080
case "-nameFi":
8181
return [UnitOrderingChoices.NameFiDesc];
82+
case "typeFi":
83+
return [UnitOrderingChoices.ReservationCountAsc];
84+
case "-typeFi":
85+
return [UnitOrderingChoices.ReservationCountDesc];
86+
case "unitGroup":
87+
return [UnitOrderingChoices.UnitGroupNameAsc];
88+
case "-unitGroup":
89+
return [UnitOrderingChoices.UnitGroupNameDesc];
8290
default:
8391
return [];
8492
}

apps/admin-ui/src/component/Unit/UnitsTable.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,22 @@ function getColConfig(t: TFunction, isMyUnits?: boolean): ColumnType[] {
4343
{
4444
headerName: t("Units.headings.reservationUnitCount"),
4545
key: "typeFi",
46-
isSortable: false,
46+
isSortable: true,
4747
transform: (unit: UnitType) => (
4848
<> {unit?.reservationunitSet?.length ?? 0} </>
4949
),
5050
width: "25%",
5151
},
52+
{
53+
headerName: t("Units.headings.unitGroup"),
54+
key: "unitGroup",
55+
isSortable: true,
56+
transform: (unit: UnitType) =>
57+
(unit?.unitGroups || [])
58+
.map((unitGroup) => unitGroup?.nameFi)
59+
.join(","),
60+
width: "25%",
61+
},
5262
];
5363
}
5464

apps/admin-ui/src/component/Unit/queries.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export const UNITS_QUERY = gql`
1919
id
2020
nameFi
2121
pk
22+
unitGroups {
23+
id
24+
nameFi
25+
}
2226
reservationunitSet {
2327
id
2428
pk

apps/admin-ui/src/component/my-units/MyUnitRecurringReservation/__test__/mocks.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ const unitResponse: ReservationUnitNode = {
121121
name: "service sector",
122122
},
123123
],
124+
unitGroups: [
125+
{
126+
id: "1",
127+
pk: 1,
128+
name: "unit group",
129+
nameFi: "Unit group",
130+
units: [],
131+
},
132+
],
124133
},
125134
metadataSet: {
126135
id: "1",

apps/admin-ui/src/i18n/messages.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,12 +920,12 @@ const translations: ITranslations = {
920920
descriptionLinkHref: ["https://asiointi.hel.fi/tprperhe/etusivu/"],
921921
filters: {
922922
nameLabel: ["Toimipisteen nimi"],
923-
serviceSector: ["Palvelu"],
924-
serviceSectorTag: ["Palvelu: {{value}}"],
923+
unitGroup: ["Toimipisteryhmä"],
924+
unitGroupTag: ["Toimipisteryhmä: {{value}}"],
925925
},
926926
headings: {
927927
name: ["Toimipisteen nimi"],
928-
serviceSector: ["Palvelu"],
928+
unitGroup: ["Toimipisteryhmä"],
929929
reservationUnitCount: ["Varausyksiköitä"],
930930
},
931931
},

apps/ui/gql/gql-types.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ export type Query = {
18801880
taxPercentages?: Maybe<TaxPercentageNodeConnection>;
18811881
termsOfUse?: Maybe<TermsOfUseNodeConnection>;
18821882
unit?: Maybe<UnitNode>;
1883+
unitGroups?: Maybe<UnitGroupNodeConnection>;
18831884
units?: Maybe<UnitNodeConnection>;
18841885
user?: Maybe<UserNode>;
18851886
};
@@ -2431,6 +2432,14 @@ export type QueryUnitArgs = {
24312432
id: Scalars["ID"]["input"];
24322433
};
24332434

2435+
export type QueryUnitGroupsArgs = {
2436+
after?: InputMaybe<Scalars["String"]["input"]>;
2437+
before?: InputMaybe<Scalars["String"]["input"]>;
2438+
first?: InputMaybe<Scalars["Int"]["input"]>;
2439+
last?: InputMaybe<Scalars["Int"]["input"]>;
2440+
offset?: InputMaybe<Scalars["Int"]["input"]>;
2441+
};
2442+
24342443
export type QueryUnitsArgs = {
24352444
after?: InputMaybe<Scalars["String"]["input"]>;
24362445
before?: InputMaybe<Scalars["String"]["input"]>;
@@ -4907,6 +4916,22 @@ export type UnitGroupNodeUnitsArgs = {
49074916
serviceSector?: InputMaybe<Scalars["Decimal"]["input"]>;
49084917
};
49094918

4919+
export type UnitGroupNodeConnection = {
4920+
/** Contains the nodes in this connection. */
4921+
edges: Array<Maybe<UnitGroupNodeEdge>>;
4922+
/** Pagination data for this connection. */
4923+
pageInfo: PageInfo;
4924+
totalCount?: Maybe<Scalars["Int"]["output"]>;
4925+
};
4926+
4927+
/** A Relay edge containing a `UnitGroupNode` and its cursor. */
4928+
export type UnitGroupNodeEdge = {
4929+
/** A cursor for use in pagination */
4930+
cursor: Scalars["String"]["output"];
4931+
/** The item at the end of the edge */
4932+
node?: Maybe<UnitGroupNode>;
4933+
};
4934+
49104935
export type UnitNode = Node & {
49114936
description: Scalars["String"]["output"];
49124937
descriptionEn?: Maybe<Scalars["String"]["output"]>;
@@ -4931,6 +4956,7 @@ export type UnitNode = Node & {
49314956
shortDescriptionSv?: Maybe<Scalars["String"]["output"]>;
49324957
spaces: Array<SpaceNode>;
49334958
tprekId?: Maybe<Scalars["String"]["output"]>;
4959+
unitGroups: Array<UnitGroupNode>;
49344960
webPage: Scalars["String"]["output"];
49354961
};
49364962

@@ -5032,6 +5058,10 @@ export enum UnitOrderingChoices {
50325058
RankDesc = "rankDesc",
50335059
ReservationCountAsc = "reservationCountAsc",
50345060
ReservationCountDesc = "reservationCountDesc",
5061+
ReservationUnitsCountAsc = "reservationUnitsCountAsc",
5062+
ReservationUnitsCountDesc = "reservationUnitsCountDesc",
5063+
UnitGroupNameAsc = "unitGroupNameAsc",
5064+
UnitGroupNameDesc = "unitGroupNameDesc",
50355065
}
50365066

50375067
/** An enumeration. */

packages/common/gql/gql-types.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ export type Query = {
18801880
taxPercentages?: Maybe<TaxPercentageNodeConnection>;
18811881
termsOfUse?: Maybe<TermsOfUseNodeConnection>;
18821882
unit?: Maybe<UnitNode>;
1883+
unitGroups?: Maybe<UnitGroupNodeConnection>;
18831884
units?: Maybe<UnitNodeConnection>;
18841885
user?: Maybe<UserNode>;
18851886
};
@@ -2431,6 +2432,14 @@ export type QueryUnitArgs = {
24312432
id: Scalars["ID"]["input"];
24322433
};
24332434

2435+
export type QueryUnitGroupsArgs = {
2436+
after?: InputMaybe<Scalars["String"]["input"]>;
2437+
before?: InputMaybe<Scalars["String"]["input"]>;
2438+
first?: InputMaybe<Scalars["Int"]["input"]>;
2439+
last?: InputMaybe<Scalars["Int"]["input"]>;
2440+
offset?: InputMaybe<Scalars["Int"]["input"]>;
2441+
};
2442+
24342443
export type QueryUnitsArgs = {
24352444
after?: InputMaybe<Scalars["String"]["input"]>;
24362445
before?: InputMaybe<Scalars["String"]["input"]>;
@@ -4907,6 +4916,22 @@ export type UnitGroupNodeUnitsArgs = {
49074916
serviceSector?: InputMaybe<Scalars["Decimal"]["input"]>;
49084917
};
49094918

4919+
export type UnitGroupNodeConnection = {
4920+
/** Contains the nodes in this connection. */
4921+
edges: Array<Maybe<UnitGroupNodeEdge>>;
4922+
/** Pagination data for this connection. */
4923+
pageInfo: PageInfo;
4924+
totalCount?: Maybe<Scalars["Int"]["output"]>;
4925+
};
4926+
4927+
/** A Relay edge containing a `UnitGroupNode` and its cursor. */
4928+
export type UnitGroupNodeEdge = {
4929+
/** A cursor for use in pagination */
4930+
cursor: Scalars["String"]["output"];
4931+
/** The item at the end of the edge */
4932+
node?: Maybe<UnitGroupNode>;
4933+
};
4934+
49104935
export type UnitNode = Node & {
49114936
description: Scalars["String"]["output"];
49124937
descriptionEn?: Maybe<Scalars["String"]["output"]>;
@@ -4931,6 +4956,7 @@ export type UnitNode = Node & {
49314956
shortDescriptionSv?: Maybe<Scalars["String"]["output"]>;
49324957
spaces: Array<SpaceNode>;
49334958
tprekId?: Maybe<Scalars["String"]["output"]>;
4959+
unitGroups: Array<UnitGroupNode>;
49344960
webPage: Scalars["String"]["output"];
49354961
};
49364962

@@ -5032,6 +5058,10 @@ export enum UnitOrderingChoices {
50325058
RankDesc = "rankDesc",
50335059
ReservationCountAsc = "reservationCountAsc",
50345060
ReservationCountDesc = "reservationCountDesc",
5061+
ReservationUnitsCountAsc = "reservationUnitsCountAsc",
5062+
ReservationUnitsCountDesc = "reservationUnitsCountDesc",
5063+
UnitGroupNameAsc = "unitGroupNameAsc",
5064+
UnitGroupNameDesc = "unitGroupNameDesc",
50355065
}
50365066

50375067
/** An enumeration. */

tilavaraus.graphql

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,13 @@ type Query {
26552655
"""
26562656
id: ID!
26572657
): UnitNode
2658+
unitGroups(
2659+
after: String
2660+
before: String
2661+
first: Int
2662+
last: Int
2663+
offset: Int
2664+
): UnitGroupNodeConnection
26582665
units(
26592666
after: String
26602667
before: String
@@ -5552,6 +5559,32 @@ type UnitGroupNode implements Node {
55525559
): [UnitNode!]!
55535560
}
55545561

5562+
type UnitGroupNodeConnection {
5563+
"""
5564+
Contains the nodes in this connection.
5565+
"""
5566+
edges: [UnitGroupNodeEdge]!
5567+
"""
5568+
Pagination data for this connection.
5569+
"""
5570+
pageInfo: PageInfo!
5571+
totalCount: Int
5572+
}
5573+
5574+
"""
5575+
A Relay edge containing a `UnitGroupNode` and its cursor.
5576+
"""
5577+
type UnitGroupNodeEdge {
5578+
"""
5579+
A cursor for use in pagination
5580+
"""
5581+
cursor: String!
5582+
"""
5583+
The item at the end of the edge
5584+
"""
5585+
node: UnitGroupNode
5586+
}
5587+
55555588
type UnitNode implements Node {
55565589
description: String!
55575590
descriptionEn: String
@@ -5648,6 +5681,7 @@ type UnitNode implements Node {
56485681
pk: [Int]
56495682
): [SpaceNode!]!
56505683
tprekId: String
5684+
unitGroups: [UnitGroupNode!]!
56515685
webPage: String!
56525686
}
56535687

@@ -5693,6 +5727,10 @@ enum UnitOrderingChoices {
56935727
rankDesc
56945728
reservationCountAsc
56955729
reservationCountDesc
5730+
reservationUnitsCountAsc
5731+
reservationUnitsCountDesc
5732+
unitGroupNameAsc
5733+
unitGroupNameDesc
56965734
}
56975735

56985736
"""

0 commit comments

Comments
 (0)