add all models

main v1.0.2
alex 2024-09-07 13:18:20 +02:00
parent 48e8493de4
commit 5a5c08e4a0
4 changed files with 108 additions and 0 deletions

25
models/lessons.go Normal file
View File

@ -0,0 +1,25 @@
package models
import "time"
type Lesson struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
OrganizationId string `gorm:"type:varchar(36)"`
State uint8 `gorm:"type:tinyint(1)"`
Title string `gorm:"type:varchar(255)"`
ThumbnailUrl string `gorm:"type:varchar(255)"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}
type LessonContent struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
LessonId string `gorm:"type:varchar(36)"`
Page uint16 `gorm:"type:smallint(5)"` // Page number
Position uint16 `gorm:"type:smallint(5)"` // Position on the page
Type uint8 // Type of content, like text, image, video, etc
Data string `gorm:"type:text"`
CreatedAt time.Time
UpdatedAt time.Time
}

38
models/questions.go Normal file
View File

@ -0,0 +1,38 @@
package models
import "time"
type Question struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
LessonId string `gorm:"type:varchar(36)"`
Question string `gorm:"type:text"`
Likes uint16 `gorm:"type:smallint(5)"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}
type QuestionLike struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
QuestionId string `gorm:"type:varchar(36)"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}
type QuestionReply struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
QuestionId string `gorm:"type:varchar(36)"`
Reply string `gorm:"type:text"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}
type QuestionReplyLike struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
QuestionReplyId string `gorm:"type:varchar(36)"`
CreatorUserId string `gorm:"type:varchar(36)"`
CreatedAt time.Time
UpdatedAt time.Time
}

14
models/roles.go Normal file
View File

@ -0,0 +1,14 @@
package models
type Role struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
OrganizationId string `gorm:"type:varchar(36)"`
Master bool `gorm:"type:tinyint(1)"`
Name string `gorm:"type:varchar(255)"`
}
type RolePermission struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
RoleId string `gorm:"type:varchar(36)"`
Permission uint16 `gorm:"type:smallint"`
}

31
models/users.go Normal file
View File

@ -0,0 +1,31 @@
package models
import "time"
type User struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
OrganizationId string `gorm:"type:varchar(36)"`
State uint8 `gorm:"type:tinyint(1)"`
Active bool `gorm:"type:tinyint(1)"`
RoleId string `gorm:"type:varchar(36)"`
FirstName string `gorm:"type:varchar(255)"`
LastName string `gorm:"type:varchar(255)"`
Email string `gorm:"type:varchar(255)"`
Password string `gorm:"type:varchar(255)"`
ProfilePictureUrl string `gorm:"type:varchar(255)"`
LastOnlineAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
type UserSession struct {
Id string `gorm:"primaryKey;type:varchar(36)"`
UserId string `gorm:"type:varchar(36)"`
OrganizationId string `gorm:"type:varchar(36)"`
Session string `gorm:"type:varchar(36)"`
UserAgent string `gorm:"type:varchar(255)"`
ExpiresAt time.Time
LastUsedAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}