Skip to content

Commit

Permalink
remove scout.username completely (#4922)
Browse files Browse the repository at this point in the history
* remove scout.username completely

* fix display of user profile

* Fixed broken type issues

* remove unused method

* Fixed webapp scripts

* Bumped core

---------

Co-authored-by: Safwan Shaheer <[email protected]>
  • Loading branch information
mattcasey and Devorein authored Oct 30, 2024
1 parent aeb6460 commit a92595a
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export function PublicBuilderProfileContainer({
<UserProfile
user={{
...builder,
avatar: null,
path: null
avatar: null
}}
/>
<PublicBuilderStats
Expand Down
2 changes: 1 addition & 1 deletion apps/scoutgameadmin/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useState } from 'react';
import { Hidden } from 'components/common/Hidden';
import { SiteNavigation } from 'components/common/SiteNavigation';

export function Header({ user }: { user: Pick<Scout, 'username' | 'avatar'> | null }) {
export function Header({ user }: { user: Pick<Scout, 'path' | 'avatar'> | null }) {
const router = useRouter();

const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export function AddUserModal({ open, onClose, onAdd }: Props) {
<Typography variant='h6'>Scout Game profile found</Typography>
<Typography>
<span style={{ fontWeight: 'bold' }}>Profile:</span>{' '}
<Link href={`https://scoutgame.xyz/u/${user.scout.username}`} target='_blank'>
https://scoutgame.xyz/u/{user.scout.username}
<Link href={`https://scoutgame.xyz/u/${user.scout.path}`} target='_blank'>
https://scoutgame.xyz/u/{user.scout.path}
</Link>
</Typography>
<Typography>
Expand All @@ -101,8 +101,8 @@ export function AddUserModal({ open, onClose, onAdd }: Props) {
{user.scout.farcasterId && (
<Typography>
<span style={{ fontWeight: 'bold' }}>Farcaster:</span>{' '}
<Link href={`https://warpcast.com/${user.scout.username}`} target='_blank'>
{user.scout.username}
<Link href={`https://warpcast.com/${user.scout.path}`} target='_blank'>
{user.scout.path}
</Link>
</Typography>
)}
Expand Down
8 changes: 4 additions & 4 deletions apps/scoutgameadmin/components/users/UsersDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export function UsersDashboard({ users }: { users: ScoutGameUser[] }) {
<TableRow>
<TableCell>
<TableSortLabel
active={sortField === 'username'}
direction={sortField === 'username' ? sortOrder : 'asc'}
onClick={() => handleSort('username')}
active={sortField === 'path'}
direction={sortField === 'path' ? sortOrder : 'asc'}
onClick={() => handleSort('path')}
>
Username
</TableSortLabel>
Expand Down Expand Up @@ -162,7 +162,7 @@ export function UsersDashboard({ users }: { users: ScoutGameUser[] }) {
<TableBody>
{filteredAndSortedUsers.map((user) => (
<TableRow key={user.id}>
<TableCell>{user.username}</TableCell>
<TableCell>{user.path}</TableCell>
<TableCell>{user.id}</TableCell>
<TableCell>{user.farcasterId}</TableCell>
<TableCell>{user.builderStatus || 'N/A'}</TableCell>
Expand Down
4 changes: 2 additions & 2 deletions apps/scoutgameadmin/lib/session/getUserFromSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { replaceS3Domain } from '@root/lib/utils/url';

import { getSession } from './getSession';

export type SessionUser = Pick<Scout, 'id' | 'username' | 'displayName' | 'avatar'>;
export type SessionUser = Pick<Scout, 'id' | 'path' | 'displayName' | 'avatar'>;

export async function getUserFromSession(): Promise<SessionUser | null> {
const session = await getSession();
Expand All @@ -15,7 +15,7 @@ export async function getUserFromSession(): Promise<SessionUser | null> {
},
select: {
id: true,
username: true,
path: true,
displayName: true,
avatar: true
}
Expand Down
8 changes: 4 additions & 4 deletions apps/scoutgameadmin/lib/users/getUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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'
}
Expand All @@ -48,7 +48,7 @@ export async function getUsers({
? { farcasterId: userFid }
: typeof searchString === 'string'
? {
username: {
path: {
contains: searchString,
mode: 'insensitive'
}
Expand Down
30 changes: 0 additions & 30 deletions apps/sunnyawards/lib/blockchain/findOrCreateWalletUser.ts

This file was deleted.

73 changes: 0 additions & 73 deletions apps/sunnyawards/lib/users/findOrCreateUser.ts

This file was deleted.

14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions scripts/migrations/2024_10_29_migrateScoutPaths.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { log } from '@charmverse/core/log';
import { prisma } from '@charmverse/core/prisma-client';

Expand Down
2 changes: 1 addition & 1 deletion scripts/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a92595a

Please sign in to comment.