diff --git a/models/lessons.go b/models/lessons.go new file mode 100644 index 0000000..2afc0a1 --- /dev/null +++ b/models/lessons.go @@ -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 +} diff --git a/models/questions.go b/models/questions.go new file mode 100644 index 0000000..788e9f7 --- /dev/null +++ b/models/questions.go @@ -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 +} diff --git a/models/roles.go b/models/roles.go new file mode 100644 index 0000000..a0ecddb --- /dev/null +++ b/models/roles.go @@ -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"` +} diff --git a/models/users.go b/models/users.go new file mode 100644 index 0000000..a2b518e --- /dev/null +++ b/models/users.go @@ -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 +}