-
Notifications
You must be signed in to change notification settings - Fork 0
/
notification.go
33 lines (28 loc) · 1.17 KB
/
notification.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package models
import (
"github.com/google/uuid"
"time"
)
type Notification struct {
Id uuid.UUID `gorm:"column:id;primaryKey"`
Timestamp time.Time `gorm:"column:timestamp"`
NotificationType string `gorm:"column:notification_type"`
ForUsername string `gorm:"column:for_username"` // the user that the notification is for
ForUser User `gorm:"foreignKey:for_username;references:username"`
FromUsername string `gorm:"column:from_username"` // the user that created the notification by following or reposting
FromUser User `gorm:"foreignKey:from_username;references:username"`
}
type NotificationUserDTO struct {
Username string `json:"username"`
Nickname string `json:"nickname"`
ProfilePictureUrl string `json:"profilePictureUrl"`
}
type NotificationRecordDTO struct {
NotificationId string `json:"notificationId"`
Timestamp time.Time `json:"timestamp"`
NotificationType string `json:"notificationType"`
User *NotificationUserDTO `json:"user"`
}
type NotificationsResponseDTO struct {
Records []NotificationRecordDTO `json:"records"`
}