From 2de63efebdfbb07261f16817ea79df398d23cc7e Mon Sep 17 00:00:00 2001 From: Michael Tews Date: Wed, 1 Apr 2026 16:11:24 +0200 Subject: refactor: remove unnecessary code --- backend/studip/responses.go | 125 ++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 74 deletions(-) diff --git a/backend/studip/responses.go b/backend/studip/responses.go index 93fef28..244b4a3 100644 --- a/backend/studip/responses.go +++ b/backend/studip/responses.go @@ -2,66 +2,64 @@ package studip import "time" +type Meta struct { + Page Page +} + +type Page struct { + Offset int `json:"offset"` + Limit int `json:"limit"` + Total int `json:"total"` +} + +type Links struct { + First string `json:"first"` + Last string `json:"last"` +} + type StudIPFolders struct { - Meta struct { - Page struct { - Offset int `json:"offset"` - Limit int `json:"limit"` - Total int `json:"total"` - } `json:"page"` - } `json:"meta"` + Meta Meta Data []StudIPFoldersData `json:"data"` } +type Attributes struct { + FolderType string `json:"folder-type"` + Name string `json:"name"` + Description string `json:"description"` + Mkdate time.Time `json:"mkdate"` + Chdate time.Time `json:"chdate"` + IsVisible bool `json:"is-visible"` + IsReadable bool `json:"is-readable"` + IsWritable bool `json:"is-writable"` + IsEditable bool `json:"is-editable"` + IsEmpty bool `json:"is-empty"` + IsSubfolderAllowed bool `json:"is-subfolder-allowed"` + Downloads int `json:"downloads"` + Filesize int64 `json:"filesize"` + MimeType string `json:"mime-type"` + CourseNumber string `json:"course-number"` + Title string `json:"title"` + CourseType int `json:"course-type"` + CourseTypeText string `json:"course-type-text"` + Dates string `json:"dates"` + IsDownloadable bool `json:"is-downloadable"` +} + type StudIPFoldersData struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes struct { - FolderType string `json:"folder-type"` - Name string `json:"name"` - Description string `json:"description"` - Mkdate time.Time `json:"mkdate"` - Chdate time.Time `json:"chdate"` - IsVisible bool `json:"is-visible"` - IsReadable bool `json:"is-readable"` - IsWritable bool `json:"is-writable"` - IsEditable bool `json:"is-editable"` - IsEmpty bool `json:"is-empty"` - IsSubfolderAllowed bool `json:"is-subfolder-allowed"` - } `json:"attributes"` + Type string `json:"type"` + ID string `json:"id"` + Attributes Attributes Relationships struct { Parent StudIPRelationship `json:"parent"` } `json:"relationships"` } type StudIPFiles struct { - Meta struct { - Page struct { - Offset int `json:"offset"` - Limit int `json:"limit"` - Total int `json:"total"` - } `json:"page"` - } `json:"meta"` - Links struct { - First string `json:"first"` - Last string `json:"last"` - } `json:"links"` - Data []struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes struct { - Name string `json:"name"` - Description string `json:"description"` - Mkdate time.Time `json:"mkdate"` - Chdate time.Time `json:"chdate"` - Downloads int `json:"downloads"` - Filesize int64 `json:"filesize"` - MimeType string `json:"mime-type"` - IsReadable bool `json:"is-readable"` - IsDownloadable bool `json:"is-downloadable"` - IsEditable bool `json:"is-editable"` - IsWritable bool `json:"is-writable"` - } `json:"attributes"` + Meta Meta + Links Links + Data []struct { + StudIPResourceIdentifier + Attributes Attributes } `json:"data"` } @@ -79,21 +77,8 @@ type StudIPNullableRelationship struct { } type StudIPFileRefData struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes struct { - Name string `json:"name"` - Description string `json:"description"` - Mkdate time.Time `json:"mkdate"` - Chdate time.Time `json:"chdate"` - Downloads int `json:"downloads"` - Filesize int64 `json:"filesize"` - MimeType string `json:"mime-type"` - IsReadable bool `json:"is-readable"` - IsDownloadable bool `json:"is-downloadable"` - IsEditable bool `json:"is-editable"` - IsWritable bool `json:"is-writable"` - } `json:"attributes"` + StudIPResourceIdentifier + Attributes Attributes Relationships struct { File StudIPRelationship `json:"file"` Parent StudIPRelationship `json:"parent"` @@ -107,15 +92,7 @@ type StudIPFileRef struct { type StudIPCourses struct { Data struct { - Type string `json:"type"` - ID string `json:"id"` - Attributes struct { - CourseNumber string `json:"course-number"` - Title string `json:"title"` - CourseType int `json:"course-type"` - CourseTypeText string `json:"course-type-text"` - Description string `json:"description"` - Dates string `json:"dates"` - } `json:"attributes"` + StudIPResourceIdentifier + Attributes Attributes } `json:"data"` } -- cgit v1.0