Skip to content

Commit

Permalink
feature: 面经功能添加 (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash authored Dec 19, 2024
2 parents f2bf1b4 + 8bfcf58 commit bb59c25
Show file tree
Hide file tree
Showing 22 changed files with 1,564 additions and 15 deletions.
20 changes: 8 additions & 12 deletions internal/resume/internal/web/project.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package web

import (
"context"

"github.com/ecodeclub/ekit/slice"
"github.com/ecodeclub/ginx"
"github.com/ecodeclub/ginx/session"
Expand Down Expand Up @@ -50,7 +48,7 @@ func (h *ProjectHandler) DeleteContribution(ctx *ginx.Context, item IDItem) (gin
}

func (h *ProjectHandler) DeleteDifficulty(ctx *ginx.Context, item IDItem) (ginx.Result, error) {
err := h.svc.DeleteDifficulty(ctx.Request.Context(), item.ID)
err := h.svc.DeleteDifficulty(ctx, item.ID)
if err != nil {
return systemErrorResult, err
}
Expand Down Expand Up @@ -79,17 +77,16 @@ func (h *ProjectHandler) SaveProject(ctx *ginx.Context, req SaveProjectReq, sess

func (h *ProjectHandler) DeleteProject(ctx *ginx.Context, req IDItem, sess session.Session) (ginx.Result, error) {
uid := sess.Claims().Uid
err := h.svc.DeleteProject(ctx.Request.Context(), uid, req.ID)
err := h.svc.DeleteProject(ctx, uid, req.ID)
if err != nil {
return systemErrorResult, err
}
return ginx.Result{}, nil
}

func (h *ProjectHandler) ProjectInfo(ctx *ginx.Context, req IDItem, sess session.Session) (ginx.Result, error) {
pctx := ctx.Request.Context()
uid := sess.Claims().Uid
pro, err := h.svc.ProjectInfo(pctx, req.ID)
pro, err := h.svc.ProjectInfo(ctx, req.ID)
if err != nil {
return systemErrorResult, err
}
Expand All @@ -102,8 +99,7 @@ func (h *ProjectHandler) ProjectInfo(ctx *ginx.Context, req IDItem, sess session
cids = append(cids, ca.Id)
}
}

resMap, caMap, err := h.getCaMap(pctx, uid, cids)
resMap, caMap, err := h.getCaMap(ctx, uid, cids)
if err != nil {
return systemErrorResult, err
}
Expand Down Expand Up @@ -182,20 +178,20 @@ func (h *ProjectHandler) ProjectDifficultySave(ctx *ginx.Context, req SaveDiffic
return ginx.Result{}, nil
}

func (h *ProjectHandler) getCaMap(ctx context.Context, uid int64, cids []int64) (map[int64]cases.ExamineResult, map[int64]cases.Case, error) {
func (h *ProjectHandler) getCaMap(ctx *ginx.Context, uid int64, cids []int64) (map[int64]cases.ExamineResult, map[int64]cases.Case, error) {
var (
resMap map[int64]cases.ExamineResult
caMap map[int64]cases.Case
eg errgroup.Group
)

pctx := ctx.Request.Context()
eg.Go(func() error {
var eerr error
resMap, eerr = h.examSvc.GetResults(ctx, uid, cids)
resMap, eerr = h.examSvc.GetResults(pctx, uid, cids)
return eerr
})
eg.Go(func() error {
cas, eerr := h.caseSvc.GetPubByIDs(ctx, cids)
cas, eerr := h.caseSvc.GetPubByIDs(pctx, cids)
if eerr != nil {
return eerr
}
Expand Down
27 changes: 27 additions & 0 deletions internal/review/internal/domain/review.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package domain

type Review struct {
ID int64
Uid int64
JD string
JDAnalysis string
Questions string
QuestionAnalysis string
Resume string
Status ReviewStatus
Utime int64
}
type ReviewStatus uint8

func (s ReviewStatus) ToUint8() uint8 {
return uint8(s)
}

const (
// UnknownStatus 未知
UnknownStatus ReviewStatus = 0
// UnPublishedStatus 未发布
UnPublishedStatus ReviewStatus = 1
// PublishedStatus 发布
PublishedStatus ReviewStatus = 2
)
10 changes: 10 additions & 0 deletions internal/review/internal/errs/code.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package errs

var (
SystemError = ErrorCode{Code: 516001, Msg: "系统错误"}
)

type ErrorCode struct {
Code int
Msg string
}
Loading

0 comments on commit bb59c25

Please sign in to comment.