fix(frontend,backend): move bulk-delete endpoint to standalone websites route

- Move bulk-delete endpoint from `/targets/:id/websites/bulk-delete` to `/websites/bulk-delete`
- Update frontend WebsiteService to use new standalone endpoint path
- Update Go backend router configuration to register bulk-delete under standalone websites routes
- Update handler documentation to reflect correct endpoint path
- Simplifies API structure by treating bulk operations as standalone website operations rather than target-scoped
This commit is contained in:
yyhuni
2026-01-12 22:16:34 +08:00
parent ed80772e6f
commit 9e01a6aa5e
3 changed files with 4 additions and 4 deletions

View File

@@ -18,11 +18,11 @@ export interface BulkDeleteResponse {
export class WebsiteService {
/**
* Bulk delete websites
* POST /api/assets/websites/bulk-delete/
* POST /api/websites/bulk-delete/
*/
static async bulkDelete(ids: number[]): Promise<BulkDeleteResponse> {
const response = await api.post<BulkDeleteResponse>(
`/assets/websites/bulk-delete/`,
`/websites/bulk-delete/`,
{ ids }
)
return response.data

View File

@@ -200,11 +200,11 @@ func main() {
protected.GET("/targets/:id/websites", websiteHandler.List)
protected.GET("/targets/:id/websites/export", websiteHandler.Export)
protected.POST("/targets/:id/websites/bulk-create", websiteHandler.BulkCreate)
protected.POST("/targets/:id/websites/bulk-delete", websiteHandler.BulkDelete)
// Websites (standalone)
protected.GET("/websites/:id", websiteHandler.GetByID)
protected.DELETE("/websites/:id", websiteHandler.Delete)
protected.POST("/websites/bulk-delete", websiteHandler.BulkDelete)
// Engines
protected.POST("/engines", engineHandler.Create)

View File

@@ -131,7 +131,7 @@ func (h *WebsiteHandler) Delete(c *gin.Context) {
}
// BulkDelete deletes multiple websites by IDs
// POST /api/targets/:id/websites/bulk-delete
// POST /api/websites/bulk-delete
func (h *WebsiteHandler) BulkDelete(c *gin.Context) {
var req dto.BulkDeleteRequest
if !dto.BindJSON(c, &req) {