Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/users/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const getUserProfileName = ($userProfile: UserProfile) => {
return $userProfile(".user.profile .header h2").text().trim();
};

const PSEUD_SUFFIX = ", ";
export const getUserProfilePseuds = ($userProfile: UserProfile) => {
const pseuds = $userProfile("dd.pseuds a");
const pseudsArray: string[] = [];
Expand All @@ -29,7 +28,7 @@ export const getUserProfilePseuds = ($userProfile: UserProfile) => {
pseudsArray.push(decodeURI(pseud));
});
}
return pseudsArray.join(PSEUD_SUFFIX);
return pseudsArray;
};

//Trim the results to only the date:
Expand Down
1 change: 0 additions & 1 deletion src/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const getUser = async ({
return {
// We use this because capitalization might be different
username: getUserProfileName(profilePage),
// TODO: this should really be an array
pseuds: getUserProfilePseuds(profilePage),
id: getUserProfileId(profilePage),
joined: getUserProfileJoined(profilePage),
Expand Down
2 changes: 1 addition & 1 deletion tests/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("User/data", () => {
username: "astolat",
id: 8,
url: "https://archiveofourown.org/users/astolat/profile",
pseuds: "astolat, shalott, the lady of shalott",
pseuds: ["astolat", "shalott", "the lady of shalott"],
joined: "2008-09-13",
} satisfies Partial<User>);
});
Expand Down
2 changes: 1 addition & 1 deletion types/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface TagSearchResultSummary {
export interface User {
id: ArchiveId;
username: string;
pseuds: string;
pseuds: string[];
url: string;
shortUrl: string;
icon: string;
Expand Down
5 changes: 3 additions & 2 deletions types/zod/generated/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const tagSchema = z.object({
subTags: z.array(z.object({
tagName: z.string(),
parentSubTag: z.string().nullable()
}))
})),
tagsWithSameMeaning: z.array(z.string())
});

export const tagSearchTypeSchema = z.union([z.literal("fandom"), z.literal("character"), z.literal("relationship"), z.literal("freeform"), z.literal("any")]);
Expand Down Expand Up @@ -56,7 +57,7 @@ export const tagSearchResultSummarySchema = z.object({
export const userSchema = z.object({
id: archiveIdSchema,
username: z.string(),
pseuds: z.string(),
pseuds: z.array(z.string()),
url: z.string(),
shortUrl: z.string(),
icon: z.string(),
Expand Down
Loading