Update Backend
This commit is contained in:
@@ -38,8 +38,8 @@ export interface UpdateEvent {
|
||||
maxTeamMembers?: number;
|
||||
schemType?: string | null;
|
||||
publicSchemsOnly?: boolean;
|
||||
addReferee?: number[];
|
||||
removeReferee?: number[];
|
||||
addReferee?: string[];
|
||||
removeReferee?: string[];
|
||||
}
|
||||
|
||||
export class EventRepo {
|
||||
|
||||
@@ -36,11 +36,11 @@ export class PermsRepo {
|
||||
}
|
||||
}
|
||||
|
||||
public async getPerms(userId: number): Promise<UserPerms> {
|
||||
public async getPerms(userId: string): Promise<UserPerms> {
|
||||
return await fetchWithToken(this.token, `/perms/user/${userId}`).then(value => value.json()).then(UserPermsSchema.parse);
|
||||
}
|
||||
|
||||
public async setPrefix(userId: number, prefix: string): Promise<void> {
|
||||
public async setPrefix(userId: string, prefix: string): Promise<void> {
|
||||
const res = await fetchWithToken(this.token, `/perms/user/${userId}/prefix/${prefix}`, {
|
||||
method: "PUT",
|
||||
});
|
||||
@@ -50,7 +50,7 @@ export class PermsRepo {
|
||||
}
|
||||
}
|
||||
|
||||
public async addPerm(userId: number, perm: string): Promise<void> {
|
||||
public async addPerm(userId: string, perm: string): Promise<void> {
|
||||
const res = await fetchWithToken(this.token, `/perms/user/${userId}/${perm}`, {
|
||||
method: "PUT",
|
||||
});
|
||||
@@ -60,7 +60,7 @@ export class PermsRepo {
|
||||
}
|
||||
}
|
||||
|
||||
public async removePerm(userId: number, perm: string): Promise<void> {
|
||||
public async removePerm(userId: string, perm: string): Promise<void> {
|
||||
const res = await fetchWithToken(this.token, `/perms/user/${userId}/${perm}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
|
||||
@@ -18,26 +18,13 @@
|
||||
*/
|
||||
|
||||
import {fetchWithToken, tokenStore} from "./repo.ts";
|
||||
import {type Schematic, type SchematicInfo, type SchematicList, SchematicSchema} from "@type/schem.ts";
|
||||
import {SchematicInfoSchema, SchematicListSchema} from "@type/schem.ts";
|
||||
import {type Schematic, SchematicSchema} from "@type/schem.ts";
|
||||
import {derived} from "svelte/store";
|
||||
|
||||
export class SchematicRepo {
|
||||
constructor(private token: string) {
|
||||
}
|
||||
|
||||
public async getRootSchematicList(): Promise<SchematicList> {
|
||||
return await fetchWithToken(this.token, "/schem").then(value => value.json()).then(SchematicListSchema.parse);
|
||||
}
|
||||
|
||||
public async getSchematicList(id: number): Promise<SchematicList> {
|
||||
return await fetchWithToken(this.token, `/schem/${id}/list`).then(value => value.json()).then(SchematicListSchema.parse);
|
||||
}
|
||||
|
||||
public async getSchematicInfo(id: number): Promise<SchematicInfo> {
|
||||
return await fetchWithToken(this.token, `/schem/${id}`).then(value => value.json()).then(SchematicInfoSchema.parse);
|
||||
}
|
||||
|
||||
public async getSchematicCodeInfo(code: string): Promise<Schematic> {
|
||||
return await fetchWithToken(this.token, `/download/${code}/info`).then(value => value.json()).then(SchematicSchema.parse);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class StatsRepo {
|
||||
return await fetchWithToken(this.token, "/stats/fights").then(value => value.json()).then(FightStatsSchema.parse);
|
||||
}
|
||||
|
||||
public async getUserStats(id: number): Promise<UserStats> {
|
||||
public async getUserStats(id: string): Promise<UserStats> {
|
||||
return await fetchWithToken(this.token, `/stats/user/${id}`).then(value => value.json()).then(UserStatsSchema.parse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export class UserRepo {
|
||||
constructor(private token: string) {
|
||||
}
|
||||
|
||||
public async setPassword(id: number, password: string): Promise<void> {
|
||||
public async setPassword(id: string, password: string): Promise<void> {
|
||||
await fetchWithToken(this.token, `/user/${id}/admin/password`, {
|
||||
method: "PUT",
|
||||
body: password,
|
||||
|
||||
Reference in New Issue
Block a user