Add password validation

This commit is contained in:
2024-04-25 22:51:37 +07:00
commit 2e2fbdf800
51 changed files with 3526 additions and 0 deletions

28
types/models/models.go Normal file
View File

@ -0,0 +1,28 @@
package models
import "github.com/google/uuid"
type User struct {
UserID uuid.UUID `gorm:"primaryKey;not null;unique"`
Username string `gorm:"unique;not null"`
Email string `gorm:"unique;not null"`
Password string `gorm:"not null"`
}
type File struct {
ID uuid.UUID `gorm:"primaryKey;not null;unique"`
OwnerID uuid.UUID `gorm:"not null"`
Name string `gorm:"not null"`
Size int `gorm:"not null"`
Downloaded int `gorm:"not null;default=0"`
}
type FilesUploaded struct {
UploadID uuid.UUID `gorm:"primaryKey;not null;unique"`
FileID uuid.UUID `gorm:"not null"`
OwnerID uuid.UUID `gorm:"not null"`
Name string `gorm:"not null"`
Size int `gorm:"not null"`
Uploaded int `gorm:"not null;default=0"`
Done bool `gorm:"not null;default=false"`
}

46
types/types.go Normal file
View File

@ -0,0 +1,46 @@
package types
import (
"github.com/google/uuid"
"time"
)
type Message struct {
Code int
Message string
}
type User struct {
UserID uuid.UUID
Email string
Username string
Authenticated bool
}
type UserWithExpired struct {
UserID uuid.UUID
Username string
Email string
Password string
AccessAt time.Time
}
type FileInfo struct {
Name string `json:"name"`
Size int `json:"size"`
Chunk int `json:"chunk"`
}
type FileInfoUploaded struct {
Name string `json:"name"`
Size int `json:"size"`
Chunk int `json:"chunk"`
UploadedChunk int `json:"uploaded_chunk"`
}
type FileData struct {
ID string
Name string
Size string
Downloaded int
}