goodidea

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

README

Good Idea

Good Idea is a slightly fancier TODO app where anonymous users may submit requests and vote on their importance. Users do not need to login or create an account to make a request or cast votes.

Requirements
  • Postgresql Database
  • environment variable DATABASE_URL to point the server at the database
Dev Requirements
  • go 1.21+
  • node.js 18+

Build

  1. Build and minify CSS and JS with: npm install && npm run build
  2. Build the server binary with go build ./app/main.go

To make it easy, use make to build

make build

which will populate the static directory and build a binary called server

Status

warning This project is in beta

Deployment

For deployment information, please see the project wiki

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *pgxpool.Pool
)
View Source
var (
	Logr *slog.Logger
)

Functions

func Connect

func Connect() error

func NewServer

func NewServer() *mux.Router

func SetupLogger

func SetupLogger()

Types

type Comment

type Comment struct {
	//Unique ID for this post
	ID uint64 `json:"id"`
	//The foreign key back to the tasks
	TaskID uint32 `json:"taskId"`
	//Optionally the person can leave a username
	User *string `json:"user"`
	//The comment box
	Content string `json:"comment"`
	//The time the comment was created
	CreatedAt time.Time `json:"createdAt"`
}

type ControllerError

type ControllerError struct {
	//Msg is a string field to capture a custom error message
	Msg string `json:"msg"`
	//Func is the name of the function the error occured in
	Func string `json:"func"`
	//Reason is a longer explication of what happened, could be a message from library
	Reason string `json:"reason"`
	//Cause is a pointer to why this error is being raised, e.g, error from sub functions
	Cause *ControllerError `json:"cause"`
}

ControllerError - An error with nested response

func (*ControllerError) Error

func (e *ControllerError) Error() string

type FileManager

type FileManager interface {
	StoreFile(b []byte, ext string) (string, error)
}

func NewFileManager

func NewFileManager() FileManager

type Task

type Task struct {
	ID          uint32     `json:"id"`
	Status      bool       `json:"status"`
	Title       string     `json:"title"`
	Body        *string    `json:"body"`
	Score       int32      `json:"score"`
	CompletedAt *time.Time `json:"completedAt"`
	CreatedAt   time.Time  `json:"createdAt"`
	DeletedAt   time.Time  `json:"deletedAt"`
	Comments    []Comment  `json:"comments"`
	Images      []string   `json:"images"` //paths to get all of the images associated with task
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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