diff --git a/apps/scoutgame/components/[path]/components/PublicBuilderProfile/PublicBuilderProfileContainer.tsx b/apps/scoutgame/components/[path]/components/PublicBuilderProfile/PublicBuilderProfileContainer.tsx
index a3d3a49cbd..84c603f847 100644
--- a/apps/scoutgame/components/[path]/components/PublicBuilderProfile/PublicBuilderProfileContainer.tsx
+++ b/apps/scoutgame/components/[path]/components/PublicBuilderProfile/PublicBuilderProfileContainer.tsx
@@ -81,8 +81,7 @@ export function PublicBuilderProfileContainer({
| null }) {
+export function Header({ user }: { user: Pick | null }) {
const router = useRouter();
const [anchorElUser, setAnchorElUser] = useState(null);
diff --git a/apps/scoutgameadmin/components/users/AddUserButton/AddUserModal.tsx b/apps/scoutgameadmin/components/users/AddUserButton/AddUserModal.tsx
index ad490cb8ff..990c424f8e 100644
--- a/apps/scoutgameadmin/components/users/AddUserButton/AddUserModal.tsx
+++ b/apps/scoutgameadmin/components/users/AddUserButton/AddUserModal.tsx
@@ -91,8 +91,8 @@ export function AddUserModal({ open, onClose, onAdd }: Props) {
Scout Game profile found
Profile:{' '}
-
- https://scoutgame.xyz/u/{user.scout.username}
+
+ https://scoutgame.xyz/u/{user.scout.path}
@@ -101,8 +101,8 @@ export function AddUserModal({ open, onClose, onAdd }: Props) {
{user.scout.farcasterId && (
Farcaster:{' '}
-
- {user.scout.username}
+
+ {user.scout.path}
)}
diff --git a/apps/scoutgameadmin/components/users/UsersDashboard.tsx b/apps/scoutgameadmin/components/users/UsersDashboard.tsx
index b272d099f5..20d4bb1be2 100644
--- a/apps/scoutgameadmin/components/users/UsersDashboard.tsx
+++ b/apps/scoutgameadmin/components/users/UsersDashboard.tsx
@@ -112,9 +112,9 @@ export function UsersDashboard({ users }: { users: ScoutGameUser[] }) {
handleSort('username')}
+ active={sortField === 'path'}
+ direction={sortField === 'path' ? sortOrder : 'asc'}
+ onClick={() => handleSort('path')}
>
Username
@@ -162,7 +162,7 @@ export function UsersDashboard({ users }: { users: ScoutGameUser[] }) {
{filteredAndSortedUsers.map((user) => (
- {user.username}
+ {user.path}
{user.id}
{user.farcasterId}
{user.builderStatus || 'N/A'}
diff --git a/apps/scoutgameadmin/lib/session/getUserFromSession.ts b/apps/scoutgameadmin/lib/session/getUserFromSession.ts
index d5e441d39a..b2b01297be 100644
--- a/apps/scoutgameadmin/lib/session/getUserFromSession.ts
+++ b/apps/scoutgameadmin/lib/session/getUserFromSession.ts
@@ -4,7 +4,7 @@ import { replaceS3Domain } from '@root/lib/utils/url';
import { getSession } from './getSession';
-export type SessionUser = Pick;
+export type SessionUser = Pick;
export async function getUserFromSession(): Promise {
const session = await getSession();
@@ -15,7 +15,7 @@ export async function getUserFromSession(): Promise {
},
select: {
id: true,
- username: true,
+ path: true,
displayName: true,
avatar: true
}
diff --git a/apps/scoutgameadmin/lib/users/getUsers.ts b/apps/scoutgameadmin/lib/users/getUsers.ts
index 2ab0a03a10..5174d688f9 100644
--- a/apps/scoutgameadmin/lib/users/getUsers.ts
+++ b/apps/scoutgameadmin/lib/users/getUsers.ts
@@ -3,12 +3,12 @@ import { prisma } from '@charmverse/core/prisma-client';
export type ScoutGameUser = Pick<
Scout,
- 'builderStatus' | 'username' | 'id' | 'avatar' | 'displayName' | 'createdAt' | 'farcasterId' | 'currentBalance'
+ 'builderStatus' | 'path' | 'id' | 'avatar' | 'displayName' | 'createdAt' | 'farcasterId' | 'currentBalance'
> & { nftsPurchased: number };
export type UserFilter = 'only-builders';
-export type SortField = 'username' | 'builderStatus' | 'currentBalance' | 'nftsPurchased' | 'createdAt';
+export type SortField = 'path' | 'builderStatus' | 'currentBalance' | 'nftsPurchased' | 'createdAt';
export type SortOrder = 'asc' | 'desc';
export async function getUsers({
@@ -31,7 +31,7 @@ export async function getUsers({
!userFid && typeof searchString === 'string'
? {
_relevance: {
- fields: ['username', 'walletAddress', 'displayName', 'email', 'id'],
+ fields: ['path', 'walletAddress', 'displayName', 'email', 'id'],
search: searchString,
sort: 'desc'
}
@@ -48,7 +48,7 @@ export async function getUsers({
? { farcasterId: userFid }
: typeof searchString === 'string'
? {
- username: {
+ path: {
contains: searchString,
mode: 'insensitive'
}
diff --git a/apps/sunnyawards/lib/blockchain/findOrCreateWalletUser.ts b/apps/sunnyawards/lib/blockchain/findOrCreateWalletUser.ts
deleted file mode 100644
index 02fad68b33..0000000000
--- a/apps/sunnyawards/lib/blockchain/findOrCreateWalletUser.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { log } from '@charmverse/core/log';
-import type { Scout } from '@charmverse/core/prisma-client';
-import { getENSDetails, getENSName } from '@root/lib/blockchain/getENSName';
-import { shortenHex } from '@root/lib/utils/blockchain';
-
-import { findOrCreateUser } from 'lib/users/findOrCreateUser';
-
-export async function findOrCreateWalletUser({
- wallet,
- newUserId
-}: {
- wallet: string;
- newUserId?: string;
-}): Promise {
- const ens = await getENSName(wallet).catch((error) => {
- log.warn('Could not retrieve ENS while creating a user', { error });
- return null;
- });
- const ensDetails = await getENSDetails(ens).catch((error) => {
- log.warn('Could not retrieve ENS details while creating a user', { error });
- });
- return findOrCreateUser({
- newUserId,
- walletENS: ens || undefined,
- avatar: ensDetails?.avatar || undefined,
- walletAddress: wallet,
- displayName: ens || shortenHex(wallet),
- username: shortenHex(wallet)
- });
-}
diff --git a/apps/sunnyawards/lib/users/findOrCreateUser.ts b/apps/sunnyawards/lib/users/findOrCreateUser.ts
deleted file mode 100644
index b3aa57627b..0000000000
--- a/apps/sunnyawards/lib/users/findOrCreateUser.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { InvalidInputError } from '@charmverse/core/errors';
-import { log } from '@charmverse/core/log';
-import type { Scout } from '@charmverse/core/prisma-client';
-import { prisma } from '@charmverse/core/prisma-client';
-import { getUserS3FilePath, uploadUrlToS3 } from '@root/lib/aws/uploadToS3Server';
-import { getENSName } from '@root/lib/blockchain/getENSName';
-import { getFilenameWithExtension } from '@root/lib/utils/getFilenameWithExtension';
-import { v4 } from 'uuid';
-
-export async function findOrCreateUser({
- newUserId,
- farcasterId,
- walletAddress,
- ...userProps
-}: {
- walletAddress?: string;
- farcasterId?: number;
- walletENS?: string;
- newUserId?: string;
- avatar?: string;
- bio?: string;
- displayName: string;
- username: string;
-}): Promise {
- if (!farcasterId && !walletAddress) {
- throw new InvalidInputError('Missing required fields for user creation');
- }
-
- const lowercaseAddress = walletAddress?.toLowerCase();
-
- const scout = await prisma.scout.findFirst({
- where: farcasterId ? { farcasterId } : { walletAddress: lowercaseAddress }
- });
-
- if (scout) {
- return scout;
- }
-
- const userId = newUserId || v4();
-
- // upload avatars in case they are hosted on IPFS
- if (userProps?.avatar) {
- const pathInS3 = getUserS3FilePath({ userId, url: getFilenameWithExtension(userProps?.avatar) });
- try {
- const { url } = await uploadUrlToS3({ pathInS3, url: userProps?.avatar });
- userProps.avatar = url;
- } catch (e) {
- log.error('Failed to save avatar', { error: e, pathInS3, url: userProps?.avatar, userId });
- throw new InvalidInputError('Failed to save avatar');
- }
- }
-
- // retrieve ENS name if wallet address is provided
-
- if (walletAddress && !userProps.walletENS) {
- const ens = await getENSName(walletAddress).catch((error) => {
- log.warn('Could not retrieve ENS while creating a user', { error });
- return null;
- });
- userProps.walletENS = ens || undefined;
- }
-
- const newScout = await prisma.scout.create({
- data: {
- ...userProps,
- id: userId,
- walletAddress: lowercaseAddress,
- farcasterId
- }
- });
-
- return newScout;
-}
diff --git a/package-lock.json b/package-lock.json
index edbb926e97..d81890d974 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29,7 +29,7 @@
"@bangle.dev/pm-commands": "^0.31.6",
"@bangle.dev/utils": "^0.31.6",
"@beam-australia/react-env": "^3.1.1",
- "@charmverse/core": "^0.92.0",
+ "@charmverse/core": "^0.92.1-rc-drop-username.0",
"@column-resizer/core": "^1.0.2",
"@datadog/browser-logs": "^4.42.2",
"@datadog/browser-rum": "^4.42.2",
@@ -7042,9 +7042,9 @@
}
},
"node_modules/@charmverse/core": {
- "version": "0.92.0",
- "resolved": "https://registry.npmjs.org/@charmverse/core/-/core-0.92.0.tgz",
- "integrity": "sha512-L9JUrayF3EpwHxV4VIWIGWB4l9tYCRbei+M9jXPS1Dqt1WM+V3WhUbcD0SuRt2kBgQ7tO1b88ENLQ7Vm7up9fg==",
+ "version": "0.92.1-rc-drop-username.0",
+ "resolved": "https://registry.npmjs.org/@charmverse/core/-/core-0.92.1-rc-drop-username.0.tgz",
+ "integrity": "sha512-37jASyTW/IuhlfJ1wL6fBCcZeimJ0NntcNEhCvNrYWuvfcDJkms6wb7S0jveO1IjdecGfZpVf5O3z6Ld7kKXdQ==",
"hasInstallScript": true,
"dependencies": {
"@datadog/browser-logs": "^4.42.2",
@@ -74792,9 +74792,9 @@
}
},
"@charmverse/core": {
- "version": "0.92.0",
- "resolved": "https://registry.npmjs.org/@charmverse/core/-/core-0.92.0.tgz",
- "integrity": "sha512-L9JUrayF3EpwHxV4VIWIGWB4l9tYCRbei+M9jXPS1Dqt1WM+V3WhUbcD0SuRt2kBgQ7tO1b88ENLQ7Vm7up9fg==",
+ "version": "0.92.1-rc-drop-username.0",
+ "resolved": "https://registry.npmjs.org/@charmverse/core/-/core-0.92.1-rc-drop-username.0.tgz",
+ "integrity": "sha512-37jASyTW/IuhlfJ1wL6fBCcZeimJ0NntcNEhCvNrYWuvfcDJkms6wb7S0jveO1IjdecGfZpVf5O3z6Ld7kKXdQ==",
"requires": {
"@datadog/browser-logs": "^4.42.2",
"@prisma/client": "^5.7.1",
diff --git a/package.json b/package.json
index 8c83634e8c..2cccb3553c 100644
--- a/package.json
+++ b/package.json
@@ -141,7 +141,7 @@
"@bangle.dev/pm-commands": "^0.31.6",
"@bangle.dev/utils": "^0.31.6",
"@beam-australia/react-env": "^3.1.1",
- "@charmverse/core": "^0.92.0",
+ "@charmverse/core": "^0.92.1-rc-drop-username.0",
"@column-resizer/core": "^1.0.2",
"@datadog/browser-logs": "^4.42.2",
"@datadog/browser-rum": "^4.42.2",
diff --git a/scripts/migrations/2024_10_29_migrateScoutPaths.ts b/scripts/migrations/2024_10_29_migrateScoutPaths.ts
index 47d7d2e4b2..3823909603 100644
--- a/scripts/migrations/2024_10_29_migrateScoutPaths.ts
+++ b/scripts/migrations/2024_10_29_migrateScoutPaths.ts
@@ -1,3 +1,4 @@
+// @ts-nocheck
import { log } from '@charmverse/core/log';
import { prisma } from '@charmverse/core/prisma-client';
diff --git a/scripts/query.ts b/scripts/query.ts
index e91bd1b0ba..73e4b2b486 100644
--- a/scripts/query.ts
+++ b/scripts/query.ts
@@ -7,7 +7,7 @@ const currentSeasonStartDate = DateTime.fromObject({ year: 2024, month: 9, day:
const currentSeason = currentSeasonStartDate.toFormat(`kkkk-'W'WW`);
async function query() {
- const w = await prisma.scout.findFirst({ where: { username: 'mattcasey' } });
+ const w = await prisma.scout.findFirst({ where: { path: 'mattcasey' } });
console.log(w);
}