Answer the question
In order to leave comments, you need to log in
Create 2 related models or one depending on certain conditions, how to implement?
Hello. I can't figure out how best to solve this problem.
There are two tables:
Answer the question
In order to leave comments, you need to log in
interface Task{}
interface Comment{}
class TaskImpl implements Task{}
class CommentImpl extends TaskImpl implements Task, Comment {}
class Service {
Task newTask {return new TaskImpl();}
Comment newComment(long taskId){return new CommentImpl(taskId);}
<T extends Z&X> commentAsTask(long taskId){return new CommentImpl(taskId);}
}
NikolayAlb : Personally, I think that the task should be independent of the comment or image coordinates.
Therefore, I propose the following variant of the database structure:
Task:
id
title
related_task_id
Image:
id
task_id
path_to_file
position_x = null
position_y = null
width = null
length = null
ImageComment:
id
image_id
text
position_x
position_y
width
height
= null
- Means that it is empty by default related_task
indicate in which task you are creating this task. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question