Skip to content

Commit

Permalink
✨ 继续适配
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed Jul 29, 2024
1 parent 8eb2409 commit 70f93b5
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 451 deletions.
12 changes: 12 additions & 0 deletions src/schemas/avatar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { z } from "zod";

const IdenticonAvatar = z.object({
type: z.literal("identicon"),
hash: z.string(),
});

const Avatar = z.union([IdenticonAvatar, z.string()]);

type Avatar = z.infer<typeof Avatar>;

export default Avatar;
24 changes: 24 additions & 0 deletions src/schemas/rank.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { z } from "zod";

const Rank = z.union([
z.literal("x"),
z.literal("u"),
z.literal("ss"),
z.literal("s+"),
z.literal("s"),
z.literal("s-"),
z.literal("a+"),
z.literal("a"),
z.literal("a-"),
z.literal("b+"),
z.literal("b"),
z.literal("b-"),
z.literal("c+"),
z.literal("c"),
z.literal("c-"),
z.literal("d+"),
z.literal("d"),
z.literal("z"),
]);

export default Rank;
9 changes: 9 additions & 0 deletions src/schemas/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { z } from "zod";
import Avatar from "./avatar";

const User = z.object({
avatar: Avatar,
name: z.string(),
});

export default User;
Loading

0 comments on commit 70f93b5

Please sign in to comment.