ultisuite-backend/internal/api/mail/account_scope_sql.go
R3D347HR4Y bd7534658a Refactor and enhance unified frontend and API features
- Updated environment configuration to unify frontend for mail and drive under a single service.
- Revised README to reflect changes in frontend setup and routing for the unified application.
- Introduced new API documentation endpoints for better accessibility of API specifications.
- Enhanced drive and mail services with improved handling of file uploads and metadata enrichment.
- Implemented new API token management features, including creation, listing, and revocation of tokens.
- Added tests for new functionalities in drive and mail services to ensure reliability and correctness.
2026-06-07 15:44:30 +02:00

27 lines
627 B
Go

package mail
import "fmt"
func appendMessageAccountScope(
baseQuery string,
args []any,
argIdx int,
accountID string,
scopedAccountIDs []string,
) (string, []any, int) {
if accountID != "" {
baseQuery += fmt.Sprintf(" AND m.account_id = $%d", argIdx)
args = append(args, accountID)
return baseQuery, args, argIdx + 1
}
if scopedAccountIDs == nil {
return baseQuery, args, argIdx
}
if len(scopedAccountIDs) == 0 {
return baseQuery + " AND FALSE", args, argIdx
}
baseQuery += fmt.Sprintf(" AND m.account_id = ANY($%d)", argIdx)
args = append(args, scopedAccountIDs)
return baseQuery, args, argIdx + 1
}