web

package
v0.0.0-...-37ff17d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(ctx context.Context, db boil.ContextExecutor, user1ID string, user2ID string) error

CreateConnection assumes it's run in transaction Since connections form an undirected graph, we insert user ids in both combinations to simplify queries with a tradeoff that we need to monitor data for consistency and use twice the size needed

func DirectFeed

func DirectFeed(ctx context.Context, db boil.ContextExecutor, userData *auth.UserData) mo.Result[*FeedPage]

TODO: allow the functions to return errors, since it will allow to use panic free methods and do better error handling

func EditPost

func EditPost(c context.Context, db boil.ContextExecutor, userData *auth.UserData, postID string) mo.Result[*EditPostPage]

func ExploreFeed

func ExploreFeed(ctx context.Context, db boil.ContextExecutor, userData *auth.UserData) mo.Result[*FeedPage]

TODO: allow the functions to return errors, since it will allow to use panic free methods and do better error handling

func SinglePost

func SinglePost(c context.Context, db boil.ContextExecutor, userData *auth.UserData, postID string, editPreview bool) mo.Result[*SinglePostPage]

func UserHome

func UserHome(ctx context.Context, db boil.ContextExecutor, userData *auth.UserData, authorUsername string) mo.Result[*UserHomePage]

Types

type BasePage

type BasePage struct {
	ProjectName string
	Name        string
	User        *auth.UserData
}

func Index

func Index(c context.Context, db boil.ContextExecutor, userData *auth.UserData) *BasePage

func Write

func Write(c context.Context, db boil.ContextExecutor, userData *auth.UserData) *BasePage

type ConnectionRequest

type ConnectionRequest struct {
	Requester  *core.User
	Request    *core.UserConnectionMediationRequest
	Mediations []*MediationResult
}

type ControlsPage

type ControlsPage struct {
	*BasePage
	DirectConnections       core.UserSlice
	SecondDegreeConnections core.UserSlice
	WhitelistedConnections  core.UserSlice
	MediationRequests       []*MediationRequest
	ConnectionRequests      []*ConnectionRequest
	Drafts                  []*Draft
}

func Controls

func Controls(ctx context.Context, db boil.ContextExecutor, userData *auth.UserData) *ControlsPage

type Draft

type Draft struct {
	PostID        string
	Subject       string
	LastUpdatedAt time.Time
}

type EditPostPage

type EditPostPage struct {
	*BasePage
	PostID        string
	Input         forms.PostFormInput
	LastUpdatedAt time.Time
	IsPublished   bool
}

type FeedPage

type FeedPage struct {
	*BasePage
	Posts    []*postops.Post
	FeedType FeedType
}

func (*FeedPage) IsExplore

func (fp *FeedPage) IsExplore() bool

type FeedType

type FeedType int
const (
	FeedTypeDirect FeedType = iota
	FeedTypeExplore
)

type InvitePage

type InvitePage struct {
	*BasePage
	Invite  *core.UserInvitation
	Inviter *core.User
}

func Invite

func Invite(c context.Context, db boil.ContextExecutor, invite *core.UserInvitation, userData *auth.UserData) *InvitePage

type LoginPage

type LoginPage struct {
	*BasePage
}

func Login

func Login(c context.Context, db boil.ContextExecutor, userData *auth.UserData) *LoginPage

type MediationRequest

type MediationRequest struct {
	Requester *core.User
	Target    *core.User
	Request   *core.UserConnectionMediationRequest
}

type MediationResult

type MediationResult struct {
	Mediation *core.UserConnectionMediator
	Mediator  *core.User
}

type SettingsPage

type SettingsPage struct {
	*BasePage
	AvailableInvites int64
	UsedInvites      core.UserInvitationSlice
}

func Settings

func Settings(c context.Context, db boil.ContextExecutor, userData *auth.UserData) *SettingsPage

type SinglePostPage

type SinglePostPage struct {
	*BasePage
	Post     *postops.Post
	Comments []*postops.Comment
}

type UserHomePage

type UserHomePage struct {
	*BasePage
	Author            *core.User
	ConnectionRadius  userops.ConnectionRadius
	ConnectionAllowed bool
	MediationRequest  *core.UserConnectionMediationRequest
	Posts             []*postops.Post
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL