...
This commit is contained in:
51
specs/models_heroledger/main/group.v
Normal file
51
specs/models_heroledger/main/group.v
Normal file
@@ -0,0 +1,51 @@
|
||||
module group
|
||||
|
||||
import freeflowuniverse.herolib.hero.models.core
|
||||
|
||||
// Group represents a collaborative or access-controlled unit within the system
|
||||
@[heap]
|
||||
pub struct Group {
|
||||
core.Base
|
||||
pub mut:
|
||||
name string // Human-readable name of the group @[index]
|
||||
description string // Detailed explanation of the group's purpose
|
||||
dnsrecords []u32 // DNSRecord IDs associated with this group (if any)
|
||||
administrators []u32 // User IDs with admin rights over the group
|
||||
config GroupConfig // Configuration settings for group behavior
|
||||
status GroupStatus // Current operational state
|
||||
visibility Visibility // Who can see this group
|
||||
created u64 // Unix timestamp when the group was created
|
||||
updated u64 // Unix timestamp when the group was last updated
|
||||
}
|
||||
|
||||
@[heap]
|
||||
pub struct UserGroupMembership {
|
||||
core.Base
|
||||
pub mut:
|
||||
user_id u32 @[index] // Reference to the user entity
|
||||
group_ids []u32 @[index] // Reference to the group entity
|
||||
}
|
||||
|
||||
// GroupConfig holds rules that govern group membership and behavior
|
||||
pub struct GroupConfig {
|
||||
pub mut:
|
||||
max_members u32 // Maximum number of users allowed
|
||||
allow_guests bool // Whether guest users (unregistered or read-only) can access
|
||||
auto_approve bool // Whether member join requests are auto-approved
|
||||
require_invite bool // Whether joining the group requires an explicit invitation
|
||||
}
|
||||
|
||||
// GroupStatus defines the lifecycle of a group
|
||||
pub enum GroupStatus {
|
||||
active
|
||||
inactive
|
||||
suspended
|
||||
archived
|
||||
}
|
||||
|
||||
// Visibility controls who can discover or view the group
|
||||
pub enum Visibility {
|
||||
public // Anyone can see and request to join
|
||||
private // Only invited users can see the group
|
||||
unlisted // Not visible in search; only accessible by direct link or DNS
|
||||
}
|
Reference in New Issue
Block a user