MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / upsertUser

Method upsertUser

apps/web/services/users/users.ts:118–151  ·  view source on GitHub ↗
({
    isAdmin = false,
    isBot = false,
    anonymousAlias = generateRandomWordSlug(),
    ...user
  }: {
    externalUserId: string;
    accountsId: string;
    isAdmin?: boolean;
    isBot?: boolean;
    displayName: string;
    anonymousAlias?: string;
    profileImageUrl?: string;
    role?: Roles;
  })

Source from the content-addressed store, hash-verified

116 });
117 }
118 static async upsertUser({
119 isAdmin = false,
120 isBot = false,
121 anonymousAlias = generateRandomWordSlug(),
122 ...user
123 }: {
124 externalUserId: string;
125 accountsId: string;
126 isAdmin?: boolean;
127 isBot?: boolean;
128 displayName: string;
129 anonymousAlias?: string;
130 profileImageUrl?: string;
131 role?: Roles;
132 }) {
133 return prisma.users.upsert({
134 create: {
135 ...user,
136 isAdmin,
137 isBot,
138 anonymousAlias,
139 },
140 update: {
141 displayName: user.displayName,
142 profileImageUrl: user.profileImageUrl,
143 },
144 where: {
145 externalUserId_accountsId: {
146 accountsId: user.accountsId,
147 externalUserId: user.externalUserId!,
148 },
149 },
150 });
151 }
152 static async findUsersByExternalId({
153 accountId,
154 externalIds,

Callers 2

findUsersFunction · 0.80
postMethod · 0.80

Calls 1

generateRandomWordSlugFunction · 0.90

Tested by

no test coverage detected