Skip to content

Commit

Permalink
Migrate admin eventgroup index
Browse files Browse the repository at this point in the history
  • Loading branch information
henrist committed Jul 13, 2024
1 parent e738203 commit 12482e9
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 320 deletions.
45 changes: 0 additions & 45 deletions frontend/src/admin/event/AdminEventService.js

This file was deleted.

74 changes: 74 additions & 0 deletions frontend/src/admin/event/admin-event.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { HttpClient } from "@angular/common/http"
import { Injectable } from "@angular/core"
import { api } from "../../api"

export interface AdminEventData {
id: number
[k: string]: any
}

@Injectable({
providedIn: "root",
})
export class AdminEventService {
constructor(private http: HttpClient) {}

query() {
return this.http.get<AdminEventData[]>(api("event"), {
params: { admin: "1" },
})
}

get(id: string) {
return this.http.get<AdminEventData>(
api(`event/${encodeURIComponent(id)}`),
{
params: { admin: "1" },
},
)
}

update(id: string, data: AdminEventData) {
return this.http.put<AdminEventData>(
api(`event/${encodeURIComponent(id)}`),
data,
{ params: { admin: "1" } },
)
}

setPublish(id: string, is_published: boolean) {
return this.http.patch<AdminEventData>(
api(`event/${encodeURIComponent(id)}`),
{
is_published,
admin: 1,
},
)
}

setSelling(id: string, is_selling: boolean) {
return this.http.patch<AdminEventData>(
api(`event/${encodeURIComponent(id)}`),
{
is_selling,
admin: 1,
},
)
}

setTicketgroupsOrder(id: string, groups) {
let data = {
admin: 1,
}

let i = 0
groups.forEach((group) => {
data[group.id] = i++
})

return this.http.post(
api(`event/${encodeURIComponent(id)}/ticketgroups_order`),
data,
)
}
}
88 changes: 0 additions & 88 deletions frontend/src/admin/eventgroup/AdminEventgroupController.js

This file was deleted.

Loading

0 comments on commit 12482e9

Please sign in to comment.