Some Code Cleanup

This commit is contained in:
2023-12-25 21:54:40 +01:00
parent a2687083e0
commit 3108d9bf20
61 changed files with 305 additions and 247 deletions

View File

@@ -22,7 +22,7 @@ import {z} from "zod";
export const SchematicTypeSchema = z.object({
name: z.string(),
db: z.string(),
})
});
export type SchematicType = z.infer<typeof SchematicTypeSchema>;
@@ -32,7 +32,7 @@ export const PlayerSchema = z.object({
uuid: z.string(),
prefix: z.string(),
perms: z.array(z.string()),
})
});
export type Player = z.infer<typeof PlayerSchema>;
@@ -48,6 +48,6 @@ export const ServerSchema = z.object({
protocol: z.number()
}),
favicon: z.string().optional()
})
});
export type Server = z.infer<typeof ServerSchema>;

View File

@@ -26,7 +26,7 @@ export const ShortEventSchema = z.object({
name: z.string(),
start: z.number(),
end: z.number(),
})
});
export type ShortEvent = z.infer<typeof ShortEventSchema>;
@@ -36,7 +36,7 @@ export const SWEventSchema = ShortEventSchema.extend({
schemType: z.string().nullable(),
publicSchemsOnly: z.boolean(),
spectateSystem: z.boolean(),
})
});
export type SWEvent = z.infer<typeof SWEventSchema>;
@@ -50,7 +50,7 @@ export const EventFightSchema = z.object({
start: z.number(),
ergebnis: z.number(),
group: z.string().nullable(),
})
});
export type EventFight = z.infer<typeof EventFightSchema>;
@@ -58,6 +58,6 @@ export const ExtendedEventSchema = z.object({
event: SWEventSchema,
teams: z.array(TeamSchema),
fights: z.array(EventFightSchema),
})
});
export type ExtendedEvent = z.infer<typeof ExtendedEventSchema>;

View File

@@ -29,7 +29,7 @@ export const ListPageSchema = z.object({
export type ListPage = z.infer<typeof ListPageSchema>;
export const PageListSchema = z.array(ListPageSchema)
export const PageListSchema = z.array(ListPageSchema);
export type PageList = z.infer<typeof PageListSchema>;
@@ -41,7 +41,7 @@ export const PageSchema = z.object({
content: z.string(),
size: z.number().gte(0),
id: z.number().positive()
})
});
export type Page = z.infer<typeof PageSchema>;

View File

@@ -23,20 +23,20 @@ export const PrefixSchema = z.object({
name: z.string().startsWith("PREFIX_"),
colorCode: z.string().length(2).startsWith("§"),
chatPrefix: z.string()
})
});
export type Prefix = z.infer<typeof PrefixSchema>;
export const PermsSchema = z.object({
perms: z.array(z.string()),
prefixes: z.record(PrefixSchema),
})
});
export type Perms = z.infer<typeof PermsSchema>;
export const UserPermsSchema = z.object({
prefix: PrefixSchema,
perms: z.array(z.string()),
})
});
export type UserPerms = z.infer<typeof UserPermsSchema>;

View File

@@ -30,7 +30,7 @@ export const SchematicSchema = z.object({
rank: z.number(),
replaceColor: z.boolean(),
allowReplay: z.boolean()
})
});
export type Schematic = z.infer<typeof SchematicSchema>
@@ -41,7 +41,7 @@ export const SchematicListSchema = z.object({
})),
schematics: z.array(SchematicSchema),
players: z.record(z.string(), PlayerSchema)
})
});
export type SchematicList = z.infer<typeof SchematicListSchema>
@@ -49,7 +49,7 @@ export const SchematicInfoSchema = z.object({
members: z.array(PlayerSchema),
path: z.string(),
schem: SchematicSchema
})
});
export type SchematicInfo = z.infer<typeof SchematicInfoSchema>
@@ -57,6 +57,6 @@ export const SchematicCodeSchema = z.object({
id: z.number().gte(0),
code: z.string(),
expires: z.number().positive()
})
});
export type SchematicCode = z.infer<typeof SchematicCodeSchema>

View File

@@ -22,7 +22,7 @@ import {z} from "zod";
export const RankingSchema = z.array(z.object({
name: z.string(),
elo: z.number(),
}))
}));
export type Ranking = z.infer<typeof RankingSchema>;
@@ -30,7 +30,7 @@ export const FightStatsSchema = z.array(z.object({
date: z.string(),
gamemode: z.string(),
count: z.number(),
}))
}));
export type FightStats = z.infer<typeof FightStatsSchema>;
@@ -40,6 +40,6 @@ export const UserStatsSchema = z.object({
acceptedSchematics: z.number(),
fights: z.number(),
playtime: z.number()
})
});
export type UserStats = z.infer<typeof UserStatsSchema>;

View File

@@ -24,8 +24,6 @@ export const TeamSchema = z.object({
name: z.string(),
kuerzel: z.string().min(1).max(4),
color: z.string().max(1),
})
});
export type Team = z.infer<typeof TeamSchema>;