merge: integrate latest shared mainline
This commit is contained in:
commit
59634f8516
@ -1,6 +1,6 @@
|
||||
ALTER TABLE "StoreAccount"
|
||||
ADD COLUMN "subject" TEXT NOT NULL DEFAULT '',
|
||||
ADD COLUMN "boundBankAccountNumberCiphertext" TEXT NOT NULL DEFAULT '';
|
||||
ADD COLUMN "subject" TEXT NOT NULL DEFAULT '',
|
||||
ADD COLUMN "boundBankAccountNumberCiphertext" TEXT NOT NULL DEFAULT '';
|
||||
|
||||
CREATE TABLE "StoreAccountStoreProfile" (
|
||||
"id" TEXT NOT NULL,
|
||||
@ -17,11 +17,6 @@ CREATE TABLE "StoreAccountStoreProfile" (
|
||||
CONSTRAINT "StoreAccountStoreProfile_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "StoreAccountStoreProfile_storeName_platform_key"
|
||||
ON "StoreAccountStoreProfile"("storeName", "platform");
|
||||
|
||||
CREATE INDEX "StoreAccountStoreProfile_storeName_idx"
|
||||
ON "StoreAccountStoreProfile"("storeName");
|
||||
|
||||
CREATE INDEX "StoreAccountStoreProfile_platform_idx"
|
||||
ON "StoreAccountStoreProfile"("platform");
|
||||
CREATE UNIQUE INDEX "StoreAccountStoreProfile_storeName_platform_key" ON "StoreAccountStoreProfile"("storeName", "platform");
|
||||
CREATE INDEX "StoreAccountStoreProfile_storeName_idx" ON "StoreAccountStoreProfile"("storeName");
|
||||
CREATE INDEX "StoreAccountStoreProfile_platform_idx" ON "StoreAccountStoreProfile"("platform");
|
||||
@ -3492,15 +3492,15 @@ model StoreAccount {
|
||||
operationDepartmentHead String @default("")
|
||||
operationDirector String @default("")
|
||||
profitCenter String @default("")
|
||||
subject String @default("")
|
||||
accountType String
|
||||
account String
|
||||
passwordCiphertext String @default("") @db.Text
|
||||
boundBankAccountNumberCiphertext String @default("") @db.Text
|
||||
boundPhone String @default("")
|
||||
verificationContact String @default("")
|
||||
jstOrderService String @default("")
|
||||
accountGroupName String @default("")
|
||||
subject String @default("")
|
||||
boundBankAccountNumberCiphertext String @default("") @db.Text
|
||||
createdById String?
|
||||
updatedById String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@ -15,6 +15,13 @@ const profileSchema = z.object({
|
||||
}).strict(),
|
||||
}).strict()
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
return handleRequest(request, async (ctx) => {
|
||||
const storeName = request.nextUrl.searchParams.get('storeName') ?? ''
|
||||
return jsonSuccess(await storeAccountManagementService.listStoreProfiles(storeName, ctx.user), 200, ctx.requestId)
|
||||
}, { requireAuth: true })
|
||||
}
|
||||
|
||||
export async function PATCH(request: NextRequest) {
|
||||
return handleRequest(request, async (ctx) => {
|
||||
const body = await request.json().catch(() => null)
|
||||
|
||||
@ -5,7 +5,7 @@ import { RequireAuth } from '@/components/auth/RequireAuth'
|
||||
import { PermissionGuard } from '@/components/auth/PermissionGuard'
|
||||
import { UserPermissionCenter } from './components/UserPermissionCenter'
|
||||
|
||||
export function UserPermissionManagementPage({
|
||||
function UserPermissionManagementPage({
|
||||
backHref: _backHref = '/intake',
|
||||
backLabel: _backLabel = '产品开发',
|
||||
}: {
|
||||
|
||||
@ -8,15 +8,27 @@ export type StoreAccountRecord = {
|
||||
operationDepartmentHead: string
|
||||
operationDirector: string
|
||||
profitCenter: string
|
||||
subject: string
|
||||
accountType: string
|
||||
account: string
|
||||
passwordCiphertext: string
|
||||
boundBankAccountNumberCiphertext: string
|
||||
boundPhone: string
|
||||
verificationContact: string
|
||||
jstOrderService: string
|
||||
accountGroupName: string
|
||||
subject: string
|
||||
boundBankAccountNumberCiphertext: string
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
export type StoreAccountProfileRecord = {
|
||||
id: string
|
||||
storeName: string
|
||||
platform: string
|
||||
merchantNumber: string
|
||||
secondaryMerchantNumber: string
|
||||
merchantStoreId: string
|
||||
companyId: string
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
@ -45,15 +57,27 @@ const ACCOUNT_SELECT = {
|
||||
operationDepartmentHead: true,
|
||||
operationDirector: true,
|
||||
profitCenter: true,
|
||||
subject: true,
|
||||
accountType: true,
|
||||
account: true,
|
||||
passwordCiphertext: true,
|
||||
boundBankAccountNumberCiphertext: true,
|
||||
boundPhone: true,
|
||||
verificationContact: true,
|
||||
jstOrderService: true,
|
||||
accountGroupName: true,
|
||||
subject: true,
|
||||
boundBankAccountNumberCiphertext: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
} as const
|
||||
|
||||
const PROFILE_SELECT = {
|
||||
id: true,
|
||||
storeName: true,
|
||||
platform: true,
|
||||
merchantNumber: true,
|
||||
secondaryMerchantNumber: true,
|
||||
merchantStoreId: true,
|
||||
companyId: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
} as const
|
||||
@ -164,6 +188,42 @@ export class StoreAccountManagementRepository {
|
||||
})
|
||||
}
|
||||
|
||||
async listProfiles(storeName: string) {
|
||||
return prisma.storeAccountStoreProfile.findMany({
|
||||
where: { storeName },
|
||||
select: PROFILE_SELECT,
|
||||
orderBy: { platform: 'asc' },
|
||||
})
|
||||
}
|
||||
|
||||
async upsertProfile(data: {
|
||||
storeName: string
|
||||
platform: string
|
||||
values: Record<string, string>
|
||||
actorId: string
|
||||
}) {
|
||||
return prisma.storeAccountStoreProfile.upsert({
|
||||
where: {
|
||||
storeName_platform: {
|
||||
storeName: data.storeName,
|
||||
platform: data.platform,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
...data.values,
|
||||
storeName: data.storeName,
|
||||
platform: data.platform,
|
||||
createdById: data.actorId,
|
||||
updatedById: data.actorId,
|
||||
},
|
||||
update: {
|
||||
...data.values,
|
||||
updatedById: data.actorId,
|
||||
},
|
||||
select: PROFILE_SELECT,
|
||||
})
|
||||
}
|
||||
|
||||
async upsertByKey(data: {
|
||||
storeName: string
|
||||
accountType: string
|
||||
@ -179,45 +239,6 @@ export class StoreAccountManagementRepository {
|
||||
})
|
||||
}
|
||||
|
||||
async listProfiles(storeName: string) {
|
||||
return prisma.storeAccountStoreProfile.findMany({
|
||||
where: { storeName },
|
||||
orderBy: { platform: 'asc' },
|
||||
})
|
||||
}
|
||||
|
||||
async upsertProfile(data: {
|
||||
storeName: string
|
||||
platform: string
|
||||
values: {
|
||||
merchantNumber: string
|
||||
secondaryMerchantNumber: string
|
||||
merchantStoreId: string
|
||||
companyId: string
|
||||
}
|
||||
actorId: string
|
||||
}) {
|
||||
return prisma.storeAccountStoreProfile.upsert({
|
||||
where: {
|
||||
storeName_platform: {
|
||||
storeName: data.storeName,
|
||||
platform: data.platform,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
storeName: data.storeName,
|
||||
platform: data.platform,
|
||||
...data.values,
|
||||
createdById: data.actorId,
|
||||
updatedById: data.actorId,
|
||||
},
|
||||
update: {
|
||||
...data.values,
|
||||
updatedById: data.actorId,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async createLog(data: { storeAccountId: string | null; storeName: string; operation: string; actorId: string; actorName: string; changes: unknown }) {
|
||||
return prisma.storeAccountChangeLog.create({ data: { ...data, changes: data.changes as object } })
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user