parent
e64cdabb17
commit
c9f08c869f
8 changed files with 5778 additions and 40 deletions
|
|
@ -74,8 +74,6 @@ export const auth = betterAuth({
|
||||||
image: "imageUrl",
|
image: "imageUrl",
|
||||||
},
|
},
|
||||||
additionalFields: {
|
additionalFields: {
|
||||||
firstName: { type: "string", required: false, fieldName: "firstName" },
|
|
||||||
lastName: { type: "string", required: false, fieldName: "lastName" },
|
|
||||||
username: { type: "string", required: false, fieldName: "username" },
|
username: { type: "string", required: false, fieldName: "username" },
|
||||||
isAdmin: { type: "boolean", defaultValue: false, fieldName: "isAdmin" },
|
isAdmin: { type: "boolean", defaultValue: false, fieldName: "isAdmin" },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,6 @@ describe('Team Management - Admin User List', () => {
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user1',
|
username: 'user1',
|
||||||
displayName: 'User One',
|
displayName: 'User One',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'One',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
flagConfig: null,
|
flagConfig: null,
|
||||||
customAvatarUrl: null,
|
customAvatarUrl: null,
|
||||||
|
|
@ -207,8 +205,6 @@ describe('Team Management - Admin User List', () => {
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user2',
|
username: 'user2',
|
||||||
displayName: 'User Two',
|
displayName: 'User Two',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'Two',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
flagConfig: null,
|
flagConfig: null,
|
||||||
customAvatarUrl: null,
|
customAvatarUrl: null,
|
||||||
|
|
@ -246,8 +242,6 @@ describe('Team Management - Admin User List', () => {
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user1',
|
username: 'user1',
|
||||||
displayName: 'User One',
|
displayName: 'User One',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'One',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
flagConfig: null,
|
flagConfig: null,
|
||||||
customAvatarUrl: null,
|
customAvatarUrl: null,
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,6 @@ export async function action(args: Route.ActionArgs) {
|
||||||
|
|
||||||
const displayName = formData.get("displayName") as string;
|
const displayName = formData.get("displayName") as string;
|
||||||
const username = formData.get("username") as string | null;
|
const username = formData.get("username") as string | null;
|
||||||
const firstName = formData.get("firstName") as string | null;
|
|
||||||
const lastName = formData.get("lastName") as string | null;
|
|
||||||
const timezone = formData.get("timezone") as string | null;
|
const timezone = formData.get("timezone") as string | null;
|
||||||
|
|
||||||
const timezoneValue =
|
const timezoneValue =
|
||||||
|
|
@ -100,8 +98,6 @@ export async function action(args: Route.ActionArgs) {
|
||||||
await updateUser(session.user.id, {
|
await updateUser(session.user.id, {
|
||||||
displayName: displayName || undefined,
|
displayName: displayName || undefined,
|
||||||
username: username || undefined,
|
username: username || undefined,
|
||||||
firstName: firstName || undefined,
|
|
||||||
lastName: lastName || undefined,
|
|
||||||
timezone: timezoneValue,
|
timezone: timezoneValue,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -164,24 +160,6 @@ export default function UserProfilePage({ loaderData, actionData }: Route.Compon
|
||||||
defaultValue={user.username ?? ""}
|
defaultValue={user.username ?? ""}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor="firstName">First Name</Label>
|
|
||||||
<Input
|
|
||||||
id="firstName"
|
|
||||||
name="firstName"
|
|
||||||
defaultValue={user.firstName ?? ""}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor="lastName">Last Name</Label>
|
|
||||||
<Input
|
|
||||||
id="lastName"
|
|
||||||
name="lastName"
|
|
||||||
defaultValue={user.lastName ?? ""}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Email</Label>
|
<Label>Email</Label>
|
||||||
<p className="text-sm text-muted-foreground">{user.email}</p>
|
<p className="text-sm text-muted-foreground">{user.email}</p>
|
||||||
|
|
|
||||||
8
app/test/fixtures/user.ts
vendored
8
app/test/fixtures/user.ts
vendored
|
|
@ -5,8 +5,6 @@ export const mockUser = {
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user1',
|
username: 'user1',
|
||||||
displayName: 'User One',
|
displayName: 'User One',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'One',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
timezone: null,
|
timezone: null,
|
||||||
|
|
@ -21,8 +19,6 @@ export const mockAdminUser = {
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
displayName: 'Admin User',
|
displayName: 'Admin User',
|
||||||
firstName: 'Admin',
|
|
||||||
lastName: 'User',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
timezone: null,
|
timezone: null,
|
||||||
|
|
@ -39,8 +35,6 @@ export const mockUsers = [
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user2',
|
username: 'user2',
|
||||||
displayName: 'User Two',
|
displayName: 'User Two',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'Two',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
timezone: null,
|
timezone: null,
|
||||||
|
|
@ -54,8 +48,6 @@ export const mockUsers = [
|
||||||
emailVerified: true,
|
emailVerified: true,
|
||||||
username: 'user3',
|
username: 'user3',
|
||||||
displayName: 'User Three',
|
displayName: 'User Three',
|
||||||
firstName: 'User',
|
|
||||||
lastName: 'Three',
|
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
timezone: null,
|
timezone: null,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ export const users = pgTable("users", {
|
||||||
emailVerified: boolean("email_verified").notNull().default(false),
|
emailVerified: boolean("email_verified").notNull().default(false),
|
||||||
username: varchar("username", { length: 255 }),
|
username: varchar("username", { length: 255 }),
|
||||||
displayName: varchar("display_name", { length: 255 }), // mapped as BetterAuth's "name" field
|
displayName: varchar("display_name", { length: 255 }), // mapped as BetterAuth's "name" field
|
||||||
firstName: varchar("first_name", { length: 255 }),
|
|
||||||
lastName: varchar("last_name", { length: 255 }),
|
|
||||||
imageUrl: varchar("image_url", { length: 512 }), // mapped as BetterAuth's "image" field
|
imageUrl: varchar("image_url", { length: 512 }), // mapped as BetterAuth's "image" field
|
||||||
flagConfig: jsonb("flag_config").$type<{ pattern: string; colors: string[] }>(),
|
flagConfig: jsonb("flag_config").$type<{ pattern: string; colors: string[] }>(),
|
||||||
customAvatarUrl: varchar("custom_avatar_url", { length: 512 }),
|
customAvatarUrl: varchar("custom_avatar_url", { length: 512 }),
|
||||||
|
|
|
||||||
2
drizzle/0099_peaceful_hannibal_king.sql
Normal file
2
drizzle/0099_peaceful_hannibal_king.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE "users" DROP COLUMN IF EXISTS "first_name";--> statement-breakpoint
|
||||||
|
ALTER TABLE "users" DROP COLUMN IF EXISTS "last_name";
|
||||||
5769
drizzle/meta/0099_snapshot.json
Normal file
5769
drizzle/meta/0099_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -694,6 +694,13 @@
|
||||||
"when": 1778261539567,
|
"when": 1778261539567,
|
||||||
"tag": "0098_lucky_sabra",
|
"tag": "0098_lucky_sabra",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 99,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1778341807236,
|
||||||
|
"tag": "0099_peaceful_hannibal_king",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue