summaryrefslogtreecommitdiff
path: root/lib/bidding/detail
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bidding/detail')
-rw-r--r--lib/bidding/detail/service.ts13
-rw-r--r--lib/bidding/detail/table/bidding-award-dialog.tsx8
-rw-r--r--lib/bidding/detail/table/bidding-detail-target-price-dialog.tsx6
-rw-r--r--lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx3
-rw-r--r--lib/bidding/detail/table/bidding-detail-vendor-edit-dialog.tsx3
5 files changed, 13 insertions, 20 deletions
diff --git a/lib/bidding/detail/service.ts b/lib/bidding/detail/service.ts
index e22331bb..025b9eac 100644
--- a/lib/bidding/detail/service.ts
+++ b/lib/bidding/detail/service.ts
@@ -472,8 +472,7 @@ export async function calculateTargetPrice(
// 내정가 자동 산정 및 업데이트
export async function calculateAndUpdateTargetPrice(
- biddingId: number,
- userId: string
+ biddingId: number
) {
try {
// 입찰 정보 조회
@@ -510,7 +509,7 @@ export async function calculateAndUpdateTargetPrice(
}
// 내정가 업데이트
- const updateResult = await updateTargetPrice(biddingId, targetPrice, criteria, userId)
+ const updateResult = await updateTargetPrice(biddingId, targetPrice, criteria)
if (updateResult.success) {
// 내정가 산정 후 입찰 상태를 set_target_price로 변경 (received_quotation 상태에서만)
@@ -551,7 +550,6 @@ export async function updateTargetPrice(
biddingId: number,
targetPrice: number,
targetPriceCalculationCriteria: string,
- userId: string
) {
try {
// 입력값 검증
@@ -587,7 +585,6 @@ export async function updateBiddingDetailVendor(
quotationAmount: number, // 기존값 유지용
currency: string, // 기존값 유지용
awardRatio: number, // UI에서 수정 가능
- userId: string
) {
try {
const result = await db.update(biddingCompanies)
@@ -625,8 +622,7 @@ export async function updateBiddingDetailVendor(
// 본입찰용 업체 추가
export async function createBiddingDetailVendor(
biddingId: number,
- vendorId: number,
- userId: string
+ vendorId: number
) {
try {
const result = await db.transaction(async (tx) => {
@@ -2169,8 +2165,7 @@ export async function updatePartnerAttendance(
attendeeCount?: number
representativeName?: string
representativePhone?: string
- },
- userId: string
+ }
) {
try {
const result = await db.transaction(async (tx) => {
diff --git a/lib/bidding/detail/table/bidding-award-dialog.tsx b/lib/bidding/detail/table/bidding-award-dialog.tsx
index 3ab883f2..9a4614bd 100644
--- a/lib/bidding/detail/table/bidding-award-dialog.tsx
+++ b/lib/bidding/detail/table/bidding-award-dialog.tsx
@@ -2,6 +2,7 @@
import * as React from 'react'
import { useTransition } from 'react'
+import { useSession } from 'next-auth/react'
import { Button } from '@/components/ui/button'
import {
Dialog,
@@ -49,11 +50,12 @@ export function BiddingAwardDialog({
onSuccess
}: BiddingAwardDialogProps) {
const { toast } = useToast()
+ const { data: session } = useSession()
const [isPending, startTransition] = useTransition()
const [selectionReason, setSelectionReason] = React.useState('')
const [awardedCompanies, setAwardedCompanies] = React.useState<AwardedCompany[]>([])
const [isLoading, setIsLoading] = React.useState(false)
-
+const userId = session?.user?.id || '2';
// 낙찰된 업체 정보 로드
React.useEffect(() => {
if (open) {
@@ -105,7 +107,7 @@ export function BiddingAwardDialog({
}
startTransition(async () => {
- const result = await awardBidding(biddingId, selectionReason, 'current-user')
+ const result = await awardBidding(biddingId, selectionReason, userId)
if (result.success) {
toast({
@@ -231,7 +233,7 @@ export function BiddingAwardDialog({
{/* 첨부파일 */}
<AwardSimpleFileUpload
biddingId={biddingId}
- userId="current-user"
+ userId={userId}
readOnly={false}
/>
</div>
diff --git a/lib/bidding/detail/table/bidding-detail-target-price-dialog.tsx b/lib/bidding/detail/table/bidding-detail-target-price-dialog.tsx
index e2cf964b..a8f604d8 100644
--- a/lib/bidding/detail/table/bidding-detail-target-price-dialog.tsx
+++ b/lib/bidding/detail/table/bidding-detail-target-price-dialog.tsx
@@ -78,8 +78,7 @@ export function BiddingDetailTargetPriceDialog({
startTransition(async () => {
try {
const result = await calculateAndUpdateTargetPrice(
- bidding.id,
- 'current-user' // TODO: 실제 사용자 ID
+ bidding.id
)
if (result.success && result.data) {
@@ -136,8 +135,7 @@ export function BiddingDetailTargetPriceDialog({
const result = await updateTargetPrice(
bidding.id,
targetPrice,
- calculationCriteria.trim(),
- 'current-user' // TODO: 실제 사용자 ID
+ calculationCriteria.trim()
)
if (result.success) {
diff --git a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx
index 75b1f67b..5e85af06 100644
--- a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx
+++ b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx
@@ -115,8 +115,7 @@ export function BiddingDetailVendorCreateDialog({
startTransition(async () => {
const response = await createBiddingDetailVendor(
biddingId,
- selectedVendor.id,
- 'current-user'
+ selectedVendor.id
)
if (response.success) {
diff --git a/lib/bidding/detail/table/bidding-detail-vendor-edit-dialog.tsx b/lib/bidding/detail/table/bidding-detail-vendor-edit-dialog.tsx
index 9a5408c2..e029d536 100644
--- a/lib/bidding/detail/table/bidding-detail-vendor-edit-dialog.tsx
+++ b/lib/bidding/detail/table/bidding-detail-vendor-edit-dialog.tsx
@@ -65,8 +65,7 @@ export function BiddingDetailVendorEditDialog({
vendor.id,
vendor.quotationAmount, // 기존 견적금액 유지
vendor.currency, // 기존 통화 유지
- formData.awardRatio,
- 'current-user' // TODO: 실제 사용자 ID
+ formData.awardRatio
)
if (response.success) {