{"modulePath":"github.com/BaseMax/JokeGoServiceAPI","version":"v0.0.0-20261102182232-3a974a3c79b5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package models\n\n## Functions\n\n```go\nfunc CreateComment(joke_id uint, c *CommentRequest) error\n```\n\n```go\nfunc CreateJoke(j *JokeRequest) error\n```\n\n```go\nfunc DeleteComment(id uint) error\n```\n\n```go\nfunc DeleteJokeById(id uint) error\n```\n\n```go\nfunc DeleteUserByName(name string) error\n```\n\n```go\nfunc FetchAllComments(joke_id uint) (*[]CommentRequest, error)\n```\n\n```go\nfunc FetchAllJokes(limit int, page int, sort string) (*[]JokeRequest, uint, error)\n```\n\n```go\nfunc FetchJokesByAuthor(author string) (*[]JokeRequest, error)\n```\n\n```go\nfunc FetchTopRatedJokes(limit int) (*[]JokeRequest, error)\n```\n\n```go\nfunc LoginUser(u *User) error\n```\n\n```go\nfunc RegisterUser(u *User) error\n```\n\n```go\nfunc UpdateComment(id uint, c *CommentRequest) error\n```\n\n```go\nfunc UpdateJoke(id uint, j *JokeRequest) error\n```\n\n## Types\n\n```go\ntype Comment struct {\n\tID       uint   `gorm:\"primaryKey\"`\n\tContent  string `gorm:\"not null\"`\n\tJokeID   uint\n\tAuthorID uint\n\tAuthor   User\n}\n```\n\n```go\ntype CommentRequest struct {\n\tID      uint   `json:\"id\"`\n\tContent string `json:\"content\"`\n\tAuthor  string `json:\"author\"`\n}\n```\n\n```go\nfunc FetchCommentById(id uint) (*CommentRequest, error)\n```\n\n```go\ntype Joke struct {\n\tID       uint   `gorm:\"primaryKey\"`\n\tContent  string `gorm:\"not null\"`\n\tRating   uint   `gorm:\"default=0\"`\n\tAuthorID uint\n\tAuthor   User\n\tComments []Comment\n}\n```\n\n```go\ntype JokeRequest struct {\n\tID      uint   `json:\"id\"`\n\tContent string `json:\"content\"`\n\tAuthor  string `json:\"author\"`\n\tRating  uint   `json:\"rating\"`\n}\n```\n\n```go\nfunc FetchAJoke(id uint) (*JokeRequest, error)\n```\n\n```go\nfunc FetchRandomJoke() (*JokeRequest, error)\n```\n\n```go\nfunc RateJoke(id uint, rating uint) (*JokeRequest, error)\n```\n\n```go\ntype User struct {\n\tID       uint   `gorm:\"primaryKey\" json:\"id\"`\n\tUsername string `gorm:\"unique; not null\" json:\"username\"`\n\tPassword string `gorm:\"not null\" json:\"password,omitempty\"`\n\tJokes    []Joke `gorm:\"foreignKey:AuthorID\"`\n}\n```\n\n","path":"github.com/BaseMax/JokeGoServiceAPI/models","name":"models","synopsis":"","isRedistributable":true}
