Fix: Resolve Go and Flutter compilation errors
Go backend: - Fix WOPI models file (remove duplicate package declaration and syntax errors) - Add GetOrgMember method to database as alias for GetUserMembership - Add UpdateFileSize method to database - Remove unused net/url import from wopi_handlers.go - Fix field names in WOPI struct initializers (match JSON tags) Flutter frontend: - Remove webview_flutter import (use simpler placeholder for now) - Fix _createWOPISession to safely access SessionBloc state - Replace WebViewController usage with placeholder UI - Remove unused _generateRandomHex methods from login/signup forms - Add missing mimeType parameter to DocumentCapabilities in mock repository - Remove unused local variables in file_browser_bloc
This commit is contained in:
@@ -224,6 +224,11 @@ func (db *DB) GetUserMembership(ctx context.Context, userID, orgID uuid.UUID) (*
|
||||
return &membership, nil
|
||||
}
|
||||
|
||||
// GetOrgMember is an alias for GetUserMembership - checks if user is a member of an org
|
||||
func (db *DB) GetOrgMember(ctx context.Context, orgID, userID uuid.UUID) (*Membership, error) {
|
||||
return db.GetUserMembership(ctx, userID, orgID)
|
||||
}
|
||||
|
||||
func (db *DB) CreateOrg(ctx context.Context, ownerID uuid.UUID, name, slug string) (*Organization, error) {
|
||||
var org Organization
|
||||
err := db.QueryRowContext(ctx, `
|
||||
@@ -483,6 +488,16 @@ func (db *DB) GetFileByID(ctx context.Context, fileID uuid.UUID) (*File, error)
|
||||
return &f, nil
|
||||
}
|
||||
|
||||
// UpdateFileSize updates the size and modification time of a file
|
||||
func (db *DB) UpdateFileSize(ctx context.Context, fileID uuid.UUID, size int64) error {
|
||||
_, err := db.ExecContext(ctx, `
|
||||
UPDATE files
|
||||
SET size = $1, last_modified = NOW()
|
||||
WHERE id = $2
|
||||
`, size, fileID)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteFileByPath removes a file or folder matching path for a given org or user
|
||||
func (db *DB) DeleteFileByPath(ctx context.Context, orgID *uuid.UUID, userID *uuid.UUID, path string) error {
|
||||
var res sql.Result
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package models
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
@@ -7,16 +6,70 @@ import "time"
|
||||
// Reference: https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-wopi/4b8ffc3f-e8a6-4169-8c4e-34924ac6ae2f
|
||||
type WOPICheckFileInfoResponse struct {
|
||||
BaseFileName string `json:"BaseFileName"`
|
||||
Size int64 `json:"Size"`
|
||||
Version string `json:"Version"`
|
||||
OwnerId string `json:"OwnerId"`
|
||||
UserId string `json:"UserId"`
|
||||
UserFriendlyName string `json:"UserFriendlyName"`
|
||||
UserCanWrite bool `json:"UserCanWrite"`
|
||||
UserCanRename bool `json:"UserCanRename"`
|
||||
UserCanNotWriteRelative bool `json:"UserCanNotWriteRelative"`
|
||||
ReadOnly bool `json:"ReadOnly"`
|
||||
RestrictedWebViewOnly bool `json:"RestrictedWebViewOnly"`
|
||||
Size int64 `json:"Size"`
|
||||
Version string `json:"Version"`
|
||||
OwnerId string `json:"OwnerId"`
|
||||
UserId string `json:"UserId"`
|
||||
UserFriendlyName string `json:"UserFriendlyName"`
|
||||
UserCanWrite bool `json:"UserCanWrite"`
|
||||
UserCanRename bool `json:"UserCanRename"`
|
||||
UserCanNotWriteRelative bool `json:"UserCanNotWriteRelative"`
|
||||
ReadOnly bool `json:"ReadOnly"`
|
||||
RestrictedWebViewOnly bool `json:"RestrictedWebViewOnly"`
|
||||
UserCanCreateRelativeToFolder bool `json:"UserCanCreateRelativeToFolder"`
|
||||
EnableOwnerTermination bool `json:"EnableOwnerTermination"`
|
||||
SupportsUpdate bool `json:"SupportsUpdate"`
|
||||
SupportsCobalt bool `json:"SupportsCobalt"`
|
||||
SupportsLocks bool `json:"SupportsLocks"`
|
||||
SupportsExtendedLockLength bool `json:"SupportsExtendedLockLength"`
|
||||
SupportsGetLock bool `json:"SupportsGetLock"`
|
||||
SupportsDelete bool `json:"SupportsDelete"`
|
||||
SupportsRename bool `json:"SupportsRename"`
|
||||
SupportsRenameRelativeToFolder bool `json:"SupportsRenameRelativeToFolder"`
|
||||
SupportsFolders bool `json:"SupportsFolders"`
|
||||
SupportsScenarios []string `json:"SupportsScenarios"`
|
||||
LastModifiedTime string `json:"LastModifiedTime"`
|
||||
IsAnonymousUser bool `json:"IsAnonymousUser"`
|
||||
TimeZone string `json:"TimeZone"`
|
||||
CloseUrl string `json:"CloseUrl,omitempty"`
|
||||
EditUrl string `json:"EditUrl,omitempty"`
|
||||
ViewUrl string `json:"ViewUrl,omitempty"`
|
||||
FileSharingUrl string `json:"FileSharingUrl,omitempty"`
|
||||
DownloadUrl string `json:"DownloadUrl,omitempty"`
|
||||
}
|
||||
|
||||
// WOPIPutFileResponse represents the response to WOPI PutFile request
|
||||
type WOPIPutFileResponse struct {
|
||||
ItemVersion string `json:"ItemVersion"`
|
||||
}
|
||||
|
||||
// WOPILockInfo represents information about a file lock
|
||||
type WOPILockInfo struct {
|
||||
FileID string `json:"file_id"`
|
||||
UserID string `json:"user_id"`
|
||||
LockID string `json:"lock_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
}
|
||||
|
||||
// WOPIAccessTokenRequest represents a request to get WOPI access token
|
||||
type WOPIAccessTokenRequest struct {
|
||||
FileID string `json:"file_id"`
|
||||
}
|
||||
|
||||
// WOPIAccessTokenResponse represents a response with WOPI access token
|
||||
type WOPIAccessTokenResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
AccessTokenTTL int64 `json:"access_token_ttl"`
|
||||
BootstrapperUrl string `json:"bootstrapper_url,omitempty"`
|
||||
ClosePostMessage bool `json:"close_post_message"`
|
||||
}
|
||||
|
||||
// WOPISessionResponse represents a response for creating a WOPI session
|
||||
type WOPISessionResponse struct {
|
||||
WOPISrc string `json:"wopi_src"`
|
||||
AccessToken string `json:"access_token"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user