diff --git a/build.gradle.kts b/build.gradle.kts index 11ed4c1..1c7d3d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ plugins { dependencies { implementation(hlaeja.kotlin.reflect) implementation(hlaeja.kotlinx.coroutines) + implementation(hlaeja.ltd.hlaeja.library.common.messages) implementation(hlaeja.org.springframework.springboot.actuator.starter) implementation(hlaeja.org.springframework.springboot.r2dbc.starter) implementation(hlaeja.org.springframework.springboot.webflux.starter) diff --git a/sql/002-types.sql b/sql/002-types.sql new file mode 100644 index 0000000..235788d --- /dev/null +++ b/sql/002-types.sql @@ -0,0 +1,22 @@ +-- Table: public.types +-- DROP TABLE IF EXISTS public.types; + +CREATE TABLE IF NOT EXISTS public.types +( + id UUID DEFAULT gen_uuid_v7(), + timestamp timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + name VARCHAR(50) UNIQUE NOT NULL, + CONSTRAINT pk_contact_types PRIMARY KEY (id) +); + +ALTER TABLE IF EXISTS public.types + OWNER to role_administrator; + + +-- Revoke all permissions from existing roles +REVOKE ALL ON TABLE public.types FROM role_administrator, role_maintainer, role_support, role_service; + +-- Grant appropriate permissions +GRANT ALL ON TABLE public.types TO role_administrator; +GRANT SELECT, INSERT, UPDATE ON TABLE public.types TO role_maintainer, role_service; +GRANT SELECT ON TABLE public.types TO role_support; diff --git a/src/main/kotlin/ltd/hlaeja/entity/TypeEntity.kt b/src/main/kotlin/ltd/hlaeja/entity/TypeEntity.kt new file mode 100644 index 0000000..10bf722 --- /dev/null +++ b/src/main/kotlin/ltd/hlaeja/entity/TypeEntity.kt @@ -0,0 +1,14 @@ +package ltd.hlaeja.entity + +import java.time.ZonedDateTime +import java.util.UUID +import org.springframework.data.annotation.Id +import org.springframework.data.relational.core.mapping.Table + +@Table("types") +data class TypeEntity( + @Id + val id: UUID? = null, + val timestamp: ZonedDateTime, + val name: String, +)