mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-09 06:32:43 +08:00
fix bug in project api dao
This commit is contained in:
parent
45a6f7d02b
commit
8009325e2f
@ -10,11 +10,11 @@ import io.papermc.hangar.model.api.requests.RequestPagination;
|
||||
import org.jdbi.v3.sqlobject.config.KeyColumn;
|
||||
import org.jdbi.v3.sqlobject.config.RegisterColumnMapper;
|
||||
import org.jdbi.v3.sqlobject.config.RegisterConstructorMapper;
|
||||
import org.jdbi.v3.sqlobject.customizer.Bind;
|
||||
import org.jdbi.v3.sqlobject.customizer.Define;
|
||||
import org.jdbi.v3.sqlobject.customizer.DefineNamedBindings;
|
||||
import org.jdbi.v3.sqlobject.statement.SqlQuery;
|
||||
import org.jdbi.v3.stringtemplate4.UseStringTemplateEngine;
|
||||
import org.jdbi.v3.stringtemplate4.UseStringTemplateSqlLocator;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
@ -25,7 +25,7 @@ import java.util.Map;
|
||||
@RegisterConstructorMapper(Project.class)
|
||||
public interface ProjectsApiDAO {
|
||||
|
||||
@UseStringTemplateSqlLocator
|
||||
@UseStringTemplateEngine
|
||||
@RegisterColumnMapper(PromotedVersionMapper.class)
|
||||
@SqlQuery("SELECT hp.id," +
|
||||
" hp.created_at," +
|
||||
@ -58,8 +58,8 @@ public interface ProjectsApiDAO {
|
||||
" JOIN projects p ON hp.id = p.id" +
|
||||
" WHERE lower(hp.slug) = lower(:slug) AND" +
|
||||
" lower(hp.owner_name) = lower(:author)" +
|
||||
" <if(!seeHidden)> AND (hp.visibility = 0 <if(requesterId)>OR (:requesterId = ANY(hp.project_members) AND hp.visibility != 4)<endif>) <endif>")
|
||||
Project getProject(String author, String slug, @Define boolean canSeeHidden, @Define Long requesterId);
|
||||
" <if(!canSeeHidden)> AND (hp.visibility = 0 <if(requesterId)>OR (:requesterId = ANY(hp.project_members) AND hp.visibility != 4)<endif>) <endif>")
|
||||
Project getProject(String author, String slug, @Define boolean canSeeHidden, @Define @Bind Long requesterId);
|
||||
|
||||
@UseStringTemplateEngine
|
||||
@SqlQuery("SELECT hp.id," +
|
||||
|
Loading…
Reference in New Issue
Block a user