From 83e70d678cf14170e0e5234ff29dea8d262f587c Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 17 Jul 2020 08:00:11 -0700 Subject: [PATCH] add project/project channel DAOs --- .../hangar/db/dao/ProjectChannelDao.java | 15 +++++++++++++++ .../me/minidigger/hangar/db/dao/ProjectDao.java | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/main/java/me/minidigger/hangar/db/dao/ProjectChannelDao.java create mode 100644 src/main/java/me/minidigger/hangar/db/dao/ProjectDao.java diff --git a/src/main/java/me/minidigger/hangar/db/dao/ProjectChannelDao.java b/src/main/java/me/minidigger/hangar/db/dao/ProjectChannelDao.java new file mode 100644 index 000000000..d81330d3a --- /dev/null +++ b/src/main/java/me/minidigger/hangar/db/dao/ProjectChannelDao.java @@ -0,0 +1,15 @@ +package me.minidigger.hangar.db.dao; + +import me.minidigger.hangar.db.model.ProjectChannelsTable; +import org.jdbi.v3.sqlobject.customizer.BindBean; +import org.jdbi.v3.sqlobject.customizer.Timestamped; +import org.jdbi.v3.sqlobject.statement.GetGeneratedKeys; +import org.jdbi.v3.sqlobject.statement.SqlUpdate; + +public interface ProjectChannelDao { + + @SqlUpdate("insert into project_channels (created_at, name, color, project_id) values (:now, :name, :color, :projectId)") + @Timestamped + @GetGeneratedKeys + ProjectChannelsTable insert(@BindBean ProjectChannelsTable projectChannel); +} diff --git a/src/main/java/me/minidigger/hangar/db/dao/ProjectDao.java b/src/main/java/me/minidigger/hangar/db/dao/ProjectDao.java new file mode 100644 index 000000000..d816e1be4 --- /dev/null +++ b/src/main/java/me/minidigger/hangar/db/dao/ProjectDao.java @@ -0,0 +1,15 @@ +package me.minidigger.hangar.db.dao; + +import me.minidigger.hangar.db.model.ProjectsTable; +import org.jdbi.v3.sqlobject.customizer.BindBean; +import org.jdbi.v3.sqlobject.customizer.Timestamped; +import org.jdbi.v3.sqlobject.statement.GetGeneratedKeys; +import org.jdbi.v3.sqlobject.statement.SqlUpdate; + +public interface ProjectDao { + + @SqlUpdate("insert into projects (id, created_at, plugin_id, name, slug, owner_name, recommended_version_id, owner_id, topic_id, post_id, category, description, visibility, notes, keywords, homepage, issues, source, support, license_name, license_url, forum_sync) values (:id, :now, :pluginId, :name, :slug, :ownerName, :recommendedVersion, :ownerId, :topicId, :postId, :category, :description, :visibility, :notes, :keywords, :homepage, :issues, :source, :support, :licenseName, :licenseUrl, :forumSync)") + @Timestamped + @GetGeneratedKeys + ProjectsTable insert(@BindBean ProjectsTable project); +}