Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r/boards] initialize primary structs #3138

Open
7 tasks
salmad3 opened this issue Nov 17, 2024 · 0 comments
Open
7 tasks

[r/boards] initialize primary structs #3138

salmad3 opened this issue Nov 17, 2024 · 0 comments

Comments

@salmad3
Copy link
Member

salmad3 commented Nov 17, 2024

Context:

Threads and posts are core components of r/boards. Defining these structs establishes a consistent model for content management and supports features such as thread creation, post handling, and moderation. These structs should integrate with the Permissions interface to enable role-based actions.

Acceptance Criteria:

  • Defines the Thread struct with attributes for board reference, creator, title, timestamp, post references, and lock status.

    Example
    type Thread struct {
        ID        int64
        BoardID   int64
        Creator   Address
        Title     string
        Timestamp time.Time
        Posts     []int64
        IsLocked  bool
    }
  • Define the Post struct with attributes for thread reference, author, content, timestamp, and moderation flags.

    Example
    type Post struct {
        ID        int64
        ThreadID  int64
        Author    Address
        Content   string
        Timestamp time.Time
        Flags     []Flag
    }
  • Implements basic methods for managing threads and posts, ensuring that:

    • Threads act as containers for posts.
    • The Post struct references the Thread it belongs to.
    • The Thread struct can maintain a list of post IDs or references.
  • Implements a LockThread() method to mark a thread as locked to prevent new posts from being added.

  • Ensures integration with Permissions for locking threads, so only users with the right roles can perform this action.

  • Ensures that the structs are placed within the r/boards realm or an appropriate package (TBD).

  • Integrates permission checks for creating and managing threads and posts using WithPermission().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant