-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: read model for dependent features #4846
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely. I commented on a small nit.
async getParentOptions(child: string): Promise<string[]> { | ||
const result = await this.db('features as f') | ||
.where('f.name', child) | ||
.select('f.project'); | ||
if (result.length === 0) { | ||
return []; | ||
} | ||
const rows = await this.db('features as f') | ||
.leftJoin('dependent_features as df', 'f.name', 'df.child') | ||
.where('f.project', result[0].project) | ||
.andWhere('f.name', '!=', child) | ||
.andWhere('df.child', null) | ||
.select('f.name'); | ||
|
||
return rows.map((item) => item.name); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer features as feature
to help with scanning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update in the next PR
About the changes
Introducing read model separate from the write model using store. The read model can be used by the feature overview to get parents/children without exposing write DB operations.
Important files
Discussion points