Skip to content

Commit b383d60

Browse files
authored
Merge pull request #95 from codeit-moving/dev
Dev -> release 20241230 callback next 처리
2 parents c071c62 + bd85514 commit b383d60

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

src/controllers/oauthController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ router.get(
8787
})
8888
);
8989

90-
const handleOAuthCallback: RequestHandler = (req, res) => {
90+
const handleOAuthCallback: RequestHandler = (req, res, next) => {
9191
if (!req.user) {
9292
return res.redirect("/login");
9393
}
@@ -120,7 +120,7 @@ const handleOAuthCallback: RequestHandler = (req, res) => {
120120
redirectUrl: FRONTEND_URL + redirectUrls[userType],
121121
redirect: true,
122122
};
123-
throw error;
123+
next(error);
124124
}
125125
};
126126

src/services/movingRequestService.ts

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import quoteRepository from "../repositorys/quoteRepository";
55
import processQuotes from "../utils/quote/processQuoteData";
66
import notificationRepository from "../repositorys/notificationRepository";
77
import moverRepository from "../repositorys/moverRepository";
8+
import { object } from "superstruct";
89

910
interface queryString {
1011
limit: number;
@@ -167,7 +168,7 @@ const getMovingRequestListByMover = async (
167168
moverId: number,
168169
query: queryString
169170
) => {
170-
const { limit, cursor, orderBy } = query;
171+
const { limit, cursor, orderBy, isQuoted } = query;
171172
const whereCondition: WhereCondition = setWhereCondition(query, moverId);
172173
const orderByQuery = setOrderBy(orderBy);
173174

@@ -186,18 +187,52 @@ const getMovingRequestListByMover = async (
186187
in: regions,
187188
};
188189

189-
const countCondition = {
190-
quote: whereCondition.quote,
191-
OR: whereCondition.OR,
192-
AND: whereCondition.AND,
190+
const countCondition: WhereCondition = {
193191
movingDate: whereCondition.movingDate,
194192
region: whereCondition.region,
195193
};
196194

195+
if (isQuoted) {
196+
countCondition.OR = [
197+
{
198+
quote: {
199+
some: {
200+
moverId,
201+
},
202+
},
203+
},
204+
{
205+
isRejected: {
206+
some: {
207+
id: moverId,
208+
},
209+
},
210+
},
211+
];
212+
} else {
213+
countCondition.AND = [
214+
{
215+
quote: {
216+
none: {
217+
moverId,
218+
},
219+
},
220+
},
221+
{
222+
isRejected: {
223+
none: {
224+
id: moverId,
225+
},
226+
},
227+
},
228+
];
229+
}
230+
197231
const serviceCountsPromise =
198232
movingRequestRepository.getMovingRequestCountByServices(countCondition);
199233

200-
const totalCountPromise = movingRequestRepository.getTotalCount();
234+
const totalCountPromise =
235+
movingRequestRepository.getTotalCount(countCondition);
201236
const designatedCountPromise =
202237
movingRequestRepository.getMovingRequestCountByDesignated(moverId);
203238

0 commit comments

Comments
 (0)