mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
fix(search): match latest version only for version stacks and return stack assets (#542)
* fix(search): match latest version only for version stacks and return stack assets * fix(search): preserve cross-project moved files in semantic search and align stack timestamps
This commit is contained in:
@@ -2,6 +2,7 @@ import { Prisma } from '@shumai/db'
|
||||
import { SearchCondition } from '@shumai/dtos'
|
||||
|
||||
export class SqlQueryBuilder {
|
||||
private withSql: Prisma.Sql | null = null
|
||||
private selectSql: Prisma.Sql = Prisma.sql`*`
|
||||
private fromSql: Prisma.Sql | null = null
|
||||
private wheres: Prisma.Sql[] = []
|
||||
@@ -9,6 +10,11 @@ export class SqlQueryBuilder {
|
||||
private limitCount: number | null = null
|
||||
private offsetCount: number | null = null
|
||||
|
||||
with(cte: Prisma.Sql): this {
|
||||
this.withSql = cte
|
||||
return this
|
||||
}
|
||||
|
||||
select(fields: Prisma.Sql): this {
|
||||
this.selectSql = fields
|
||||
return this
|
||||
@@ -70,12 +76,14 @@ export class SqlQueryBuilder {
|
||||
throw new Error('FROM clause is required in SqlQueryBuilder')
|
||||
}
|
||||
|
||||
const queryParts: Prisma.Sql[] = [
|
||||
Prisma.sql`SELECT`,
|
||||
this.selectSql,
|
||||
Prisma.sql`FROM`,
|
||||
this.fromSql,
|
||||
]
|
||||
const queryParts: Prisma.Sql[] = []
|
||||
|
||||
if (this.withSql) {
|
||||
queryParts.push(Prisma.sql`WITH`)
|
||||
queryParts.push(this.withSql)
|
||||
}
|
||||
|
||||
queryParts.push(Prisma.sql`SELECT`, this.selectSql, Prisma.sql`FROM`, this.fromSql)
|
||||
|
||||
if (this.wheres.length > 0) {
|
||||
queryParts.push(Prisma.sql`WHERE`)
|
||||
|
||||
Reference in New Issue
Block a user