Skip to content

Commit

Permalink
支持面试连招 (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash authored Jun 12, 2024
2 parents b1ab541 + 2ea8c5a commit dedbdd2
Show file tree
Hide file tree
Showing 19 changed files with 740 additions and 23 deletions.
5 changes: 4 additions & 1 deletion internal/label/internal/integration/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ func (s *HandlerTestSuite) TestSystemLabels() {
before: func(t *testing.T) {
err := s.db.Create([]dao.Label{
{Id: 1, Name: "test", Uid: -1},
{Id: 2, Name: "non-system", Uid: 123}}).Error
{Id: 2, Name: "non-system", Uid: 123},
{Id: 3, Name: "test-1", Uid: -1},
}).Error
require.NoError(t, err)
},
wantCode: 200,
wantResp: test.Result[[]web.Label]{
Data: []web.Label{
{Id: 3, Name: "test-1"},
{Id: 1, Name: "test"},
},
},
Expand Down
8 changes: 4 additions & 4 deletions internal/label/internal/repository/dao/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (dao *LabelGORMDAO) CreateLabel(ctx context.Context, label Label) (int64, e
func (dao *LabelGORMDAO) UidLabels(ctx context.Context, uid int64) ([]Label, error) {
var res []Label
err := dao.db.WithContext(ctx).
Where("uid = ?", uid).Find(&res).Error
Where("uid = ?", uid).Order("id DESC").Find(&res).Error
return res, err
}

Expand All @@ -57,9 +57,9 @@ func NewLabelGORMDAO(db *egorm.Component) LabelDAO {
}

type Label struct {
Id int64 `gorm:"primaryKey,autoIncrement"`
Name string
Uid int64 `gorm:"index"`
Id int64 `gorm:"primaryKey,autoIncrement"`
Name string `gorm:"type:varchar(256);unique"`
Uid int64 `gorm:"index"`
Ctime int64
Utime int64
}
22 changes: 22 additions & 0 deletions internal/project/internal/domain/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type Project struct {
Questions []Question
Resumes []Resume
Introductions []Introduction
Combos []Combo

// 目前来说,我们只需要两个 SN,而不是需要维持整个 SPU
// 后续如果需要 SPU 的其他字段,就重构为结构体
Expand Down Expand Up @@ -161,3 +162,24 @@ const (
func (r Role) ToUint8() uint8 {
return uint8(r)
}

// Combo 面试套路,连招
type Combo struct {
Id int64
Title string
Content string
Utime int64
Status ComboStatus
}

type ComboStatus uint8

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

const (
ComboStatusUnknown ComboStatus = iota
ComboStatusUnpublished
ComboStatusPublished
)
Loading

0 comments on commit dedbdd2

Please sign in to comment.