Categorygithub.com/HardDie/blog_engine
repository
0.0.0-20240530213540-9305a47f299d
Repository: https://github.com/harddie/blog_engine.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

API's

Login/registration user

EndpointMethodTaskBody/QueryAuthorizationImplemented
/api/v1/auth/registerPOSTRegister userusername, displayedName, password, invite[x]
/api/v1/auth/loginPOSTLoginusername, password[x]
/api/v1/auth/userGETGet information about current user+[x]
/api/v1/auth/logoutPOSTLogout active session+[x]

Invites

EndpointMethodTaskBody/QueryAuthorizationImplemented
/api/v1/invites/generateGETGenerate invite token+[x]
/api/v1/invites/revokeDELETERevoke generated invite token+[x]

Post

EndpointMethodTaskBody/QueryAuthorizationImplemented
/api/v1/postsPOSTCreate posttitle, short, body, tags, isPublised+[x]
/api/v1/postsGETGet list of posts for authorized userlimit, page, query+[x]
/api/v1/posts/:idPUTEdit posttitle, short, body, tags, isPublished+[x]
/api/v1/posts/:idGETGet publised post by id[x]
/api/v1/posts/feedGETGet list of all posts from all users (main page)page, limit, query[x]

User

EndpointMethodTaskBody/QueryAuthorizationImplemented
/api/v1/user/passwordPUTUpdate passwordoldPassword, newPassword+[x]
/api/v1/user/profilePUTUpdate user infodisplayedName, email+[x]
/api/v1/user/:idGETGet information about user[x]

Authorized user posts control (required cookie)

EndpointMethodTaskBody/QueryImplemented
/api/v1/users/:idPATCHUpdate user infopassword, displayed_name, email, image

Common RO user api's

EndpointMethodTaskBody/QueryImplemented
/api/v1/posts/:idGETGet full post
/api/v1/usersGETGet list of all users with short informationquery
/api/v1/users/:idGETGet full information about selected user
/api/v1/users/:id/postsGETGet list of all posts selected userpage, limit
/api/v1/posts/:id/commentsGETGet list of all comments selected postpage, limit, order
/api/v1/posts/:id/commentsPOSTAdd comment to selected posttext
/api/v1/posts/:id/comments/:idPATCHEdit selected commenttext

Data types

Post:

struct Post {
	ID int32
	UserID int32
	Title string
	Short string
	Body string
	Tags []string
	IsPublished bool
}

Comment:

struct Comment {
	ID int32
	UserID int32
	PostID int32
	Text string
}

User:

struct User {
	ID int32
	Username string
	DisplayedName string
	Email string
	InvitedByUser int
}

Invite:

struct InviteUser {
	ID int32
	UserID int32
	InviteHash string
	IsActivated bool
}

Session:

struct Session {
	ID int
	UserID int
	TokenHash string
}