Skip to content

Commit e347b07

Browse files
authoredDec 23, 2024··
refactor(library): remove library component and related localization files (#429)
1 parent 128fde8 commit e347b07

File tree

12 files changed

+1
-755
lines changed

12 files changed

+1
-755
lines changed
 

‎docs/thi-rest-api.md

-186
Original file line numberDiff line numberDiff line change
@@ -598,189 +598,3 @@ to: c
598598
"status": 0
599599
}
600600
```
601-
602-
## Reservations (library)
603-
604-
### getreservation
605-
606-
```http
607-
service: thiapp
608-
method: reservations
609-
format: json
610-
session: <session token>
611-
type: 1
612-
subtype: 1
613-
cmd: getreservation
614-
data:
615-
```
616-
617-
As of 2021-06 the API returns "Service not available" when no reservations are available
618-
619-
```json
620-
{
621-
"data": "Service not available",
622-
"date": "10.06.2021",
623-
"time": "14:23:27",
624-
"status": -112
625-
}
626-
```
627-
628-
Old response:
629-
630-
```json
631-
{
632-
"data": "No reservation data",
633-
"date": "02.11.2020",
634-
"status": -126,
635-
"time": "20:36:31"
636-
}
637-
```
638-
639-
```json
640-
{
641-
"data": [
642-
0,
643-
[
644-
{
645-
"rcategory": "Lesesaal Galerie",
646-
"reservation_begin": "2020-11-03 06:00:00",
647-
"reservation_end": "2020-11-03 10:00:00",
648-
"reservation_id": "6678",
649-
"reserved_at": "2020-11-02 20:25:50",
650-
"reserved_by": "<username>",
651-
"resource": "2",
652-
"resource_id": "3",
653-
"rsubtype": "1"
654-
}
655-
]
656-
],
657-
"date": "02.11.2020",
658-
"status": 0,
659-
"time": "20:34:29"
660-
}
661-
```
662-
663-
### addreservation
664-
665-
```http
666-
service: thiapp
667-
method: reservations
668-
format: json
669-
session: <session token>
670-
type: 1
671-
subtype: 1
672-
cmd: addreservation
673-
data: {"resource":"3","from":"06:00","to":"10:00","at":"2020-11-03","place":"-1"}
674-
```
675-
676-
```json
677-
{
678-
"data": [0, ["<reservation number>"]],
679-
"date": "02.11.2020",
680-
"status": 0,
681-
"time": "21:29:51"
682-
}
683-
```
684-
685-
### delreservation
686-
687-
```http
688-
service: thiapp
689-
method: reservations
690-
format: json
691-
session: <session token>
692-
type: 1
693-
subtype: 1
694-
cmd: delreservation
695-
data: 6678
696-
```
697-
698-
```json
699-
{
700-
"data": "No reservation data",
701-
"date": "02.11.2020",
702-
"status": -126,
703-
"time": "20:36:31"
704-
}
705-
```
706-
707-
### getavailabilities
708-
709-
```http
710-
service: thiapp
711-
method: reservations
712-
format: json
713-
session: <session token>
714-
type: 1
715-
subtype: 1
716-
cmd: getavailabilities
717-
data:
718-
```
719-
720-
parts redacted, see getavailabilities-full.json
721-
722-
```json
723-
{
724-
"date": "02.11.2020",
725-
"time": "20:37:54",
726-
"data": [
727-
0,
728-
[
729-
{
730-
"date": "2020-11-02",
731-
"hasReservation": false,
732-
"resource": [
733-
{
734-
"from": "18:00",
735-
"to": "24:00",
736-
"resources": {
737-
"1": {
738-
"room_name": "Lesesaal Nord (alte Bibliothek)",
739-
"seats": [
740-
"1",
741-
"4",
742-
"5",
743-
"8",
744-
"9",
745-
"12",
746-
"14",
747-
"16",
748-
"18",
749-
"20",
750-
"21",
751-
"24",
752-
"25",
753-
"28",
754-
"29",
755-
"32",
756-
"33",
757-
"36",
758-
"37",
759-
"40",
760-
"41",
761-
"44",
762-
"45",
763-
"48",
764-
"49",
765-
"50",
766-
"51",
767-
"52",
768-
"53",
769-
"54",
770-
"56",
771-
"57"
772-
],
773-
"num_seats": 32,
774-
"maxnum_seats": 32
775-
}
776-
// more rooms ...
777-
}
778-
}
779-
]
780-
}
781-
// more days, more times ...
782-
]
783-
],
784-
"status": 0
785-
}
786-
```

‎rogue-thi-app/components/allCards.jsx

+1-14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import InstallPrompt from './cards/InstallPrompt'
77
import RoomCard from './cards/RoomCard'
88
import TimetableCard from './cards/TimetableCard'
99

10-
import { GraduationCap, Library, Map, Scroll, User } from 'lucide-react'
10+
import { GraduationCap, Map, Scroll, User } from 'lucide-react'
1111

1212
import { USER_EMPLOYEE, USER_GUEST, USER_STUDENT } from '../lib/hooks/user-kind'
1313
// import ElectionPrompt from './cards/ElectionPrompt'
@@ -102,19 +102,6 @@ export const ALL_DASHBOARD_CARDS = [
102102
/>
103103
),
104104
},
105-
{
106-
key: 'library',
107-
removable: true,
108-
default: [PLATFORM_DESKTOP, PLATFORM_MOBILE, USER_STUDENT, USER_EMPLOYEE],
109-
card: () => (
110-
<BaseCard
111-
key="library"
112-
icon={Library}
113-
i18nKey="library"
114-
link="/library"
115-
/>
116-
),
117-
},
118105
{
119106
key: 'grades',
120107
removable: true,

‎rogue-thi-app/lib/backend-utils/library-utils.js

-26
This file was deleted.

‎rogue-thi-app/lib/backend/authenticated-api.js

-102
Original file line numberDiff line numberDiff line change
@@ -271,108 +271,6 @@ export class AuthenticatedAPIClient extends AnonymousAPIClient {
271271
return res
272272
}
273273

274-
async getLibraryReservations() {
275-
try {
276-
const res = await this.requestAuthenticated({
277-
service: 'thiapp',
278-
method: 'reservations',
279-
type: 1,
280-
cmd: 'getreservations',
281-
format: 'json',
282-
})
283-
284-
return res[1]
285-
} catch (e) {
286-
// as of 2021-06 the API returns "Service not available" when the user has no reservations
287-
// thus we dont alert the error here, but just silently set the reservations to none
288-
if (
289-
e.data === 'No reservation data' ||
290-
e.data === 'Service not available'
291-
) {
292-
return []
293-
} else {
294-
throw e
295-
}
296-
}
297-
}
298-
299-
async getAvailableLibrarySeats() {
300-
try {
301-
const res = await this.requestAuthenticated({
302-
service: 'thiapp',
303-
method: 'reservations',
304-
type: 1,
305-
subtype: 1,
306-
cmd: 'getavailabilities',
307-
format: 'json',
308-
})
309-
310-
return res[1]
311-
} catch (e) {
312-
// Unbekannter Fehler means the user has already reserved a spot
313-
// and can not reserve additional ones
314-
if (e.data === 'Unbekannter Fehler') {
315-
return []
316-
} else {
317-
throw e
318-
}
319-
}
320-
}
321-
322-
/**
323-
* TODO documentation
324-
*/
325-
async addLibraryReservation(roomId, day, start, end, place) {
326-
const res = await this.requestAuthenticated({
327-
service: 'thiapp',
328-
method: 'reservations',
329-
type: 1,
330-
subtype: 1,
331-
cmd: 'addreservation',
332-
data: JSON.stringify({
333-
resource: roomId,
334-
at: day,
335-
from: start,
336-
to: end,
337-
place,
338-
}),
339-
dblslots: 0,
340-
format: 'json',
341-
})
342-
343-
return res[0]
344-
}
345-
346-
/**
347-
* @param {string} reservationId Reservation ID returned by `getLibraryReservations`
348-
*/
349-
async removeLibraryReservation(reservationId) {
350-
try {
351-
await this.requestAuthenticated({
352-
service: 'thiapp',
353-
method: 'reservations',
354-
type: 1,
355-
subtype: 1,
356-
cmd: 'delreservation',
357-
data: reservationId,
358-
format: 'json',
359-
})
360-
361-
return true
362-
} catch (e) {
363-
// as of 2021-06 the API returns "Service not available" when the user has no reservations
364-
// thus we dont alert the error here, but just silently set the reservations to none
365-
if (
366-
e.data === 'No reservation data' ||
367-
e.data === 'Service not available'
368-
) {
369-
return true
370-
} else {
371-
throw e
372-
}
373-
}
374-
}
375-
376274
async getImprint() {
377275
const res = await this.requestAuthenticated({
378276
service: 'thiapp',

‎rogue-thi-app/pages/library.jsx

-324
This file was deleted.

‎rogue-thi-app/public/locales/de/common.json

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"events": "Campus Life",
6464
"rooms": "Raumvorschläge",
6565
"roomplan": "Raumkarte",
66-
"library": "Bibliothek",
6766
"grades": "Noten & Fächer",
6867
"personal": "Profil",
6968
"lecturers": "Dozenten",

‎rogue-thi-app/public/locales/de/dashboard.json

-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
"roomplan": {
6161
"title": "Raumkarte"
6262
},
63-
"library": {
64-
"title": "Bibliothek"
65-
},
6663
"grades": {
6764
"title": "Noten & Fächer"
6865
},

‎rogue-thi-app/public/locales/de/library.json

-39
This file was deleted.

‎rogue-thi-app/public/locales/en/common.json

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"events": "Campus Life",
6464
"rooms": "Room Suggestions",
6565
"roomplan": "Room Map",
66-
"library": "Library",
6766
"grades": "Grades & Subjects",
6867
"personal": "Profile",
6968
"lecturers": "Lecturers",

‎rogue-thi-app/public/locales/en/dashboard.json

-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060
"roomplan": {
6161
"title": "Room Map"
6262
},
63-
"library": {
64-
"title": "Library"
65-
},
6663
"grades": {
6764
"title": "Grades & Subjects"
6865
},

‎rogue-thi-app/public/locales/en/library.json

-39
This file was deleted.

‎rogue-thi-app/styles/Library.module.css

-17
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.