Refactor and improve code consistency across multiple files
- Enhanced SQL queries in `session.go` and `share.go` for clarity and consistency. - Updated comments for better understanding and maintenance. - Ensured consistent error handling and return statements across various methods.
This commit is contained in:
@@ -7,30 +7,30 @@ import (
|
||||
)
|
||||
|
||||
type DocumentShare struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
DocumentID uuid.UUID `json:"document_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Permission string `json:"permission"` // "view" or "edit"
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
CreatedBy *uuid.UUID `json:"created_by"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
DocumentID uuid.UUID `json:"document_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
Permission string `json:"permission"` // "view" or "edit"
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
CreatedBy *uuid.UUID `json:"created_by"`
|
||||
}
|
||||
|
||||
type CreateShareRequest struct {
|
||||
UserEmail string `json:"user_email" binding:"required"`
|
||||
Permission string `json:"permission" binding:"required,oneof=view edit"`
|
||||
UserEmail string `json:"user_email" binding:"required"`
|
||||
Permission string `json:"permission" binding:"required,oneof=view edit"`
|
||||
}
|
||||
|
||||
type ShareListResponse struct {
|
||||
Shares []DocumentShareWithUser `json:"shares"`
|
||||
Shares []DocumentShareWithUser `json:"shares"`
|
||||
}
|
||||
|
||||
type DocumentShareWithUser struct {
|
||||
DocumentShare
|
||||
User User `json:"user"`
|
||||
DocumentShare
|
||||
User User `json:"user"`
|
||||
}
|
||||
|
||||
// PermissionResponse represents the user's permission level for a document
|
||||
type PermissionResponse struct {
|
||||
Permission string `json:"permission"` // "view" or "edit"
|
||||
Role string `json:"role"` // "owner", "editor", or "viewer"
|
||||
Permission string `json:"permission"` // "view" or "edit"
|
||||
Role string `json:"role"` // "owner", "editor", or "viewer"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user