@fabriktor/fx 0.0.192 → 0.0.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InUser, type User } from "@fabriktor/schema";
|
|
2
2
|
export type UserCardInput = Pick<InUser, "bio" | "urls" | "show_as_company" | "banner_id" | "banner_preview">;
|
|
3
|
-
export type UserCardIdentity = Pick<User, "id" | "username" | "full_name" | "company_name"> & Partial<Pick<User, "show_as_company">>;
|
|
3
|
+
export type UserCardIdentity = Pick<User, "id" | "username" | "full_name" | "company_name"> & Partial<Pick<User, "account_identity" | "show_as_company">>;
|
|
4
4
|
export type BannerFrame = {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZeroID, HTTPSScheme, UserURLHostPattern, UserBioMaxLength, UserURLsMaxCount, UserURLMaxLength, UserBannerMaxBytes, UserBannerWidth, UserBannerHeight, } from "@fabriktor/schema";
|
|
1
|
+
import { ZeroID, HTTPSScheme, UserURLHostPattern, UserBioMaxLength, UserURLsMaxCount, UserURLMaxLength, UserBannerMaxBytes, UserBannerWidth, UserBannerHeight, UserTypeEmployer, } from "@fabriktor/schema";
|
|
2
2
|
import { errValidation } from "../core/err.js";
|
|
3
3
|
import { publicLinkURL } from "../core/links.js";
|
|
4
4
|
import { resolvedID } from "../core/id.js";
|
|
@@ -9,7 +9,7 @@ const msgBannerRequired = "A valid banner preview is required.";
|
|
|
9
9
|
export const defaultBannerFrame = { x: 0.5, y: 0.5, zoom: 1 };
|
|
10
10
|
export const bannerMaxZoom = 4;
|
|
11
11
|
export function userDisplayName(user) {
|
|
12
|
-
return ((user.show_as_company
|
|
12
|
+
return ((user.account_identity === UserTypeEmployer && user.show_as_company
|
|
13
13
|
? user.company_name?.trim()
|
|
14
14
|
: user.full_name?.trim()) ||
|
|
15
15
|
user.full_name?.trim() ||
|
|
@@ -35,6 +35,7 @@ export type UpdateUserProfileOptions = GetByUIDOptions & {
|
|
|
35
35
|
export type PublicUserProfileOptions = Parameters<UsersOperator["publicProfile"]>[0];
|
|
36
36
|
export type UpdateUserCardOptions = GetByUIDOptions & {
|
|
37
37
|
id: string;
|
|
38
|
+
account_identity: User["account_identity"];
|
|
38
39
|
in: UserCardInput;
|
|
39
40
|
signal?: AbortSignal;
|
|
40
41
|
};
|
package/dist/src/users/users.js
CHANGED
|
@@ -165,6 +165,8 @@ export class UsersFX {
|
|
|
165
165
|
}
|
|
166
166
|
async updateUserCard(opts) {
|
|
167
167
|
const input = normalizeUserCardInput(opts.in);
|
|
168
|
+
input.show_as_company =
|
|
169
|
+
opts.account_identity === UserTypeEmployer && input.show_as_company;
|
|
168
170
|
validateUserCardInput(input);
|
|
169
171
|
if (!resolvedID(opts.id) || !opts.uid.trim())
|
|
170
172
|
throw errValidation({ msg: msgProfileRequired });
|