Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + gno.land: a blockchain for timeless code and fair open-source.
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
```go
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
```go
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().
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 thePermissions
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
```go 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
```go 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:
Post
struct references theThread
it belongs to.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()
.