-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed the roomfinder-cronjob stub * renamed `Files` -> `File` to be consistent with other models * introduced a file-name linter and renamed all files accoridngly * reconfigured to also lint directory names * removed the redundant ios prefixes from the ios notifications directory * simplified the ios naming more
- Loading branch information
1 parent
38bede6
commit 2092d9e
Showing
74 changed files
with
137 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ jobs: | |
- run: bash server/api/installBuf.bash | ||
- name: pre-commit | ||
uses: pre-commit/[email protected] | ||
- uses: ls-lint/[email protected] | ||
with: | ||
config: .ls-lint.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ls: | ||
.dir: lowercase | ||
.pb.gw.go: snake_case | ||
.pb.go: snake_case | ||
.go: snake_case | ||
|
||
ignore: | ||
- swagger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions
20
server/backend/cron/iosNotifications.go → server/backend/cron/ios_notifications.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
package cron | ||
|
||
import ( | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/ios_device" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/ios_devices_activity_reset" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/ios_scheduled_update_log" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/ios_scheduling" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/device" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/devices_activity_reset" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/scheduled_update_log" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/scheduling" | ||
) | ||
|
||
// Starts the cron job for sending iOS notifications reuses | ||
// the APNs client (ios_apns.Service) stored in CronService | ||
// the APNs client (apns.Service) stored in CronService | ||
func (c *CronService) iosNotificationsCron() error { | ||
if !c.APNs.IsActive { | ||
return nil | ||
} | ||
|
||
repo := ios_scheduling.NewRepository(c.db) | ||
devicesRepo := ios_device.NewRepository(c.db) | ||
schedulerRepo := ios_scheduled_update_log.NewRepository(c.db) | ||
repo := scheduling.NewRepository(c.db) | ||
devicesRepo := device.NewRepository(c.db) | ||
schedulerRepo := scheduled_update_log.NewRepository(c.db) | ||
|
||
service := ios_scheduling.NewService(repo, devicesRepo, schedulerRepo, c.APNs) | ||
service := scheduling.NewService(repo, devicesRepo, schedulerRepo, c.APNs) | ||
|
||
return service.HandleScheduledCron() | ||
} | ||
|
||
// Resets the activity of all devices to 0 every day, week, month or year | ||
func (c *CronService) iosActivityReset() error { | ||
service := ios_devices_activity_reset.NewService(c.db) | ||
service := devices_activity_reset.NewService(c.db) | ||
|
||
return service.HandleScheduledActivityReset() | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
server/backend/cron/newExamResultsHook.go → server/backend/cron/new_exam_results_hook.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package backend | ||
|
||
import ( | ||
"context" | ||
|
||
pb "github.com/TUM-Dev/Campus-Backend/server/api/tumdev" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/apns" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/device" | ||
"github.com/TUM-Dev/Campus-Backend/server/backend/ios_notifications/request_response" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type IOSNotificationsService struct { | ||
DB *gorm.DB | ||
APNSToken *apns.JWTToken | ||
IsActive bool | ||
} | ||
|
||
func (s *CampusServer) GetIOSDeviceService() *device.Service { | ||
repository := device.NewRepository(s.db) | ||
|
||
return device.NewService(repository) | ||
} | ||
|
||
func (s *CampusServer) GetIOSAPNsService() *apns.Service { | ||
repository := apns.NewRepository(s.db, s.GetIOSNotificationsService().APNSToken) | ||
|
||
return apns.NewService(repository) | ||
} | ||
|
||
func (s *CampusServer) GetIOSRequestResponseService() *request_response.Service { | ||
repository := request_response.NewRepository(s.db, s.GetIOSNotificationsService().APNSToken) | ||
|
||
return request_response.NewService(repository) | ||
} | ||
|
||
func (s *CampusServer) IOSDeviceRequestResponse(_ context.Context, req *pb.IOSDeviceRequestResponseRequest) (*pb.IOSDeviceRequestResponseReply, error) { | ||
service := s.GetIOSRequestResponseService() | ||
return service.HandleDeviceRequestResponse(req, s.iOSNotificationsService.IsActive) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...tifications/ios_crypto/encryptedString.go → ..._notifications/crypto/encrypted_string.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cations/ios_device/iosDeviceRepository.go → ...nd/ios_notifications/device/repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ios_device | ||
package device | ||
|
||
import ( | ||
"errors" | ||
|
4 changes: 2 additions & 2 deletions
4
...ifications/ios_device/iosDeviceService.go → ...ckend/ios_notifications/device/service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eset/iosDevicesActivityResetRepository.go → ...ions/devices_activity_reset/repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ios_devices_activity_reset | ||
package devices_activity_reset | ||
|
||
import ( | ||
"time" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.