Domain block (#76)

* start work on admin domain blocking

* move stuff around + further work on domain blocks

* move + restructure processor

* prep work for deleting account

* tidy

* go fmt

* formatting

* domain blocking more work

* check domain blocks way earlier on

* progress on delete account

* delete more stuff when an account is gone

* and more...

* domain blocky block block

* get individual domain block, delete a block
This commit is contained in:
Tobi Smethurst
2021-07-05 13:23:03 +02:00
committed by GitHub
parent cf19aaf0df
commit d389e7b150
100 changed files with 3447 additions and 1419 deletions

View File

@ -29,10 +29,19 @@ import (
)
const (
// BasePath is the base API path for this module
// BasePath is the base API path for this module.
BasePath = "/api/v1/admin"
// EmojiPath is used for posting/deleting custom emojis
// EmojiPath is used for posting/deleting custom emojis.
EmojiPath = BasePath + "/custom_emojis"
// DomainBlocksPath is used for posting domain blocks.
DomainBlocksPath = BasePath + "/domain_blocks"
// DomainBlockPath is used for interacting with a single domain block.
DomainBlockPath = DomainBlocksPath + "/:" + IDKey
// ExportQueryKey is for requesting a public export of some data.
ExportQueryKey = "export"
// IDKey specifies the ID of a single item being interacted with.
IDKey = "id"
)
// Module implements the ClientAPIModule interface for admin-related actions (reports, emojis, etc)
@ -54,5 +63,9 @@ func New(config *config.Config, processor processing.Processor, log *logrus.Logg
// Route attaches all routes from this module to the given router
func (m *Module) Route(r router.Router) error {
r.AttachHandler(http.MethodPost, EmojiPath, m.emojiCreatePOSTHandler)
r.AttachHandler(http.MethodPost, DomainBlocksPath, m.DomainBlocksPOSTHandler)
r.AttachHandler(http.MethodGet, DomainBlocksPath, m.DomainBlocksGETHandler)
r.AttachHandler(http.MethodGet, DomainBlockPath, m.DomainBlockGETHandler)
r.AttachHandler(http.MethodDelete, DomainBlockPath, m.DomainBlockDELETEHandler)
return nil
}