Skip to content

Commit

Permalink
Merge pull request #1085 from academic-relations/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
pbc1017 authored Sep 19, 2024
2 parents ff3c491 + 5e118ca commit c49c3a8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ export class ClubRegistrationRepository {

let professor;
if (body.professor) {
professor = await tx
.insert(Professor)
.values({
email: body.professor.email,
name: body.professor.name,
})
.onDuplicateKeyUpdate({
set: { name: body.professor.name },
});
professor = await tx
.select({
id: Professor.id,
Expand All @@ -157,44 +166,19 @@ export class ClubRegistrationRepository {
)
.for("share")
.then(takeUnique);
if (!professor) {
professor = await tx
.insert(Professor)
.values({
email: body.professor.email,
name: body.professor.name,
})
.onDuplicateKeyUpdate({
set: { name: body.professor.name },
});
professor = await tx
.select({
id: Professor.id,
})
.from(Professor)
.where(
and(
eq(Professor.email, body.professor.email),
eq(Professor.name, body.professor.name),
isNull(Professor.deletedAt),
),
)
.for("share")
.then(takeUnique);

logger.debug(professor);
logger.debug(professor);

await tx
.insert(ProfessorT)
.values({
professorId: professor.id,
professorEnum: body.professor.professorEnumId,
startTerm: cur,
})
.onDuplicateKeyUpdate({
set: { professorEnum: body.professor.professorEnumId },
});
}
await tx
.insert(ProfessorT)
.values({
professorId: professor.id,
professorEnum: body.professor.professorEnumId,
startTerm: cur,
})
.onDuplicateKeyUpdate({
set: { professorEnum: body.professor.professorEnumId },
});
}

// registration insert 후 id 가져오기
Expand Down Expand Up @@ -271,6 +255,15 @@ export class ClubRegistrationRepository {

let professor;
if (body.professor) {
professor = await tx
.insert(Professor)
.values({
email: body.professor.email,
name: body.professor.name,
})
.onDuplicateKeyUpdate({
set: { name: body.professor.name },
});
professor = await tx
.select({
id: Professor.id,
Expand All @@ -285,44 +278,19 @@ export class ClubRegistrationRepository {
)
.for("share")
.then(takeUnique);
if (!professor) {
professor = await tx
.insert(Professor)
.values({
email: body.professor.email,
name: body.professor.name,
})
.onDuplicateKeyUpdate({
set: { name: body.professor.name },
});
professor = await tx
.select({
id: Professor.id,
})
.from(Professor)
.where(
and(
eq(Professor.email, body.professor.email),
eq(Professor.name, body.professor.name),
isNull(Professor.deletedAt),
),
)
.for("share")
.then(takeUnique);

logger.debug(professor);
logger.debug(professor);

await tx
.insert(ProfessorT)
.values({
professorId: professor.id,
professorEnum: body.professor.professorEnumId,
startTerm: cur,
})
.onDuplicateKeyUpdate({
set: { professorEnum: body.professor.professorEnumId },
});
}
await tx
.insert(ProfessorT)
.values({
professorId: professor.id,
professorEnum: body.professor.professorEnumId,
startTerm: cur,
})
.onDuplicateKeyUpdate({
set: { professorEnum: body.professor.professorEnumId },
});
}

const [result] = await tx
Expand All @@ -343,7 +311,6 @@ export class ClubRegistrationRepository {
registrationClubRuleFileId: body.clubRuleFileId,
registrationExternalInstructionFileId: body.externalInstructionFileId,
registrationApplicationStatusEnumId: RegistrationStatusEnum.Pending,
professorApprovedAt: null,
})
.where(
and(
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/api/file/apiFil001.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const requestBody = z.object({
metadata: z.array(
z.object({
name: zFileName,
type: z.coerce.string().max(30),
type: z.coerce.string().max(256),
size: z.coerce.number().int().min(1),
}),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const PastActivityReportModal: React.FC<PastActivityReportModalProps> = ({
key={`${index.toString()}`}
>
<Typography fs={14} lh={16} color="GRAY.600">
{formatSlashDateTime(comment.createdAt)} ㅁㄴㅇㅁㄴㅇ
{formatSlashDateTime(comment.createdAt)}
</Typography>
<Typography fs={16} lh={24}>
{comment.content}
Expand Down

0 comments on commit c49c3a8

Please sign in to comment.