Skip to content

Commit

Permalink
Merge pull request #46 from shortintern2020-A-labyrinth/develop
Browse files Browse the repository at this point in the history
Authorを記述
  • Loading branch information
Highmt authored Aug 30, 2020
2 parents 9be9956 + 531b725 commit cad2828
Show file tree
Hide file tree
Showing 80 changed files with 2,564 additions and 382 deletions.
22 changes: 11 additions & 11 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
Expand Down
113 changes: 113 additions & 0 deletions .factorypath

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target/
*.iml
.idea/
demo.iml
*.class
src/main/resources/twitter4j.properties
.gradle/
.vscode
.settings/
Binary file added .gradle/6.5/executionHistory/executionHistory.lock
Binary file not shown.
Binary file added .gradle/6.5/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/6.5/fileHashes/fileHashes.lock
Binary file not shown.
Empty file added .gradle/6.5/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Wed Aug 26 19:54:40 JST 2020
gradle.version=6.5
Binary file added .gradle/checksums/checksums.lock
Binary file not shown.
Empty file added .gradle/vcs-1/gc.properties
Empty file.
4 changes: 3 additions & 1 deletion .settings/org.eclipse.jdt.apt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=target\\generated-sources\\annotations
org.eclipse.jdt.apt.genTestSrcDir=target\\generated-test-sources\\test-annotations
2 changes: 1 addition & 1 deletion .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'

services:
db:
image: postgres:latest
container_name: emolog_db
volumes:
- ./docker/pg:/docker-entrypoint-initdb.d
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- '5432:5432'
102 changes: 102 additions & 0 deletions docker/pg/1-createTable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*テーブル作成*/
create table users (
id serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
);

create table sample (
friendid serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
);

create table friend (
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
name varchar(30) not null,
latestemolog varchar(30),
updated_at timestamp,
lasttweetid INTEGER DEFAULT 0
);

create table emolog (
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
created_at timestamp,
contents varchar(30)
);

create table chat (
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
contents varchar(30),
create_at timestamp
);

create table requestfriend (
id serial primary key,
userid INTEGER not null,
requestfriendid INTEGER not null,
create_at timestamp
);

/* BEGIN:nakamura */
insert into users(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
('pinapple.chocomint', '[email protected]', 3),
('apple.chocomint', '[email protected]', 4),
('lemon.chocomint', '[email protected]', 5)
;

insert into friend(userid, name, latestemolog, updated_at) values
(123, 'ichigo.chocomint', '🍎🍋🍇', '2001-01-01 01:01:01'),
(456, 'banana.chocomint', '🍈🍓🍌', '2002-02-02 02:02:02'),
(789, 'pinapple.chocomint', '🍊🥝🍎', '2003-03-03 03:03:03'),
(321, 'apple.chocomint', '🍋🍇🍈', '2004-04-04 04:04:04'),
(654, 'lemon.chocomint', '🍓🍌🍊', '2005-05-05 05:05:05'),
(1919, 'CNN', '🦍🍗🚽', '2005-05-05 05:05:05'),
(810, 'samurai_badass', '🌮🌾🥢', '2005-05-05 05:05:05'),
(114, 'capital_noodle', '💃💃💃', '2005-05-05 05:05:05'),
(514, 'roland_0fficial', '😲😲😲', '2005-05-05 05:05:05')
;

insert into emolog(userid, friendid, created_at, contents) values
(1, 2, '2006-06-06 06:06:06', '⛰🌋🗻'),
(2, 1, '2007-07-07 07:07:07', '🏘🏠🏡'),
(1, 3, '2008-08-08 08:08:08', '🐒🦍🐒'),
(3, 1, '2009-09-09 09:09:09', '⭐️🌟⭐️'),
(2, 3, '2010-10-10 10:10:10', '🐈🐈🐈')
;

insert into chat(userid, friendid, contents, create_at) values
(123, 456, 'Hello', '2011-11-11 11:11:11'),
(789, 123, 'Good morning', '2012-12-12 12:12:12'),
(456, 789, 'Good afternoon', '2013-01-13 01:13:13'),
(456, 123, 'Good evening', '2014-02-14 02:14:14'),
(123, 789, 'Good night', '2015-03-15 03:15:15')

;

insert into requestfriend(userid, requestfriendid, create_at) values
(12, 34, '2016-04-16 04:16:16'),
(56, 78, '2017-05-17 05:17:17'),
(91, 23, '2018-06-18 06:18:18'),
(45, 67, '2019-07-19 07:19:19'),
(89, 12, '2020-08-20 08:20:20')
;

insert into users(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
('pinapple.chocomint', '[email protected]', 3)
;

/* END:nakamura */

111 changes: 111 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,24 @@

<properties>
<java.version>11</java.version>
<doma.version>2.18.0</doma.version>
</properties>

<repositories>
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>


<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -27,6 +43,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- データベースアクセス -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Spring JDBC を使う -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -48,13 +74,98 @@
</exclusion>
</exclusions>
</dependency>
<!-- emoji - java を使う -->
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>4.0.0</version>
</dependency>
<!--web socket を使う
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>-->
<dependency>
<groupId>org.seasar.doma.boot</groupId>
<artifactId>doma-spring-boot-starter</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.seasar.doma.boot</groupId>
<artifactId>doma-spring-boot-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[4.0,)</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.ibm.watson/ibm-watson -->
<dependency>
<groupId>com.ibm.watson</groupId>
<artifactId>ibm-watson</artifactId>
<version>8.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>5.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>7.0.0.Alpha6</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
<dependency>
<groupId>org.seasar.doma</groupId>
<artifactId>doma</artifactId>
<version>${doma.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.vdurmont/emoji-java -->
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<folders>
<folder>src/main/resources/twitter4j.properties</folder>
</folders>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/com/example/demo/AppConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.demo;

import javax.sql.DataSource;

import org.seasar.doma.SingletonConfig;
import org.seasar.doma.jdbc.Config;
import org.seasar.doma.jdbc.dialect.Dialect;
import org.seasar.doma.jdbc.dialect.PostgresDialect;
import org.seasar.doma.jdbc.tx.LocalTransactionDataSource;
import org.seasar.doma.jdbc.tx.LocalTransactionManager;
import org.seasar.doma.jdbc.tx.TransactionManager;

/**
* @author Yuta Takayama
*/
@SingletonConfig
public class AppConfig implements Config {

private static final AppConfig INSTANCE = new AppConfig();

private final Dialect dialect;
private final LocalTransactionDataSource dataSource;
private final TransactionManager transactionManager;

private AppConfig() {
dialect = new PostgresDialect();
dataSource = new LocalTransactionDataSource("jdbc:postgresql://localhost:5432/sample", "postgres", "postgres");
transactionManager = new LocalTransactionManager(dataSource.getLocalTransaction(getJdbcLogger()));
}

@Override
public Dialect getDialect() {
return dialect;
}

@Override
public DataSource getDataSource() {
return dataSource;
}

@Override
public TransactionManager getTransactionManager() {
return transactionManager;
}

public static AppConfig singleton() {
return INSTANCE;
}
}
Loading

0 comments on commit cad2828

Please sign in to comment.