apache / incubator-answer

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

Home Page:https://answer.apache.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update initial data

fenbox opened this issue · comments

commented

Current

All data is empty and requires further configuration by the administrator to use.

Expected

Have initial data such as tags, sample Q&A, etc., so users can start using it right away.

After the user fills in the admin account during installation and clicks the Next button, the following initial data will be generated automatically.

image

Initial tag:

- name: support
  description: For general support questions.

Initial post:

- title: What is a tag?
  body: When asking a question, we need to choose tags. What are tags and why should I use them?
  tags:
    - support
  answer: Tags help to organize content and make searching easier. It helps your question get more attention from people interested in that tag. Tags also send notifications. If you are interested in some topic, follow that tag to get updates.

- title: What is reputation and how do I earn them?
  body: I see that each user has reputation points, What is it and how do I earn them?
  tags:
    - support
  answer: Your reputation points show how much the community values your knowledge. You earn points when someone find your question or answer helpful. You also get points when the person who asked the question thinks you did a good job and accepts your answer.

The author is the initial administrator.

i'll do it

@fenbox

is it a good idea to add it in the internal/migrations/init.go file? in the InitDB method?
that would require importing the tag_service, question_service, etc... or atleast the tag_repo, question_repo, etc...

because i need to generate unique ID and can't just do m.engine.Context(m.ctx).Insert(...)

@fenbox Maybe we can clarify the requirements a bit more.

  • Option 1: Do we need an input field in the installation page, where the initial administrator can enter the contents of the initial tag and post, and initialize them along with the initial data?
  • Option 2: The administrator can enter these details in the admin page after installation.
  • Option 3: During installation, it is possible to add a command-line option to specify the location of the initial data configuration file.

I would perfer option 1. Or do you have any other ideas.

@zahash If it is option 1, then you are correct.

commented

Like other platforms such as WordPress. There is no need an input field in the installation page.

@fenbox @LinkinStars

i'm sorry i've never used wordpress, how does this feature work?
so which of the three options is it?

commented

@zahash I have updated the description.

After users install the program, they will now see two Q&A post and one tag. No other functions.

is it a good idea to add it in the internal/migrations/init.go file? in the InitDB method?

@zahash Your understanding is correct. This initialization content is fixed, which means that after installation, there is a default tag and Q&A content. Therefore, you can create these contents directly in the InitDB method. BTW, you can put the initial content in init_data.go.

@LinkinStars @fenbox

why is there no AddTag function in tag_repo.go?

@LinkinStars @fenbox

why is there no AddTag function in tag_repo.go?

@zahash In tag_common_repo.go

@LinkinStars hmmm.. whats the difference? why is it split into two files?

@LinkinStars hmmm.. whats the difference? why is it split into two files?

@zahash It was supposed to fix the golang circular references at the time.

@LinkinStars @fenbox

i made a pr with a "work in progess" commit. It doesn't compile right now but is this the direction you want to go?
#918

@LinkinStars @fenbox

i made a pr with a "work in progess" commit. It doesn't compile right now but is this the direction you want to go? #918

@zahash No problem, good job.

@LinkinStars

how do i initialize the UniqueIDRepo in internal/install/install_controller.go InitBaseInfo function?
because migrations.NewMentor( ... ) needs it

@LinkinStars

how do i initialize the UniqueIDRepo in internal/install/install_controller.go InitBaseInfo function? because migrations.NewMentor( ... ) needs it

Maybe you can use unique.NewUniqueIDRepo(&data.Data{DB: engine}). If you think this way is too troublesome, you also can use the engine *xorm.Engine to Insert directly.