()
| 350 | } |
| 351 | |
| 352 | func (m *Mentor) initDefaultContent() { |
| 353 | uniqueIDRepo := unique.NewUniqueIDRepo(&data.Data{DB: m.engine}) |
| 354 | revisionRepo := revision.NewRevisionRepo(&data.Data{DB: m.engine}, uniqueIDRepo) |
| 355 | now := time.Now() |
| 356 | |
| 357 | tagId, err := uniqueIDRepo.GenUniqueIDStr(m.ctx, entity.Tag{}.TableName()) |
| 358 | if err != nil { |
| 359 | m.err = err |
| 360 | return |
| 361 | } |
| 362 | |
| 363 | q1Id, err := uniqueIDRepo.GenUniqueIDStr(m.ctx, entity.Question{}.TableName()) |
| 364 | if err != nil { |
| 365 | m.err = err |
| 366 | return |
| 367 | } |
| 368 | |
| 369 | a1Id, err := uniqueIDRepo.GenUniqueIDStr(m.ctx, entity.Answer{}.TableName()) |
| 370 | if err != nil { |
| 371 | m.err = err |
| 372 | return |
| 373 | } |
| 374 | |
| 375 | q2Id, err := uniqueIDRepo.GenUniqueIDStr(m.ctx, entity.Question{}.TableName()) |
| 376 | if err != nil { |
| 377 | m.err = err |
| 378 | return |
| 379 | } |
| 380 | |
| 381 | a2Id, err := uniqueIDRepo.GenUniqueIDStr(m.ctx, entity.Answer{}.TableName()) |
| 382 | if err != nil { |
| 383 | m.err = err |
| 384 | return |
| 385 | } |
| 386 | |
| 387 | tag := &entity.Tag{ |
| 388 | ID: tagId, |
| 389 | SlugName: "support", |
| 390 | DisplayName: "support", |
| 391 | OriginalText: "For general support questions.", |
| 392 | ParsedText: "<p>For general support questions.</p>", |
| 393 | UserID: "1", |
| 394 | QuestionCount: 2, |
| 395 | Status: entity.TagStatusAvailable, |
| 396 | RevisionID: "0", |
| 397 | } |
| 398 | |
| 399 | q1 := &entity.Question{ |
| 400 | ID: q1Id, |
| 401 | CreatedAt: now, |
| 402 | UserID: "1", |
| 403 | LastEditUserID: "1", |
| 404 | Title: "What is a tag?", |
| 405 | OriginalText: "When asking a question, we need to choose tags. What are tags and why should I use them?", |
| 406 | ParsedText: "<p>When asking a question, we need to choose tags. What are tags and why should I use them?</p>", |
| 407 | Pin: entity.QuestionUnPin, |
| 408 | Show: entity.QuestionShow, |
| 409 | Status: entity.QuestionStatusAvailable, |
nothing calls this directly
no test coverage detected