Compare commits
19 Commits
LabWork06R
...
LabWork06M
Author | SHA1 | Date | |
---|---|---|---|
262aa33c21 | |||
df9c01f3c2 | |||
|
1f4e80cc2b | ||
|
9f428fa251 | ||
69a18d420b | |||
29605e7fbe | |||
b468a84b1a | |||
1317a2824d | |||
b5c2db3e02 | |||
0a6ba9f820 | |||
728b166be0 | |||
8f17dd6365 | |||
47c87e6e8a | |||
70f597fac8 | |||
ee2f2cd7df | |||
0463cef7fa | |||
182427a9cf | |||
306ce2350d | |||
ba86843ae3 |
@ -15,22 +15,24 @@ jar {
|
||||
enabled = false
|
||||
}
|
||||
dependencies {
|
||||
implementation(project(':front'))
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||
implementation 'org.springframework.boot:spring-boot-devtools'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
|
||||
|
||||
implementation 'org.webjars:bootstrap:5.1.3'
|
||||
implementation 'org.webjars:jquery:3.6.0'
|
||||
implementation 'org.webjars:font-awesome:6.1.0'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'com.h2database:h2:2.1.210'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
|
||||
|
||||
implementation 'org.hibernate.validator:hibernate-validator'
|
||||
implementation 'org.springdoc:springdoc-openapi-ui:1.6.5'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
//implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5'
|
||||
|
||||
}
|
||||
|
||||
|
BIN
data.mv.db
995
data.trace.db
@ -1,995 +0,0 @@
|
||||
2023-04-20 14:36:21 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL)
|
||||
Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:697)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.message.DbException.get(DbException.java:192)
|
||||
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375)
|
||||
at org.h2.jdbc.JdbcConnection.getMetaData(JdbcConnection.java:306)
|
||||
at com.zaxxer.hikari.pool.ProxyConnection.getMetaData(ProxyConnection.java:370)
|
||||
at com.zaxxer.hikari.pool.HikariProxyConnection.getMetaData(HikariProxyConnection.java)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:179)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
|
||||
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
|
||||
at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:21 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLNonTransientConnectionException: База данных уже закрыта (чтобы отключить автоматическое закрытие базы данных при останове JVM, добавьте ";DB_CLOSE_ON_EXIT=FALSE" в URL)
|
||||
Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:697)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.message.DbException.get(DbException.java:192)
|
||||
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1375)
|
||||
at org.h2.jdbc.JdbcConnection.clearWarnings(JdbcConnection.java:610)
|
||||
at com.zaxxer.hikari.pool.ProxyConnection.close(ProxyConnection.java:257)
|
||||
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.closeConnection(DatasourceConnectionProviderImpl.java:127)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.releaseConnection(JdbcEnvironmentInitiator.java:289)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:232)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
|
||||
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
|
||||
at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Последовательность "CREATOR_SEQ" уже существует
|
||||
Sequence "CREATOR_SEQ" already exists; SQL statement:
|
||||
create sequence creator_seq start with 1 increment by 50 [90035-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.CreateSequence.update(CreateSequence.java:53)
|
||||
at org.h2.command.ddl.SchemaOwnerCommand.update(SchemaOwnerCommand.java:33)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:248)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Последовательность "MANGA_SEQ" уже существует
|
||||
Sequence "MANGA_SEQ" already exists; SQL statement:
|
||||
create sequence manga_seq start with 1 increment by 50 [90035-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.CreateSequence.update(CreateSequence.java:53)
|
||||
at org.h2.command.ddl.SchemaOwnerCommand.update(SchemaOwnerCommand.java:33)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:248)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Последовательность "READER_SEQ" уже существует
|
||||
Sequence "READER_SEQ" already exists; SQL statement:
|
||||
create sequence reader_seq start with 1 increment by 50 [90035-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.CreateSequence.update(CreateSequence.java:53)
|
||||
at org.h2.command.ddl.SchemaOwnerCommand.update(SchemaOwnerCommand.java:33)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:248)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Ограничение "FK9PLPVG6B0PWR4D02NWSEAYB0E" уже существует
|
||||
Constraint "FK9PLPVG6B0PWR4D02NWSEAYB0E" already exists; SQL statement:
|
||||
alter table manga add constraint FK9plpvg6b0pwr4d02nwseayb0e foreign key (creator_fk) references creator [90045-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.tryUpdate(AlterTableAddConstraint.java:109)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.update(AlterTableAddConstraint.java:72)
|
||||
at org.h2.command.ddl.AlterTable.update(AlterTable.java:46)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:458)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:278)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Ограничение "FKLWS2TIQ536CQ30TKVFSPQ29DD" уже существует
|
||||
Constraint "FKLWS2TIQ536CQ30TKVFSPQ29DD" already exists; SQL statement:
|
||||
alter table reader_mangas add constraint FKlws2tiq536cq30tkvfspq29dd foreign key (mangas_id) references manga [90045-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.tryUpdate(AlterTableAddConstraint.java:109)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.update(AlterTableAddConstraint.java:72)
|
||||
at org.h2.command.ddl.AlterTable.update(AlterTable.java:46)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:458)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:278)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 14:36:22 jdbc[3]: exception
|
||||
org.h2.jdbc.JdbcSQLSyntaxErrorException: Ограничение "FKEYLA07696YCEV3THCPXSERXQY" уже существует
|
||||
Constraint "FKEYLA07696YCEV3THCPXSERXQY" already exists; SQL statement:
|
||||
alter table reader_mangas add constraint FKeyla07696ycev3thcpxserxqy foreign key (reader_id) references reader [90045-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:651)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
at org.h2.message.DbException.get(DbException.java:227)
|
||||
at org.h2.message.DbException.get(DbException.java:203)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.tryUpdate(AlterTableAddConstraint.java:109)
|
||||
at org.h2.command.ddl.AlterTableAddConstraint.update(AlterTableAddConstraint.java:72)
|
||||
at org.h2.command.ddl.AlterTable.update(AlterTable.java:46)
|
||||
at org.h2.command.CommandContainer.update(CommandContainer.java:174)
|
||||
at org.h2.command.Command.executeUpdate(Command.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
|
||||
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
|
||||
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
|
||||
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
|
||||
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:587)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:532)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:458)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:278)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
2023-04-20 19:49:22 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94)
|
||||
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
|
||||
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
|
||||
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
|
||||
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
|
||||
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
|
||||
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
|
||||
at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:208)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:199)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:94)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:261)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52)
|
||||
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
|
||||
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
|
||||
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
|
||||
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
|
||||
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
|
||||
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
|
||||
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:252)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:926)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:486)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 103 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 97 more
|
||||
2023-04-20 19:49:23 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:177)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
|
||||
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
|
||||
at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 64 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 58 more
|
||||
2023-04-20 19:49:25 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284)
|
||||
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:41)
|
||||
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:63)
|
||||
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcDatabaseMetaData(ImprovedExtractionContextImpl.java:70)
|
||||
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.processTableResultSet(InformationExtractorJdbcDatabaseMetaDataImpl.java:64)
|
||||
at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getTables(AbstractInformationExtractorImpl.java:564)
|
||||
at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:122)
|
||||
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:225)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 68 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 62 more
|
||||
2023-04-20 20:47:19 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94)
|
||||
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
|
||||
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
|
||||
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
|
||||
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
|
||||
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
|
||||
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
|
||||
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
|
||||
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
|
||||
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
|
||||
at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78)
|
||||
at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
|
||||
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:208)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:199)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:94)
|
||||
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:261)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52)
|
||||
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
|
||||
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
|
||||
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
|
||||
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
|
||||
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
|
||||
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
|
||||
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
|
||||
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
|
||||
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
|
||||
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:252)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:926)
|
||||
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
|
||||
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:485)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:486)
|
||||
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:210)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 103 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 97 more
|
||||
2023-04-20 20:47:21 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:177)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
|
||||
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
|
||||
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
|
||||
at org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
|
||||
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
|
||||
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1350)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1421)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 64 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 58 more
|
||||
2023-04-20 20:47:22 database: flush
|
||||
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.get(DbException.java:216)
|
||||
at org.h2.message.DbException.convert(DbException.java:414)
|
||||
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||
at org.h2.engine.Database.<init>(Database.java:324)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||
at org.h2.Driver.connect(Driver.java:59)
|
||||
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
|
||||
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
|
||||
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
|
||||
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
|
||||
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
|
||||
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
|
||||
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
|
||||
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284)
|
||||
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:41)
|
||||
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:63)
|
||||
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcDatabaseMetaData(ImprovedExtractionContextImpl.java:70)
|
||||
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.processTableResultSet(InformationExtractorJdbcDatabaseMetaDataImpl.java:64)
|
||||
at org.hibernate.tool.schema.extract.internal.AbstractInformationExtractorImpl.getTables(AbstractInformationExtractorImpl.java:564)
|
||||
at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:122)
|
||||
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:225)
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:126)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:284)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143)
|
||||
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
|
||||
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140)
|
||||
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:336)
|
||||
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
|
||||
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
|
||||
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:66)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:376)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
|
||||
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
|
||||
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:352)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
|
||||
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
|
||||
at com.LabWork.app.AppApplication.main(AppApplication.java:10)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
|
||||
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]"
|
||||
General error: "org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]" [50000-210]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||
... 68 more
|
||||
Caused by: org.h2.mvstore.MVStoreException: The file is locked: D:/RaspaevNikolayPIbd-21/2_sem/IP/IP_PIbd-21_Raspaev_NI/data.mv.db [2.1.210/7]
|
||||
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||
... 62 more
|
26
front/.gitignore
vendored
@ -1,26 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
.parcel-cache
|
@ -1,58 +0,0 @@
|
||||
import com.github.gradle.node.util.PlatformHelper
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.node-gradle.node' version '3.5.1'
|
||||
id "de.undercouch.download" version '5.3.1'
|
||||
}
|
||||
|
||||
node {
|
||||
version = '18.15.0'
|
||||
download = true
|
||||
}
|
||||
|
||||
jar.dependsOn 'npmBuild'
|
||||
|
||||
clean.dependsOn 'npmClean'
|
||||
|
||||
nodeSetup.dependsOn 'downloadNode'
|
||||
|
||||
jar {
|
||||
from 'dist'
|
||||
into 'static'
|
||||
final devHost = 'http://localhost:8080'
|
||||
final prodHost = ''
|
||||
filesMatching('index.html') {
|
||||
filter { line -> line.replaceAll(devHost, prodHost) }
|
||||
}
|
||||
}
|
||||
|
||||
task downloadNode(type: Download) {
|
||||
final helper = new PlatformHelper()
|
||||
final templateData = [
|
||||
"url" : node.distBaseUrl.get(),
|
||||
"version": node.version.get(),
|
||||
"os" : helper.osName,
|
||||
"arch" : helper.osArch,
|
||||
"ext" : helper.windows ? 'zip' : 'tar.gz'
|
||||
]
|
||||
final urlTemplate = '${url}/v${version}/node-v${version}-${os}-${arch}.${ext}'
|
||||
final engine = new SimpleTemplateEngine()
|
||||
final url = engine.createTemplate(urlTemplate).make(templateData).toString()
|
||||
final String destDir = '.gradle/'
|
||||
file(destDir).mkdirs()
|
||||
src url
|
||||
dest destDir
|
||||
overwrite false
|
||||
}
|
||||
|
||||
tasks.register('npmBuild', NpmTask) {
|
||||
dependsOn npmInstall
|
||||
args = ['run-script', 'build']
|
||||
}
|
||||
|
||||
tasks.register('npmClean', NpmTask) {
|
||||
dependsOn npmInstall
|
||||
args = ['run-script', 'clean']
|
||||
}
|
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 48 KiB |
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<script type="module" src="/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/node_modules/@fortawesome/fontawesome-free/css/all.min.css">
|
||||
<title>ReManga</title>
|
||||
</head>
|
||||
<body >
|
||||
<div id="app" class="d-flex flex-column h-100" ></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
3026
front/package-lock.json
generated
@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "1.0.0",
|
||||
"source": "index.html",
|
||||
"scripts": {
|
||||
"start": "parcel --port 3000",
|
||||
"build": "npm run clean && parcel build",
|
||||
"clean": "rimraf dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "5.3.0-alpha2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.4.4",
|
||||
"@fortawesome/fontawesome-free": "^6.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.0.24",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"parcel": "2.8.3",
|
||||
"process": "^0.11.10",
|
||||
"rimraf": "4.4.0"
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
import { useRoutes, Outlet, BrowserRouter } from 'react-router-dom';
|
||||
import Creator from './MainS/Creator';
|
||||
import Reader from './MainS/Reader';
|
||||
import Header from './components/Header';
|
||||
import CreatorAction from './Main/CreatorAction';
|
||||
import ReaderAction from './Main/ReaderAction';
|
||||
import MangaPage from './Main/MangaPage';
|
||||
import Catalog from './Main/Catalog';
|
||||
|
||||
function Router(props) {
|
||||
return useRoutes(props.rootRoute);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const routes = [
|
||||
{ index: true, element: <Reader /> },
|
||||
{ path: 'creator', element: <Creator />, label: 'Creator' },
|
||||
{ path: 'reader', element: <Reader />, label: 'Reader' },
|
||||
{ path: 'creatorAction', element: <CreatorAction />, label: 'CreatorAction' },
|
||||
{ path: 'readerAction', element: <ReaderAction />, label: 'ReaderAction' },
|
||||
{ path: 'catalog', element: <Catalog />, label: 'Catalog' },
|
||||
{ path: 'mangapage', element: <MangaPage /> },
|
||||
];
|
||||
const links = routes.filter(route => route.hasOwnProperty('label'));
|
||||
const rootRoute = [
|
||||
{ path: '/', element: render(links), children: routes }
|
||||
];
|
||||
|
||||
function render(links) {
|
||||
return (
|
||||
<>
|
||||
<Header links={links} />
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Router rootRoute={ rootRoute } />
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
export default class MangaDto {
|
||||
constructor(args) {
|
||||
this.id = args.id || null;
|
||||
this.creatorId = args.creatorId || 0;
|
||||
this.mangaName = args.mangaName || "";
|
||||
this.image = args.image;
|
||||
this.chapterCount = args.chapterCount || 0;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import '../components/Banner/banner.css'
|
||||
import Banner from '../components/Banner/Banner.jsx'
|
||||
import { Link, NavLink } from 'react-router-dom';
|
||||
import MangaDto from "../Dto/Manga-Dto";
|
||||
|
||||
export default function Catalog() {
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
const [mangs, setMangs] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
getMangs()
|
||||
.then(_data =>setMangs(_data));
|
||||
console.log(2);
|
||||
console.log(mangs);
|
||||
},[]);
|
||||
|
||||
const getMangs = async function () {
|
||||
const response = await fetch(host + "/manga");
|
||||
const _data = await response.json()
|
||||
console.log(_data);
|
||||
return _data;
|
||||
}
|
||||
|
||||
return (
|
||||
<article className="p-2 catalog_article">
|
||||
<Banner />
|
||||
<div className = "catalog_wrapper">
|
||||
<h1>Каталог</h1>
|
||||
<div className="p-2 d-flex flex-wrap">
|
||||
{mangs.map((manga, index) => (
|
||||
<NavLink key={manga.id} to={`/mangapage?id=${manga.id}`}><img src={manga.image} alt={manga.mangaName} className="slideshow"/></NavLink>
|
||||
))}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../components/Table/TableCreator';
|
||||
import MangaDto from "../Dto/Manga-Dto";
|
||||
import MangaCreatorList from "../components/List/MangaCreatorList";
|
||||
import AddMangaModal from "../components/Modal/AddMangaModal";
|
||||
import EditMangaModal from "../components/Modal/EditMangaModal";
|
||||
|
||||
export default function CreatorAction() {
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
const [creatorData, setCreatorData] = useState([]);
|
||||
|
||||
const [creatorId, setCreatorId] = useState(0);
|
||||
|
||||
const [creator, setCreator] = useState([]);
|
||||
|
||||
const [mangaId, setMangaId] = useState(0);
|
||||
|
||||
const [chapterCount, setChapterCount] = useState(0);
|
||||
|
||||
const [mangaName, setMangaName] = useState("");
|
||||
|
||||
const [mangaModel, setMangaModel] = useState(new MangaDto({}));
|
||||
|
||||
useEffect(() => {
|
||||
getCreatorData()
|
||||
.then(_data =>setCreatorData(_data));
|
||||
},[]);
|
||||
|
||||
const getCreatorData = async function () {
|
||||
const response = await fetch(host + "/creator");
|
||||
const _data = await response.json()
|
||||
return _data;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCreator(creatorId)
|
||||
.then(_data =>setCreator(_data));
|
||||
},[creatorId]);
|
||||
|
||||
const getCreator = async function (id) {
|
||||
const requestParams = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/creator/` + id, requestParams);
|
||||
const _data = await response.json()
|
||||
return _data;
|
||||
}
|
||||
|
||||
const updateButton = (e) =>{
|
||||
e.preventDefault();
|
||||
update().then((result) => {
|
||||
alert(`Manga[id=${result.id}, mangaName=${result.mangaName}, chapterCount=${result.chapterCount}]`);
|
||||
getCreator(creatorId)
|
||||
.then(_data =>setCreator(_data));
|
||||
});
|
||||
}
|
||||
|
||||
const update = async function (){
|
||||
console.info('Try to update item');
|
||||
if (mangaId === 0) {
|
||||
return;
|
||||
}
|
||||
mangaModel.id = mangaId;
|
||||
mangaModel.chapterCount = chapterCount;
|
||||
mangaModel.creatorId = creatorId;
|
||||
mangaModel.image = imageURL;
|
||||
mangaModel.mangaName = mangaName;
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(mangaModel),
|
||||
};
|
||||
const response = await fetch(host + `/manga/` + mangaModel.id, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const setMangaIdButton = (id) =>{
|
||||
setMangaId(id);
|
||||
}
|
||||
|
||||
const removeButton = (id) =>{
|
||||
remove(id).then(() => {
|
||||
getCreator(creatorId)
|
||||
.then(_data =>setCreator(_data));
|
||||
});
|
||||
}
|
||||
|
||||
const remove = async function (id){
|
||||
console.info('Try to remove item');
|
||||
if (id !== 0) {
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const requestParams = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/manga/` + id, requestParams);
|
||||
}
|
||||
|
||||
const createButton = (e) =>{
|
||||
e.preventDefault()
|
||||
create().then((result) => {
|
||||
alert(`Manga[id=${result.id}, mangaName=${result.mangaName}, chapterCount=${result.chapterCount}]`);
|
||||
getCreator(creatorId)
|
||||
.then(_data =>setCreator(_data));
|
||||
});
|
||||
}
|
||||
|
||||
const create = async function (){
|
||||
mangaModel.chapterCount = chapterCount;
|
||||
mangaModel.creatorId = creatorId;
|
||||
mangaModel.image = imageURL;
|
||||
mangaModel.mangaName = mangaName;
|
||||
const requestParams = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(mangaModel),
|
||||
};
|
||||
const response = await fetch(host + `/manga`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const [imageURL, setImageURL] = useState();
|
||||
const fileReader = new FileReader();
|
||||
|
||||
fileReader.onloadend = () => {
|
||||
setImageURL(fileReader.result);
|
||||
};
|
||||
|
||||
const handleOnChange = (event) => {
|
||||
event.preventDefault();
|
||||
if (event.target.files && event.target.files.length) {
|
||||
const file = event.target.files[0];
|
||||
fileReader.readAsDataURL(file);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div className="container" id="root-div">
|
||||
<div className="content">
|
||||
<h1>Creator</h1>
|
||||
<form id="form">
|
||||
<div className="d-flex mt-3">
|
||||
<div className="col-sm-2 me-3">
|
||||
<select className="form-select" value={creatorId} onChange={event => setCreatorId(event.target.value)} aria-label="Default select example">
|
||||
<option value={0}>Creator</option>
|
||||
{
|
||||
creatorData?.map((creatorD) =>
|
||||
<option key={creatorD.id} value={creatorD.id}>{creatorD.creatorName}</option>
|
||||
)
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div className="d-grid col-sm-2">
|
||||
<button type="button" className="btn btn-success" data-bs-toggle="modal" data-bs-target="#exampleModal2">Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<MangaCreatorList
|
||||
creator={creator}
|
||||
setMangaIdButton={setMangaIdButton}
|
||||
removeButton={removeButton}
|
||||
/>
|
||||
<EditMangaModal
|
||||
chapterCount={chapterCount}
|
||||
setChapterCount={setChapterCount}
|
||||
handleOnChange={handleOnChange}
|
||||
updateButton={updateButton}
|
||||
/>
|
||||
<AddMangaModal
|
||||
chapterCount={chapterCount}
|
||||
setChapterCount={setChapterCount}
|
||||
mangaName={mangaName}
|
||||
setMangaName={setMangaName}
|
||||
handleOnChange={handleOnChange}
|
||||
createButton={createButton}
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
import React, {useState, useEffect} from 'react';
|
||||
import MangaDto from '../Dto/Manga-Dto';
|
||||
import ReaderList from "../components/List/ReaderList";
|
||||
|
||||
export default function MangaPage() {
|
||||
|
||||
const [mangaModel, setMangaModel] = useState(new MangaDto({}));
|
||||
|
||||
const [readerData, setReaderData] = useState([]);
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
useEffect(() => {
|
||||
const quryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(quryString);
|
||||
const id = urlParams.get('id');
|
||||
getCreator(id)
|
||||
.then(_data =>setMangaModel(_data));
|
||||
getReaderData(id)
|
||||
.then(_data =>setReaderData(_data));
|
||||
console.log(readerData);
|
||||
}, []);
|
||||
|
||||
const transformer = (mangaModel) => new MangaDto(mangaModel);
|
||||
const url = "manga/";
|
||||
|
||||
const getReaderData = async function (id) {
|
||||
const requestParams = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/manga/` + id + `/readers`, requestParams);
|
||||
const _data = await response.json()
|
||||
console.log(_data);
|
||||
return _data;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log(mangaModel);
|
||||
console.log(readerData);
|
||||
}, [mangaModel]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(readerData);
|
||||
});
|
||||
|
||||
|
||||
const getCreator = async function (id) {
|
||||
const requestParams = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/manga/` + id, requestParams);
|
||||
const _data = await response.json()
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
const addMangaButton = (e) =>{
|
||||
e.preventDefault()
|
||||
getReaderData(253)
|
||||
.then(_data =>setReaderData(_data));
|
||||
console.log(readerData);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="p-3">
|
||||
<div className="container d-flex" >
|
||||
<div className="d-flex flex-column">
|
||||
<img className="img_style01" style={{borderRadius: "3%"}}src={mangaModel.image} alt={mangaModel.mangaName}/>
|
||||
<button type="button" onClick={addMangaButton} className="btn btn-primary mt-3">Добавить в избранное</button>
|
||||
</div>
|
||||
<div className="container table text-white fs-4 ms-4">
|
||||
<div className="row text-white fw-bold fs-3">О манге</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-3">Год производства</div>
|
||||
<div className="col-xs-6 col-sm-3">1000</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-3">Страна</div>
|
||||
<div className="col-xs-6 col-sm-3">Россия</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-3">Жанр</div>
|
||||
<div className="col-xs-6 col-sm-3">Драма</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-3">Количество глав</div>
|
||||
<div className="col-xs-6 col-sm-3">{mangaModel.chapterCount}</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-3">Возраст</div>
|
||||
<div className="col-xs-6 col-sm-3">16+</div>
|
||||
</div>
|
||||
<div className="row text-white fw-bold fs-3">Описание</div>
|
||||
<div className="row">
|
||||
<div className="col-xs-6 col-sm-12">
|
||||
<p>Ким Кон Чжа спокойно живет в своей халупе, завидуя всем популярным охотникам. Однажды его желание быть лучше всех сбывается и он получает легендарный навык “Копирование способностей”... ценой своей жизни.</p>
|
||||
<p>Прежде чем он успевает понять это, его убивает охотник №1, Летний дух! Но это активирует его навык, и теперь он скопировал новый, “Путешествие во времени после смерти”.</p>
|
||||
<p>Как Ким Кон Чжа же будет использовать эти навыки, чтобы победить конкурентов и подняться на вершину?</p>
|
||||
</div>
|
||||
</div>
|
||||
<ReaderList
|
||||
readers={mangaModel.readers}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,186 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import TableReader from '../components/Table/TableReader';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import MangaReaderList from "../components/List/MangaReaderList";
|
||||
import AddMangaReaderModal from "../components/Modal/AddMangaReaderModal";
|
||||
|
||||
export default function ReaderAction() {
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
const [mangaData, setMangaData] = useState([]);
|
||||
|
||||
const [readerData, setReaderData] = useState([]);
|
||||
|
||||
const [readerId, setReaderId] = useState(0);
|
||||
|
||||
const [reader, setReader] = useState([]);
|
||||
|
||||
const [mangaId, setMangaId] = useState(0);
|
||||
|
||||
const [chapterCount, setChapterCount] = useState(0);
|
||||
|
||||
const [mangaName, setMangaName] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
const quryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(quryString);
|
||||
const id = urlParams.get('id');
|
||||
setReaderId(id);
|
||||
getReaderData()
|
||||
.then(_data =>setReaderData(_data));
|
||||
getMangaData()
|
||||
.then(_data =>setMangaData(_data));
|
||||
console.log(2);
|
||||
console.log(readerData);
|
||||
},[]);
|
||||
|
||||
const getReaderData = async function () {
|
||||
const response = await fetch(host + "/reader");
|
||||
const _data = await response.json()
|
||||
console.log(_data);
|
||||
return _data;
|
||||
}
|
||||
|
||||
const getMangaData = async function () {
|
||||
const response = await fetch(host + "/manga");
|
||||
const _data = await response.json()
|
||||
console.log(_data);
|
||||
return _data;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log(readerId);
|
||||
getReader(readerId)
|
||||
.then(_data =>setReader(_data));
|
||||
console.log(readerId);
|
||||
},[readerId]);
|
||||
|
||||
const getReader = async function (id) {
|
||||
const requestParams = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/reader/` + id, requestParams);
|
||||
const _data = await response.json()
|
||||
return _data;
|
||||
}
|
||||
|
||||
const updateButton = (e) =>{
|
||||
e.preventDefault();
|
||||
update().then((result) => {
|
||||
alert(`Manga[id=${result.id}, mangaName=${result.mangaName}, chapterCount=${result.chapterCount}]`);
|
||||
getReader(readerId)
|
||||
.then(_data =>setReader(_data));
|
||||
});
|
||||
console.log(readerId);
|
||||
|
||||
console.log(readerId);
|
||||
console.log(reader);
|
||||
}
|
||||
|
||||
const update = async function (){
|
||||
console.info('Try to update item');
|
||||
if (mangaId === 0) {
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/manga/${mangaId}?chapterCount=${chapterCount}`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const setMangaIdButton = (id) =>{
|
||||
setMangaId(id);
|
||||
}
|
||||
|
||||
const removeButton = (id) =>{
|
||||
remove(id).then((result) => {
|
||||
getReader(readerId)
|
||||
.then(_data =>setReader(_data));
|
||||
});
|
||||
}
|
||||
|
||||
const remove = async function (id){
|
||||
console.info('Try to remove item');
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
console.log(host + `/reader/${readerId}/removeManga?mangaId=${id}`, requestParams);
|
||||
const response = await fetch(host + `/reader/${readerId}/removeManga?mangaId=${id}`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
||||
const addMangaButton = (e) =>{
|
||||
e.preventDefault()
|
||||
addManga().then((result) => {
|
||||
alert(`Manga[id=${result.id}, mangaName=${result.mangaName}, chapterCount=${result.chapterCount}]`);
|
||||
console.log(result);
|
||||
getReader(readerId)
|
||||
.then(_data =>setReader(_data));
|
||||
});
|
||||
}
|
||||
|
||||
const addManga = async function (){
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
console.log(host + `/reader/${readerId}/addManga?mangaId=${mangaId}`, requestParams);
|
||||
const response = await fetch(host + `/reader/${readerId}/addManga?mangaId=${mangaId}`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div className="container" id="root-div">
|
||||
<div className="content">
|
||||
<h1>Reader</h1>
|
||||
<form id="form">
|
||||
<div className="d-flex mt-3">
|
||||
<div className="col-sm-2 me-3">
|
||||
<select className="form-select" value={readerId} onChange={event => setReaderId(event.target.value)} aria-label="Default select example">
|
||||
<option value={0}>Reader</option>
|
||||
{
|
||||
readerData.map((readerD) =>
|
||||
<option key={readerD.id} value={readerD.id}>{readerD.readerName}</option>
|
||||
)
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div className="d-grid col-sm-2">
|
||||
<button type="button" className="btn btn-success" data-bs-toggle="modal" data-bs-target="#exampleModal2">Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<MangaReaderList
|
||||
reader={reader}
|
||||
removeButton={removeButton}
|
||||
/>
|
||||
<AddMangaReaderModal
|
||||
mangaId={mangaId}
|
||||
setMangaId={setMangaId}
|
||||
mangaData={mangaData}
|
||||
addMangaButton={addMangaButton}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import TableCreator from '../components/Table/TableCreator';
|
||||
import MangaDto from '../Dto/Manga-Dto';
|
||||
|
||||
export default function Creator() {
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
const [creatorId, setCreatorId] = useState(0);
|
||||
|
||||
const [creatorName, setCreatorName] = useState("");
|
||||
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
const [mangaModel, setMangaModel] = useState(new MangaDto({}));
|
||||
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
|
||||
const table = document.getElementById("tbody");
|
||||
|
||||
useEffect(() => {
|
||||
getData()
|
||||
},[]);
|
||||
|
||||
const getData = async function () {
|
||||
const response = await fetch(host + "/creator");
|
||||
setData(await response.json())
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
const create = async function (){
|
||||
const requestParams = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
console.log((host + `/creator?creatorName=${creatorName}&password=${password}`));
|
||||
const response = await fetch(host + `/creator?creatorName=${creatorName}&password=${password}`, requestParams);
|
||||
getData();
|
||||
}
|
||||
|
||||
const remove = async function (){
|
||||
console.info('Try to remove item');
|
||||
if (creatorId !== 0) {
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const requestParams = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/creator/` + creatorId, requestParams);
|
||||
console.log("REMOVE");
|
||||
getData();
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const removeAll = async function (){
|
||||
console.info('Try to remove item');
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "DELETE",
|
||||
};
|
||||
await fetch(host + `/creator/`, requestParams);
|
||||
}
|
||||
|
||||
const update = async function (){
|
||||
console.info('Try to update item');
|
||||
if (creatorId === 0 || creatorName == null || password === 0) {
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/creator/${creatorId}?creatorName=${creatorName}&password=${password}`, requestParams);
|
||||
getData();
|
||||
return await response.json();
|
||||
}
|
||||
const createButton = (e) =>{
|
||||
e.preventDefault()
|
||||
create();
|
||||
}
|
||||
|
||||
const removeButton = (e) =>{
|
||||
e.preventDefault()
|
||||
remove();
|
||||
}
|
||||
|
||||
const updateButton = (e) =>{
|
||||
e.preventDefault()
|
||||
update();
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div className="container" id="root-div">
|
||||
<div className="content">
|
||||
<h1>Creator</h1>
|
||||
<form id="form">
|
||||
<div className="d-flex justify-content-evenly mt-3">
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="creatorId" className="form-label">creatorId</label>
|
||||
<input type='number' value = {creatorId} onChange={event => setCreatorId(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="creatorName" className="form-label">creatorName</label>
|
||||
<input type='text' value = {creatorName} onChange={event => setCreatorName(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="password" className="form-label">password</label>
|
||||
<input type='text' value = {password} onChange={event => setPassword(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row mt-3">
|
||||
<div className="d-grid col-sm-3 mx-auto">
|
||||
<button type="submit" onClick={createButton} className="btn btn-success">Добавить</button>
|
||||
</div>
|
||||
<div className="d-grid col-sm-3 mx-auto">
|
||||
<button type="submit" onClick={updateButton} className="btn btn-success" id="btnUpdate" >Обновить</button>
|
||||
</div>
|
||||
<div className="d-grid col-sm-3 mx-auto">
|
||||
<button id="btnRemove" onClick={removeButton} className="btn btn-success">Удалить</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div className="row table-responsive text-white">
|
||||
|
||||
<table className="table mt-3 text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">CreatorName</th>
|
||||
<th scope="col">Password</th>
|
||||
<th scope="col">Mangs</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<TableCreator items = {data}/>
|
||||
{/* <tbody id="tbody">
|
||||
</tbody> */}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,218 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import TableReader from '../components/Table/TableReader';
|
||||
|
||||
export default function ReaderS() {
|
||||
|
||||
const host = "http://localhost:8080/api";
|
||||
|
||||
const [readerId, setReaderId] = useState(0);
|
||||
|
||||
const [mangaId, setMangaId] = useState(0);
|
||||
|
||||
const [readerName, setReaderName] = useState("");
|
||||
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
const [data, setData] = useState([]);
|
||||
|
||||
|
||||
|
||||
|
||||
const table = document.getElementById("tbody");
|
||||
|
||||
useEffect(() => {
|
||||
getData();
|
||||
console.log(2);
|
||||
},[]);
|
||||
|
||||
|
||||
const getData = async function () {
|
||||
const response = await fetch(host + "/reader");
|
||||
setData(await response.json())
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
const create = async function (){
|
||||
const requestParams = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/reader?readerName=${readerName}&password=${password}`, requestParams);
|
||||
getData();
|
||||
}
|
||||
|
||||
const remove = async function (id){
|
||||
console.info('Try to remove item');
|
||||
if (id !== 0) {
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const requestParams = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/reader/` + id, requestParams);
|
||||
getData();
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const removeAll = async function (){
|
||||
console.info('Try to remove item');
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "DELETE",
|
||||
};
|
||||
await fetch(host + `/reader/`, requestParams);
|
||||
getData();
|
||||
}
|
||||
|
||||
const update = async function (){
|
||||
console.info('Try to update item');
|
||||
if (readerId === 0 || readerName == null || password === 0) {
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
const response = await fetch(host + `/reader/${readerId}?readerName=${readerName}&password=${password}`, requestParams);
|
||||
getData();
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const removeManga = async function (){
|
||||
console.info('Try to remove item');
|
||||
if (!confirm('Do you really want to remove this item?')) {
|
||||
console.info('Canceled');
|
||||
return;
|
||||
}
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
console.log(host + `/reader/${readerId}/removeManga?mangaId=${mangaId}`, requestParams);
|
||||
const response = await fetch(host + `/reader/${readerId}/removeManga?mangaId=${mangaId}`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
const addManga = async function () {
|
||||
const requestParams = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
};
|
||||
console.log(host + `/reader/${readerId}/addManga?mangaId=${mangaId}`, requestParams);
|
||||
const response = await fetch(host + `/reader/${readerId}/addManga?mangaId=${mangaId}`, requestParams);
|
||||
return await response.json();
|
||||
}
|
||||
const createButton = (e) =>{
|
||||
e.preventDefault()
|
||||
create();
|
||||
}
|
||||
|
||||
const removeButton = (id) =>{
|
||||
remove(id);
|
||||
|
||||
}
|
||||
|
||||
const updateButton = (e) =>{
|
||||
e.preventDefault()
|
||||
update();
|
||||
}
|
||||
|
||||
const removeMangaButton = (e) =>{
|
||||
e.preventDefault()
|
||||
removeManga();
|
||||
}
|
||||
|
||||
const addMangaButton = (e) =>{
|
||||
e.preventDefault()
|
||||
addManga();
|
||||
}
|
||||
|
||||
const setModal_Click = (e) =>{
|
||||
e.preventDefault()
|
||||
setModal(true)
|
||||
//setData({type:'', name:'', description:'' })
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div className="container" id="root-div">
|
||||
<div className="content">
|
||||
<h1>Readers</h1>
|
||||
<form id="form">
|
||||
<div className="d-flex justify-content-evenly mt-3">
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="readerId" className="form-label">readerId</label>
|
||||
<input type='number' value = {readerId} onChange={event => setReaderId(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="mangaId" className="form-label">mangaId</label>
|
||||
<input type='number' value = {mangaId} onChange={event => setMangaId(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="readerName" className="form-label">readerName</label>
|
||||
<input type='text' value = {readerName} onChange={event => setReaderName(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="password" className="form-label">password</label>
|
||||
<input type='text' value = {password} onChange={event => setPassword(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row m-3">
|
||||
<div className="d-grid col-sm-3 m-3 mx-auto">
|
||||
<button onClick={createButton} className="btn btn-success">Добавить</button>
|
||||
</div>
|
||||
<div className="d-grid col-sm-3 m-3 mx-auto">
|
||||
<button onClick={updateButton} className="btn btn-success">Обновить</button>
|
||||
</div>
|
||||
<div className="d-grid col-sm-2 m-3 mx-auto">
|
||||
<button onClick={removeMangaButton} className="btn btn-success">Удалить мангу</button>
|
||||
</div>
|
||||
<div className="d-grid col-sm-2 m-3 mx-auto">
|
||||
<button onClick={addMangaButton} className="btn btn-success">Добавить мангу</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div className="row table-responsive text-white">
|
||||
|
||||
<table className="table mt-3 text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">readerName</th>
|
||||
<th scope="col">Password</th>
|
||||
<th scope="col">Mangs</th>
|
||||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<TableReader
|
||||
items = {data}
|
||||
remove ={removeButton}
|
||||
update ={updateButton}
|
||||
/>
|
||||
{/* <tbody id="tbody">
|
||||
</tbody> */}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import React from 'react'
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import banner1 from "../../../img/popular_1.jpg";
|
||||
import banner2 from "../../../img/popular_2.jpg";
|
||||
import banner3 from "../../../img/popular_3.jpg"
|
||||
|
||||
export default function Banner() {
|
||||
const length = 3;
|
||||
var old = length - 1;
|
||||
var current = 0;
|
||||
const navigate = useNavigate();
|
||||
const [bannerState, setBannerState] = useState(["show", "hide", "hide"]);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = window.setInterval(() => {
|
||||
setBannerState([
|
||||
...bannerState,
|
||||
(bannerState[current] = "show"),
|
||||
(bannerState[old] = "hide"),
|
||||
]);
|
||||
//setBannerState([...bannerState, ]);
|
||||
|
||||
console.info("Banner changed");
|
||||
|
||||
old = current;
|
||||
current++;
|
||||
|
||||
if (current === length) {
|
||||
current = 0;
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
return () => {
|
||||
window.clearInterval(timer);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="d-flex align-items-center flex-column" id="banner">
|
||||
<a className={bannerState[0]} style={{ cursor: "pointer" }}><img src={banner1}/></a>
|
||||
<a className={bannerState[1]} style={{ cursor: "pointer" }}><img src={banner2}/></a>
|
||||
<a className={bannerState[2]} style={{ cursor: "pointer" }}><img src={banner3}/></a>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
|
||||
|
||||
#banner {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
@keyframes newAnim {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
#banner img {
|
||||
max-width: 90%;
|
||||
border-radius: 5px;
|
||||
animation: newAnim 1s forwards;
|
||||
}
|
||||
|
||||
#banner a.show {
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#banner a.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
img.show {
|
||||
max-height: 200px;
|
||||
width: auto;
|
||||
opacity: 1;
|
||||
transition: opacity 1s, visibility 0s;
|
||||
}
|
||||
|
||||
img.hide {
|
||||
max-height: 0;
|
||||
width: 0;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 1s, visibility 0s 1s;
|
||||
}
|
||||
|
||||
@media (max-width: 700px){
|
||||
#banner{width: 0px;}
|
||||
#banner_2{width: 0px;}
|
||||
#banner img.show {
|
||||
height: 0;
|
||||
width: 0;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 1s, visibility 0s 1s;
|
||||
}
|
||||
#banner h3{
|
||||
font-size: 0em;
|
||||
}
|
||||
#banner_2 h3{
|
||||
font-size: 0em;
|
||||
}
|
||||
#banner_2 img.show {
|
||||
height: 0;
|
||||
width: 0;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 1s, visibility 0s 1s;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
const EditReaderForm =(props) => {
|
||||
|
||||
const types = ([
|
||||
{name:'Манга'},
|
||||
{name:'Манхва'},
|
||||
{name:'Маньхуа'},
|
||||
])
|
||||
|
||||
function done(e) {
|
||||
e.preventDefault();
|
||||
// if (formRef.current.checkValidity()) {
|
||||
// props.onDone();
|
||||
// props.setModalEdit();
|
||||
// props.setData({type:'', name:'', description:'' })
|
||||
// }else {
|
||||
// formRef.current.reportValidity();
|
||||
// props.setData({type:'', name:'', description:'' })
|
||||
// }
|
||||
}
|
||||
|
||||
const formRef = React.createRef();
|
||||
|
||||
return (
|
||||
<form id="frm-items" ref={formRef} className="row g-3 text-dark">
|
||||
<div className="col-md-3 ">
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="readerName" className="form-label">readerName</label>
|
||||
<input type='text' value = {props.readerName} onChange={event => props.setReaderName(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-sm-2">
|
||||
<label htmlFor="password" className="form-label">password</label>
|
||||
<input type='text' value = {props.password} onChange={event => props.setPassword(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div className="col-md-3">
|
||||
<button onClick={() => props.update(item.id)} id="btn-add-item" className="btn btn-primary" type="submit">Изменить</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
export default EditReaderForm
|
@ -1,27 +0,0 @@
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
export default function Header(props) {
|
||||
return (
|
||||
<nav className="navbar navbar-expand-lg navbar-dark">
|
||||
<div className="container-fluid">
|
||||
<button className="navbar-toggler" type="button"
|
||||
data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span className="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div className="collapse navbar-collapse" id="navbarNav">
|
||||
<ul className="navbar-nav">
|
||||
{props.links.map(route =>
|
||||
<li key={route.path}
|
||||
className="nav-item">
|
||||
<NavLink className="nav-link" to={route.path}>
|
||||
{route.label}
|
||||
</NavLink>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav >
|
||||
);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../Table/TableCreator';
|
||||
import MangaDto from "../../Dto/Manga-Dto";
|
||||
|
||||
export default function MangaCreatorList(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className="row table-responsive text-white">
|
||||
{
|
||||
props.creator.mangas?.map((manga) =>
|
||||
<div key={manga.id} className="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||
<div className="me-3">
|
||||
<NavLink to={`/mangapage?id=${manga.id}`} ><img src={manga.image} alt={manga.mangaName} className="slideshow" /></NavLink>
|
||||
</div>
|
||||
<div>
|
||||
<div className="pt-3 description d-flex flex-column justify-content-start mb-3 fs-6 fw-bold">
|
||||
<NavLink className="text-white fs-5 unic_class fw-bold pt-3 mb-3"
|
||||
to={`/mangapage?id=${manga.id}`}>Название: {manga.mangaName}
|
||||
</NavLink>
|
||||
<p>Глав: {manga.chapterCount}</p>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" className="btn btn-primary" onClick = {() => props.setMangaIdButton(manga.id)} data-bs-toggle="modal" data-bs-target="#exampleModal">
|
||||
<i className="fas fa-edit"></i>
|
||||
</button>
|
||||
<button className="delete bg-danger p-2 px-2 mx-2 border border-0 rounded text-white fw-bold" onClick = {() => props.removeButton(manga.id)} type="button">Удалить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../Table/TableCreator';
|
||||
import MangaDto from "../../Dto/Manga-Dto";
|
||||
|
||||
export default function MangaReaderList(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className="row table-responsive text-white">
|
||||
{
|
||||
props.reader.mangas?.map((manga) =>
|
||||
<div key={manga.id} className="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||
<div className="me-3">
|
||||
<NavLink to={`/mangapage?id=${manga.id}`} ><img src={manga.image} alt={manga.mangaName} className="slideshow" /></NavLink>
|
||||
</div>
|
||||
<div>
|
||||
<div className="pt-3 description d-flex flex-column justify-content-start mb-3 fs-6 fw-bold">
|
||||
<NavLink className="text-white fs-5 unic_class fw-bold pt-3 mb-3"
|
||||
to={`/mangapage?id=${manga.id}`}>Название: {manga.mangaName}
|
||||
</NavLink>
|
||||
<p>Глав: {manga.chapterCount}</p>
|
||||
</div>
|
||||
<div>
|
||||
<button className="delete bg-danger p-2 px-2 mx-2 border border-0 rounded text-white fw-bold" onClick = {() => props.removeButton(manga.id)} type="button">Удалить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
export default function ReaderList(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className="row table-responsive text-white">
|
||||
{
|
||||
props.readers?.map((reader) =>
|
||||
<div key={reader.id} className="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||
<div>
|
||||
<div className="pt-3 description d-flex flex-column justify-content-start mb-3 fs-6 fw-bold">
|
||||
<NavLink className="text-white fs-5 fw-bold pt-3 mb-3"
|
||||
to={`/readeraction?id=${reader.id}`}>Имя пользователя: {reader.readerName}
|
||||
</NavLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../Table/TableCreator';
|
||||
import MangaDto from "../../Dto/Manga-Dto";
|
||||
|
||||
export default function AddMangaModal(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className="modal fade text-black" id="exampleModal2" tabIndex="-1" aria-labelledby="exampleModalLabel2" aria-hidden="true">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title" id="exampleModalLabel2">Создание манги</h5>
|
||||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div>
|
||||
<label htmlFor="chapterCount" className="form-label">chapterCount</label>
|
||||
<input type='number' value = {props.chapterCount} onChange={event => props.setChapterCount(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="mangaName" className="form-label">mangaName</label>
|
||||
<input type='text' value = {props.mangaName} onChange={event => props.setMangaName(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div>
|
||||
<label
|
||||
htmlFor="file-loader-button"
|
||||
className="form-label">
|
||||
Загрузить файл
|
||||
</label>
|
||||
<input
|
||||
id="file-loader-button"
|
||||
type="file"
|
||||
className="form-control text-white"
|
||||
onChange={props.handleOnChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" onClick={props.createButton} className="btn btn-primary" data-bs-dismiss="modal">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../Table/TableCreator';
|
||||
import MangaDto from "../../Dto/Manga-Dto";
|
||||
|
||||
export default function AddMangaReaderModal(props) {
|
||||
|
||||
|
||||
return (
|
||||
<div className="modal fade text-black" id="exampleModal2" tabIndex="-1" aria-labelledby="exampleModalLabel2" aria-hidden="true">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title" id="exampleModalLabel2">Добавление манги к читателю</h5>
|
||||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div>
|
||||
<select className="form-select" value={props.mangaId} onChange={event => props.setMangaId(event.target.value)} aria-label="Default select example">
|
||||
<option value={0}>Manga</option>
|
||||
{
|
||||
props.mangaData.map((mangaD) =>
|
||||
<option key={mangaD.id} value={mangaD.id}>{mangaD.mangaName}</option>
|
||||
)
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" onClick={props.addMangaButton} className="btn btn-primary" data-bs-dismiss="modal">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import TableCreator from '../Table/TableCreator';
|
||||
import MangaDto from "../../Dto/Manga-Dto";
|
||||
|
||||
export default function EditMangaModal(props) {
|
||||
|
||||
return (
|
||||
<div className="modal fade text-black" id="exampleModal" tabIndex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title" id="exampleModalLabel">Изменение манги</h5>
|
||||
<button type="button" className="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div>
|
||||
<label htmlFor="chapterCount" className="form-label">chapterCount</label>
|
||||
<input type='number' value={props.chapterCount} onChange={event => props.setChapterCount(event.target.value)} className="form-control"/>
|
||||
</div>
|
||||
<div>
|
||||
<label
|
||||
htmlFor="file-loader-button"
|
||||
className="form-label">
|
||||
Загрузить файл
|
||||
</label>
|
||||
<input
|
||||
id="file-loader-button"
|
||||
type="file"
|
||||
className="form-control text-white"
|
||||
onChange={props.handleOnChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button type="button" className="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" onClick={props.updateButton} className="btn btn-primary" data-bs-dismiss="modal">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
|
||||
export default function TableCreator(props) {
|
||||
|
||||
return (
|
||||
<tbody>
|
||||
{
|
||||
props.items?.map((item, index) =>
|
||||
<tr key={item.id}>
|
||||
<td>{item.id}</td>
|
||||
<td>{item.creatorName}</td>
|
||||
<td>{item.hashedPassword}</td>
|
||||
<td>
|
||||
<select className="form-select" aria-label="Default select example">{item.mangas?.map(manga =>
|
||||
<option key={manga.mangaName } >{manga.mangaName + " " +manga.chapterCount}</option>)}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
</tbody >
|
||||
);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
|
||||
export default function TableReader(props) {
|
||||
|
||||
return (
|
||||
<tbody>
|
||||
{
|
||||
props.items?.map((item, index) =>
|
||||
<tr key={item.id}>
|
||||
<td>{item.id}</td>
|
||||
<td>{item.readerName}</td>
|
||||
<td>{item.hashedPassword}</td>
|
||||
<td>
|
||||
<select className="form-select" aria-label="Default select example">{item.mangas?.map(manga =>
|
||||
<option key={manga.id}>{manga.mangaName}</option>)}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button onClick={() => props.remove(item.id)} className="btn btn-success">Удалить</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
</tbody >
|
||||
);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App'
|
||||
import './style.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('app')).render(
|
||||
<App />
|
||||
)
|
@ -1,107 +0,0 @@
|
||||
html,
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: sans-serif;
|
||||
line-height: 1.15;
|
||||
height: 100%;
|
||||
}
|
||||
header {
|
||||
background-color: #3c3c3c;
|
||||
color: #ffffff;
|
||||
}
|
||||
header a {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
header a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#logo {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
article a {
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
margin: 0.5em 0.5em;
|
||||
}
|
||||
header a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
footer {
|
||||
background-color: #9c9c9c;
|
||||
color: #ffffff;
|
||||
height: 32px;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.manga_pages{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.catalog_wrapper{
|
||||
display: flex;
|
||||
width: 73%;
|
||||
flex-direction: column;
|
||||
}
|
||||
.catalog_article{
|
||||
display: flex;
|
||||
}
|
||||
.poster{
|
||||
width:140px;
|
||||
}
|
||||
th {
|
||||
border: 0px solid rgb(255, 255, 255);
|
||||
}
|
||||
.added_manga{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.manga_pages img{
|
||||
max-width: 900px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
.flex_grow {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@media (min-width: 1024px){
|
||||
.article_1 {
|
||||
max-width: -webkit-calc(1600px + (100vw/64*7)*2);
|
||||
max-width: -moz-calc(1600px + (100vw/64*7)*2);
|
||||
max-width: calc(1600px + (100vw/64*7)*2);
|
||||
padding-left: -webkit-calc(100vw/64*7);
|
||||
padding-left: -moz-calc(100vw/64*7);
|
||||
padding-left: calc(100vw/64*7);
|
||||
padding-right: -webkit-calc(100vw/64*7);
|
||||
padding-right: -moz-calc(100vw/64*7);
|
||||
padding-right: calc(100vw/64*7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.registration_div {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.slideshow{
|
||||
height: 250px;
|
||||
width: auto;/*maintain aspect ratio*/
|
||||
max-width:180px;
|
||||
border-radius: 7%;
|
||||
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
6
gradlew
vendored
@ -205,12 +205,6 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
14
gradlew.bat
vendored
@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@ -25,7 +25,7 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@ -75,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
@ -1,2 +1 @@
|
||||
rootProject.name = 'app'
|
||||
include 'front'
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.LabWork.app.MangaStore.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@Configuration
|
||||
public class PasswordEncoderConfiguration {
|
||||
@Bean
|
||||
public PasswordEncoder createPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package com.LabWork.app.MangaStore.configuration;
|
||||
|
||||
import com.LabWork.app.MangaStore.controller.User.UserSignupMvcController;
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
import com.LabWork.app.MangaStore.service.UserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableGlobalMethodSecurity(securedEnabled = true)
|
||||
public class SecurityConfiguration {
|
||||
private final Logger log = LoggerFactory.getLogger(SecurityConfiguration.class);
|
||||
private static final String LOGIN_URL = "/login";
|
||||
private final UserService userService;
|
||||
|
||||
public SecurityConfiguration(UserService userService) {
|
||||
this.userService = userService;
|
||||
createAdminOnStartup();
|
||||
}
|
||||
|
||||
private void createAdminOnStartup() {
|
||||
final String admin = "admin";
|
||||
if (userService.findByLogin(admin) == null) {
|
||||
log.info("Admin user successfully created");
|
||||
userService.createUser(admin, admin, admin, UserRole.ADMIN);
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http.headers().frameOptions().sameOrigin().and()
|
||||
.cors().and()
|
||||
.csrf().disable()
|
||||
.authorizeHttpRequests()
|
||||
.requestMatchers(UserSignupMvcController.SIGNUP_URL).permitAll()
|
||||
.requestMatchers(HttpMethod.GET, LOGIN_URL).permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.formLogin()
|
||||
.loginPage(LOGIN_URL).permitAll()
|
||||
.and()
|
||||
.logout().permitAll();
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManagerBean(HttpSecurity http) throws Exception {
|
||||
AuthenticationManagerBuilder authenticationManagerBuilder = http
|
||||
.getSharedObject(AuthenticationManagerBuilder.class);
|
||||
authenticationManagerBuilder.userDetailsService(userService);
|
||||
return authenticationManagerBuilder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSecurityCustomizer webSecurityCustomizer() {
|
||||
return web -> web.ignoring()
|
||||
.requestMatchers("/css/**")
|
||||
.requestMatchers("/js/**")
|
||||
.requestMatchers("/templates/**")
|
||||
.requestMatchers("/webjars/**")
|
||||
.requestMatchers("/vk.jpg");
|
||||
}
|
||||
}
|
@ -1,15 +1,18 @@
|
||||
package com.LabWork.app;
|
||||
package com.LabWork.app.MangaStore.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.servlet.config.annotation.*;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
|
||||
@Configuration
|
||||
public class WebConfiguration implements WebMvcConfigurer {
|
||||
public static final String REST_API = "/api";
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*");
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
WebMvcConfigurer.super.addViewControllers(registry);
|
||||
registry.addViewController("login");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -18,9 +21,7 @@ public class WebConfiguration implements WebMvcConfigurer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
ViewControllerRegistration registration = registry.addViewController("/notFound");
|
||||
registration.setViewName("forward:/index.html");
|
||||
registration.setStatusCode(HttpStatus.OK);
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*");
|
||||
}
|
||||
}
|
@ -5,8 +5,11 @@ import com.LabWork.app.MangaStore.model.Dto.SupportDto.MangaDto;
|
||||
import com.LabWork.app.MangaStore.service.CreatorService;
|
||||
import com.LabWork.app.MangaStore.service.MangaService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
@ -14,10 +17,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
import java.util.Base64;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/creatorAction")
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
public class CreatorActionMvcController {
|
||||
private final CreatorService creatorService;
|
||||
private static final Logger log = LoggerFactory.getLogger(CreatorActionMvcController.class);
|
||||
@ -29,71 +34,71 @@ public class CreatorActionMvcController {
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
public String getCreator(@RequestParam(value = "creatorId", required = false) Long creatorId, Model model) {
|
||||
public String getCreator(Model model, Principal principal) {
|
||||
model.addAttribute("creators",
|
||||
creatorService.findAllCreators().stream()
|
||||
.map(CreatorMangaDto::new)
|
||||
.toList());
|
||||
if(creatorId != null){
|
||||
model.addAttribute("currentCreator", new CreatorMangaDto(creatorService.findCreator(creatorId)));
|
||||
}
|
||||
model.addAttribute("creatorId", creatorId);
|
||||
CreatorMangaDto currentCreator = new CreatorMangaDto(creatorService.findByLogin(principal.getName()));
|
||||
model.addAttribute("currentCreator", currentCreator);
|
||||
return "creatorAction";
|
||||
}
|
||||
|
||||
@GetMapping("/edit/{id}")
|
||||
public String editManga(@PathVariable Long id, Model model) {
|
||||
model.addAttribute("Id", id);
|
||||
model.addAttribute("mangaDto", new MangaDto(mangaService.findManga(id)));
|
||||
model.addAttribute("controller", "manga/");
|
||||
return "creatorAction-edit";
|
||||
public String editManga(@PathVariable Long id, Model model, Principal principal) {
|
||||
if (principal.getName().equals(principal.getName())) {
|
||||
model.addAttribute("Id", id);
|
||||
model.addAttribute("mangaDto", new MangaDto(mangaService.findManga(id)));
|
||||
model.addAttribute("controller", "manga/");
|
||||
return "creatorAction-edit";
|
||||
}
|
||||
return "creatorAction";
|
||||
}
|
||||
|
||||
@GetMapping("/create/{id}")
|
||||
public String createManga(@PathVariable Long id, Model model) {
|
||||
model.addAttribute("Id", id);
|
||||
@GetMapping("/create")
|
||||
public String createManga(Model model, Principal principal) {
|
||||
model.addAttribute("mangaDto", new MangaDto());
|
||||
model.addAttribute("controller", "creator/");
|
||||
return "creatorAction-edit";
|
||||
}
|
||||
|
||||
@PostMapping( "/creator/{creatorId}")
|
||||
public String saveManga(@PathVariable(value = "creatorId", required = false) Long creatorId,
|
||||
@RequestParam("multipartFile") MultipartFile multipartFile,
|
||||
@PostMapping( "/creator")
|
||||
public String saveManga(@RequestParam("multipartFile") MultipartFile multipartFile,
|
||||
@ModelAttribute @Valid MangaDto mangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model) throws IOException {
|
||||
Model model,
|
||||
Principal principal) throws IOException {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "creatorAction-edit";
|
||||
}
|
||||
mangaDto.setImage("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
|
||||
mangaDto.setCreatorId(creatorId);
|
||||
mangaDto.setLogin(principal.getName());
|
||||
mangaService.addManga(mangaDto);
|
||||
return "redirect:/creatorAction?creatorId=" + creatorId;
|
||||
|
||||
return "redirect:/creatorAction";
|
||||
}
|
||||
|
||||
@PostMapping( "/manga/{mangaId}")
|
||||
public String updateManga(@PathVariable(value = "mangaId", required = false) Long mangaId, @RequestParam("multipartFile") MultipartFile multipartFile,
|
||||
@ModelAttribute @Valid MangaDto mangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model) throws IOException {
|
||||
@ModelAttribute @Valid MangaDto mangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model,
|
||||
Principal principal) throws IOException {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "creatorAction-edit";
|
||||
}
|
||||
mangaDto.setImage("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
|
||||
mangaService.updateManga(mangaId, mangaDto.getChapterCount(), mangaDto.getImage());
|
||||
return "redirect:/creatorAction?creatorId=" + mangaService.findManga(mangaId).getCreatorId();
|
||||
return "redirect:/creatorAction";
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public String deleteCreator(@PathVariable Long id) {
|
||||
Long creatorId = mangaService.findManga(id).getCreatorId();
|
||||
mangaService.deleteManga(id);
|
||||
@PostMapping("/delete/{mangaId}")
|
||||
public String deleteCreator(@PathVariable Long mangaId, Principal principal) {
|
||||
Long creatorId = mangaService.findManga(mangaId).getCreatorId();
|
||||
mangaService.deleteManga(mangaId);
|
||||
if (creatorId != null){
|
||||
return "redirect:/creatorAction?creatorId=" + creatorId;
|
||||
return "redirect:/creatorAction";
|
||||
} else {
|
||||
return "redirect:/creatorAction";
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
package com.LabWork.app.MangaStore.controller.Creator;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.CreatorMangaDto;
|
||||
import com.LabWork.app.MangaStore.service.CreatorService;
|
||||
import com.LabWork.app.WebConfiguration;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(WebConfiguration.REST_API + "/creator")
|
||||
public class CreatorController {
|
||||
private final CreatorService creatorService;
|
||||
|
||||
public CreatorController(CreatorService creatorService) {
|
||||
this.creatorService = creatorService;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CreatorMangaDto getCreator(@PathVariable Long id) {
|
||||
return new CreatorMangaDto(creatorService.findCreator(id));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<CreatorMangaDto> getCreators() {
|
||||
return creatorService.findAllCreators().stream()
|
||||
.map(CreatorMangaDto::new)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CreatorMangaDto createCreator(@RequestParam("creatorName") String creatorName,
|
||||
@RequestParam("password") String password) {
|
||||
return new CreatorMangaDto(creatorService.addCreator(creatorName, password));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public CreatorMangaDto updateCreator(@PathVariable Long id,
|
||||
@RequestParam("creatorName") String creatorName,
|
||||
@RequestParam("password") String password) {
|
||||
return new CreatorMangaDto(creatorService.updateCreator(id, creatorName, password));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public CreatorMangaDto deleteCreator(@PathVariable Long id) {
|
||||
//creatorService.deleteAllCreators();
|
||||
return new CreatorMangaDto(creatorService.deleteCreator(id));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public void deleteAllCreator() {
|
||||
creatorService.deleteAllCreators();
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package com.LabWork.app.MangaStore.controller.Creator;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.CreatorMangaDto;
|
||||
import com.LabWork.app.MangaStore.service.CreatorService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/creator")
|
||||
public class CreatorMvcController {
|
||||
private final CreatorService creatorService;
|
||||
|
||||
public CreatorMvcController(CreatorService creatorService) {
|
||||
this.creatorService = creatorService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String getCreators(Model model) {
|
||||
model.addAttribute("creators",
|
||||
creatorService.findAllCreators().stream()
|
||||
.map(CreatorMangaDto::new)
|
||||
.toList());
|
||||
return "creator";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/edit", "/edit/{id}"})
|
||||
public String editCreator(@PathVariable(required = false) Long id,
|
||||
Model model) {
|
||||
if (id == null || id <= 0) {
|
||||
model.addAttribute("CreatorMangaDto", new CreatorMangaDto());
|
||||
} else {
|
||||
model.addAttribute("creatorId", id);
|
||||
model.addAttribute("CreatorMangaDto", new CreatorMangaDto(creatorService.findCreator(id)));
|
||||
}
|
||||
return "creator-edit";
|
||||
}
|
||||
|
||||
@PostMapping(value = {"", "/{id}"})
|
||||
public String saveCreator(@PathVariable(required = false) Long id,
|
||||
@ModelAttribute @Valid CreatorMangaDto creatorMangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "creator-edit";
|
||||
}
|
||||
if (id == null || id <= 0) {
|
||||
creatorService.addCreator(creatorMangaDto.getCreatorName(), creatorMangaDto.getHashedPassword());
|
||||
} else {
|
||||
creatorService.updateCreator(id, creatorMangaDto.getCreatorName(), creatorMangaDto.getHashedPassword());
|
||||
}
|
||||
return "redirect:/creator";
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public String deleteCreator(@PathVariable Long id) {
|
||||
creatorService.deleteCreator(id);
|
||||
return "redirect:/creator";
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.LabWork.app.MangaStore.controller.Manga;
|
||||
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.MangaReaderDto;
|
||||
import com.LabWork.app.MangaStore.model.Dto.ReaderMangaDto;
|
||||
import com.LabWork.app.MangaStore.model.Dto.SupportDto.MangaDto;
|
||||
import com.LabWork.app.MangaStore.service.MangaService;
|
||||
import com.LabWork.app.WebConfiguration;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(WebConfiguration.REST_API + "/manga")
|
||||
public class MangaController {
|
||||
private final MangaService mangaService;
|
||||
|
||||
public MangaController(MangaService mangaService) {
|
||||
this.mangaService = mangaService;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public MangaReaderDto getManga(@PathVariable Long id) {
|
||||
return new MangaReaderDto(mangaService.findManga(id), mangaService.getReader(id));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<MangaReaderDto> getMangas() {
|
||||
return mangaService.findAllMangas().stream()
|
||||
.map(x -> new MangaReaderDto(x, mangaService.getReader(x.getId())))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}/readers")
|
||||
public List<ReaderMangaDto> getReaders(@PathVariable Long id) {
|
||||
return mangaService.getReader(id).stream()
|
||||
.map(x -> new ReaderMangaDto(x))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public MangaDto deleteManga(@PathVariable Long id) {
|
||||
return new MangaDto(mangaService.deleteManga(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public MangaDto createManga(@RequestBody @Valid MangaDto mangaDto) {
|
||||
return new MangaDto(mangaService.addManga(mangaDto));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public MangaDto updateManga(@RequestBody @Valid MangaDto mangaDto) {
|
||||
return new MangaDto(mangaService.updateManga(mangaDto));
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ public class MangaMvcController {
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
public String getMangaAnfReaders(Model model) {
|
||||
public String getMangaAndReaders(Model model) {
|
||||
model.addAttribute("mangaList", mangaService.findAllMangas().stream()
|
||||
.map(x -> new MangaDto(x))
|
||||
.toList());
|
||||
@ -28,7 +28,7 @@ public class MangaMvcController {
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public String getMangaAnfReaders(@PathVariable Long id, Model model) {
|
||||
public String getMangaAndReaders(@PathVariable Long id, Model model) {
|
||||
model.addAttribute("manga", new MangaReaderDto(mangaService.findManga(id), mangaService.getReader(id)));
|
||||
model.addAttribute("readers", mangaService.getReader(id).stream()
|
||||
.map(x -> new ReaderMangaDto(x))
|
||||
|
@ -1,21 +1,26 @@
|
||||
package com.LabWork.app.MangaStore.controller.Reader;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.CreatorMangaDto;
|
||||
import com.LabWork.app.MangaStore.model.Dto.ReaderMangaDto;
|
||||
import com.LabWork.app.MangaStore.model.Dto.SupportDto.MangaDto;
|
||||
import com.LabWork.app.MangaStore.service.ReaderService;
|
||||
import com.LabWork.app.MangaStore.service.MangaService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/readerAction")
|
||||
@Secured({UserRole.AsString.USER})
|
||||
public class ReaderActionMvcController {
|
||||
private final ReaderService readerService;
|
||||
private static final Logger log = LoggerFactory.getLogger(ReaderActionMvcController.class);
|
||||
@ -27,6 +32,20 @@ public class ReaderActionMvcController {
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
public String getReader(Model model, Principal principal) {
|
||||
model.addAttribute("readers",
|
||||
readerService.findAllReaders().stream()
|
||||
.map(ReaderMangaDto::new)
|
||||
.toList());
|
||||
ReaderMangaDto currentReader = new ReaderMangaDto(readerService.findByLogin(principal.getName()));
|
||||
model.addAttribute("readerId", currentReader.getId());
|
||||
model.addAttribute("reader", new ReaderMangaDto(readerService.findReader(currentReader.getId())));
|
||||
model.addAttribute("MangaDto", new MangaDto());
|
||||
model.addAttribute("mangaList", mangaService.findAllMangas());
|
||||
return "readerAction";
|
||||
}
|
||||
|
||||
/* @GetMapping()
|
||||
public String getReader(@RequestParam(value = "readerId", required = false) Long readerId, Model model) {
|
||||
model.addAttribute("readers",
|
||||
readerService.findAllReaders().stream()
|
||||
@ -42,25 +61,25 @@ public class ReaderActionMvcController {
|
||||
model.addAttribute("MangaDto", new MangaDto());
|
||||
model.addAttribute("mangaList", mangaService.findAllMangas());
|
||||
return "readerAction";
|
||||
}
|
||||
}*/
|
||||
|
||||
@PostMapping("/manga/{readerId}")
|
||||
public String saveManga(@PathVariable Long readerId,
|
||||
@RequestParam("mangaId") Long mangaId,
|
||||
@PostMapping("/manga")
|
||||
public String saveManga(@RequestParam("mangaId") Long mangaId,
|
||||
@ModelAttribute @Valid MangaDto MangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model){
|
||||
Model model,
|
||||
Principal principal){
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "readerAction";
|
||||
}
|
||||
readerService.addManga(mangaId, readerId);
|
||||
return "redirect:/readerAction/?readerId=" + readerId;
|
||||
readerService.addManga(mangaId, principal.getName());
|
||||
return "redirect:/readerAction";
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/removeManga/{mangaId}")
|
||||
public String removeManga(@PathVariable Long id, @PathVariable Long mangaId) {
|
||||
readerService.removeManga(mangaId, id);
|
||||
return "redirect:/readerAction/?readerId=" + id;
|
||||
@PostMapping("/removeManga/{mangaId}")
|
||||
public String removeManga(@PathVariable Long mangaId, Principal principal) {
|
||||
readerService.removeManga(mangaId, principal.getName());
|
||||
return "redirect:/readerAction/?readerLogin=" + principal.getName();
|
||||
}
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
package com.LabWork.app.MangaStore.controller.Reader;
|
||||
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.ReaderMangaDto;
|
||||
import com.LabWork.app.MangaStore.model.Dto.SupportDto.MangaDto;
|
||||
import com.LabWork.app.MangaStore.service.ReaderService;
|
||||
import com.LabWork.app.WebConfiguration;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(WebConfiguration.REST_API + "/reader")
|
||||
public class ReaderController {
|
||||
private final ReaderService readerService;
|
||||
|
||||
public ReaderController(ReaderService readerService) {
|
||||
this.readerService = readerService;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ReaderMangaDto getReader(@PathVariable Long id) {
|
||||
return new ReaderMangaDto(readerService.findReader(id));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<ReaderMangaDto> getReaders() {
|
||||
return readerService.findAllReaders().stream()
|
||||
.map(ReaderMangaDto::new)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ReaderMangaDto createReader(@RequestParam("readerName") String readerName,
|
||||
@RequestParam("password") String password) {
|
||||
return new ReaderMangaDto(readerService.addReader(readerName, password));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public ReaderMangaDto updateReader(@PathVariable Long id,
|
||||
@RequestParam("readerName") String readerName,
|
||||
@RequestParam("password") String password) {
|
||||
return new ReaderMangaDto(readerService.updateReader(id, readerName, password));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/addManga")
|
||||
public MangaDto addManga(@PathVariable Long id,
|
||||
@RequestParam("mangaId") Long mangaId) {
|
||||
return new MangaDto(readerService.addManga(mangaId, id));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/removeManga")
|
||||
public MangaDto removeManga(@PathVariable Long id,
|
||||
@RequestParam("mangaId") Long mangaId) {
|
||||
return new MangaDto(readerService.removeManga(mangaId, id));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ReaderMangaDto deleteReader(@PathVariable Long id) {
|
||||
return new ReaderMangaDto(readerService.deleteReader(id));
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package com.LabWork.app.MangaStore.controller.Reader;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.ReaderMangaDto;
|
||||
import com.LabWork.app.MangaStore.service.ReaderService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/reader")
|
||||
public class ReaderMvcController {
|
||||
private final ReaderService readerService;
|
||||
|
||||
public ReaderMvcController(ReaderService readerService) {
|
||||
this.readerService = readerService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String getReaders(Model model) {
|
||||
model.addAttribute("readers",
|
||||
readerService.findAllReaders().stream()
|
||||
.map(ReaderMangaDto::new)
|
||||
.toList());
|
||||
return "reader";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/edit", "/edit/{id}"})
|
||||
public String editReader(@PathVariable(required = false) Long id,
|
||||
Model model) {
|
||||
if (id == null || id <= 0) {
|
||||
model.addAttribute("ReaderMangaDto", new ReaderMangaDto());
|
||||
} else {
|
||||
model.addAttribute("readerId", id);
|
||||
model.addAttribute("ReaderMangaDto", new ReaderMangaDto(readerService.findReader(id)));
|
||||
}
|
||||
return "reader-edit";
|
||||
}
|
||||
|
||||
@PostMapping(value = {"", "/{id}"})
|
||||
public String saveReader(@PathVariable(required = false) Long id,
|
||||
@ModelAttribute @Valid ReaderMangaDto readerMangaDto,
|
||||
BindingResult bindingResult,
|
||||
Model model) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "reader-edit";
|
||||
}
|
||||
if (id == null || id <= 0) {
|
||||
readerService.addReader(readerMangaDto.getReaderName(), readerMangaDto.getHashedPassword());
|
||||
} else {
|
||||
readerService.updateReader(id, readerMangaDto.getReaderName(), readerMangaDto.getHashedPassword());
|
||||
}
|
||||
return "redirect:/reader";
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public String deleteReader(@PathVariable Long id) {
|
||||
readerService.deleteReader(id);
|
||||
return "redirect:/reader";
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.LabWork.app.MangaStore.controller.User;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Dto.UserDto;
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
import com.LabWork.app.MangaStore.service.UserService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/users")
|
||||
public class UserMvcController {
|
||||
private final UserService userService;
|
||||
|
||||
public UserMvcController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Secured({UserRole.AsString.ADMIN})
|
||||
@GetMapping
|
||||
public String getUsers(@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "5") int size,
|
||||
Model model) {
|
||||
final Page<UserDto> users = userService.findAllPages(page, size)
|
||||
.map(UserDto::new);
|
||||
model.addAttribute("users", users);
|
||||
final int totalPages = users.getTotalPages();
|
||||
final List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages)
|
||||
.boxed()
|
||||
.toList();
|
||||
model.addAttribute("pages", pageNumbers);
|
||||
model.addAttribute("totalPages", totalPages);
|
||||
return "users";
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.LabWork.app.MangaStore.controller.User;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import com.LabWork.app.MangaStore.model.Dto.UserSignupDto;
|
||||
import com.LabWork.app.MangaStore.service.UserService;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidationException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(UserSignupMvcController.SIGNUP_URL)
|
||||
public class UserSignupMvcController {
|
||||
public static final String SIGNUP_URL = "/signup";
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public UserSignupMvcController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String showSignupForm(Model model) {
|
||||
model.addAttribute("userDto", new UserSignupDto());
|
||||
return "signup";
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public String signup(@ModelAttribute("userDto") @Valid UserSignupDto userSignupDto,
|
||||
BindingResult bindingResult,
|
||||
Model model) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||
return "signup";
|
||||
}
|
||||
try {
|
||||
final User user = userService.createUser(
|
||||
userSignupDto.getLogin(), userSignupDto.getPassword(), userSignupDto.getPasswordConfirm(), userSignupDto.getUserRole());
|
||||
return "redirect:/login?created=" + user.getLogin();
|
||||
} catch (ValidationException e) {
|
||||
model.addAttribute("errors", e.getMessage());
|
||||
return "signup";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.LabWork.app.MangaStore.model.Default;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -10,16 +9,11 @@ import java.util.Objects;
|
||||
@Entity
|
||||
public class Creator {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "creatorName can't be null or empty")
|
||||
@Column
|
||||
private String creatorName;
|
||||
|
||||
@NotBlank(message = "hashedPassword can't be null or empty")
|
||||
@Column
|
||||
private String hashedPassword;
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@MapsId
|
||||
private User user;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "creator", cascade = CascadeType.REMOVE)
|
||||
private List<Manga> mangas;
|
||||
@ -27,9 +21,9 @@ public class Creator {
|
||||
public Creator() {
|
||||
}
|
||||
|
||||
public Creator(String creatorName, String hashedPassword) {
|
||||
this.creatorName = creatorName;
|
||||
this.hashedPassword = hashedPassword;
|
||||
public Creator(User user) {
|
||||
this.user = user;
|
||||
this.id = user.getId();
|
||||
this.mangas = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -41,25 +35,11 @@ public class Creator {
|
||||
return mangas;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public String getHashedPassword() {
|
||||
return hashedPassword;
|
||||
}
|
||||
|
||||
public void setMangas(List<Manga> mangas) {
|
||||
this.mangas = mangas;
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public void setHashedPassword(String hashedPassword) {
|
||||
this.hashedPassword = hashedPassword;
|
||||
}
|
||||
public User getUser() { return user; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@ -78,8 +58,6 @@ public class Creator {
|
||||
public String toString() {
|
||||
return "Creator{" +
|
||||
"id=" + id +
|
||||
", creatorName='" + creatorName + '\'' +
|
||||
", hashedPassword='" + hashedPassword + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ public class Manga {
|
||||
@JoinColumn(name="creator_fk")
|
||||
private Creator creator;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
@Lob
|
||||
private byte[] image;
|
||||
public Manga() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.LabWork.app.MangaStore.model.Default;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -10,14 +9,11 @@ import java.util.Objects;
|
||||
@Entity
|
||||
public class Reader {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
private String readerName;
|
||||
|
||||
@Column
|
||||
private String hashedPassword;
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@MapsId
|
||||
private User user;
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
|
||||
/*@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)*/
|
||||
@ -27,9 +23,15 @@ public class Reader {
|
||||
public Reader() {
|
||||
}
|
||||
|
||||
public Reader(String readerName, String hashedPassword) {
|
||||
this.readerName = readerName;
|
||||
this.hashedPassword = hashedPassword;
|
||||
public Reader(String creatorName, String hashedPassword) {
|
||||
this.user = user;
|
||||
this.id = user.getId();
|
||||
this.mangas = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Reader(User user) {
|
||||
this.user = user;
|
||||
this.id = user.getId();
|
||||
this.mangas = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -37,20 +39,12 @@ public class Reader {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getReaderName() { return readerName; }
|
||||
|
||||
public void setReaderName(String readerName) { this.readerName = readerName; }
|
||||
|
||||
public String getHashedPassword() { return hashedPassword; }
|
||||
|
||||
public void setHashedPassword(String hashedPassword) { this.hashedPassword = hashedPassword; }
|
||||
|
||||
public List<Manga> getMangas() { return mangas; }
|
||||
|
||||
public void setMangas(List<Manga> mangas) { this.mangas = mangas; }
|
||||
|
||||
public User getUser() { return user; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@ -68,8 +62,6 @@ public class Reader {
|
||||
public String toString() {
|
||||
return "Reader{" +
|
||||
"id=" + id +
|
||||
", readerName='" + readerName + '\'' +
|
||||
", hashedPassword='" + hashedPassword + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.LabWork.app.MangaStore.model.Default;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
public class User {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
@Column(nullable = false, unique = true, length = 64)
|
||||
@NotBlank
|
||||
@Size(min = 3, max = 64)
|
||||
private String login;
|
||||
@Column(nullable = false, length = 64)
|
||||
@NotBlank
|
||||
@Size(min = 6, max = 64)
|
||||
private String password;
|
||||
private UserRole role;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(String login, String password) {
|
||||
this(login, password, UserRole.USER);
|
||||
}
|
||||
|
||||
public User(String login, String password, UserRole role) {
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public UserRole getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) && Objects.equals(login, user.login);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, login);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.LabWork.app.MangaStore.model.Default;
|
||||
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
public enum UserRole implements GrantedAuthority {
|
||||
ADMIN,
|
||||
USER;
|
||||
|
||||
private static final String PREFIX = "ROLE_";
|
||||
|
||||
@Override
|
||||
public String getAuthority() {
|
||||
return PREFIX + this.name();
|
||||
}
|
||||
|
||||
public static final class AsString {
|
||||
public static final String ADMIN = PREFIX + "ADMIN";
|
||||
public static final String USER = PREFIX + "USER";
|
||||
}
|
||||
}
|
@ -16,8 +16,8 @@ public class CreatorMangaDto {
|
||||
|
||||
public CreatorMangaDto(Creator creator) {
|
||||
this.id = creator.getId();
|
||||
this.creatorName = creator.getCreatorName();
|
||||
this.hashedPassword = creator.getHashedPassword();
|
||||
this.creatorName = creator.getUser().getLogin();
|
||||
this.hashedPassword = creator.getUser().getPassword();
|
||||
this.mangas = creator.getMangas().stream()
|
||||
.map(x -> new MangaDto(x))
|
||||
.toList();
|
||||
|
@ -19,8 +19,8 @@ public class ReaderMangaDto {
|
||||
|
||||
public ReaderMangaDto(Reader reader) {
|
||||
this.id = reader.getId();
|
||||
this.readerName = reader.getReaderName();
|
||||
this.hashedPassword = reader.getHashedPassword();
|
||||
this.readerName = reader.getUser().getLogin();
|
||||
this.hashedPassword = reader.getUser().getPassword();
|
||||
this.mangas = reader.getMangas().stream()
|
||||
.map(y -> new MangaDto(y))
|
||||
.toList();
|
||||
|
@ -14,6 +14,8 @@ public class MangaDto {
|
||||
private Integer chapterCount;
|
||||
private String image;
|
||||
|
||||
private String login;
|
||||
|
||||
public MangaDto() {
|
||||
}
|
||||
|
||||
@ -22,6 +24,7 @@ public class MangaDto {
|
||||
this.creatorId = manga.getCreator().getId();
|
||||
this.mangaName = manga.getMangaName();
|
||||
this.chapterCount = manga.getChapterCount();
|
||||
this.login = null;
|
||||
this.image = new String(manga.getImage(), StandardCharsets.UTF_8);
|
||||
}
|
||||
public Long getId() {
|
||||
@ -44,6 +47,10 @@ public class MangaDto {
|
||||
return image;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setMangaName(String mangaName) {
|
||||
this.mangaName = mangaName;
|
||||
}
|
||||
@ -57,4 +64,10 @@ public class MangaDto {
|
||||
}
|
||||
|
||||
public void setImage(String image) {this.image = image;}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ public class ReaderDto {
|
||||
|
||||
public ReaderDto(Reader reader) {
|
||||
this.id = reader.getId();
|
||||
this.readerName = reader.getReaderName();
|
||||
this.hashedPassword = reader.getHashedPassword();
|
||||
this.readerName = reader.getUser().getLogin();
|
||||
this.hashedPassword = reader.getUser().getPassword();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.LabWork.app.MangaStore.model.Dto;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
|
||||
public class UserDto {
|
||||
private final long id;
|
||||
private final String login;
|
||||
private final UserRole role;
|
||||
|
||||
public UserDto(User user) {
|
||||
this.id = user.getId();
|
||||
this.login = user.getLogin();
|
||||
this.role = user.getRole();
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public UserRole getRole() {
|
||||
return role;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.LabWork.app.MangaStore.model.Dto;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class UserSignupDto {
|
||||
@NotBlank
|
||||
@Size(min = 3, max = 64)
|
||||
private String login;
|
||||
@NotBlank
|
||||
@Size(min = 6, max = 64)
|
||||
private String password;
|
||||
@NotBlank
|
||||
@Size(min = 6, max = 64)
|
||||
private String passwordConfirm;
|
||||
|
||||
private UserRole userRole;
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPasswordConfirm() {
|
||||
return passwordConfirm;
|
||||
}
|
||||
|
||||
public void setPasswordConfirm(String passwordConfirm) {
|
||||
this.passwordConfirm = passwordConfirm;
|
||||
}
|
||||
|
||||
public UserRole getUserRole() {
|
||||
return userRole;
|
||||
}
|
||||
|
||||
public void setUserRole(String userRole) {
|
||||
|
||||
if (userRole.equals("creator"))this.userRole = UserRole.ADMIN;
|
||||
else this.userRole = UserRole.USER;
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ import com.LabWork.app.MangaStore.model.Default.Manga;
|
||||
import com.LabWork.app.MangaStore.model.Default.Reader;
|
||||
import com.LabWork.app.MangaStore.service.Repository.CreatorRepository;
|
||||
import com.LabWork.app.MangaStore.service.Exception.CreatorNotFoundException;
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import com.LabWork.app.MangaStore.service.Repository.UserRepository;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidatorUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -14,13 +16,17 @@ import java.util.Optional;
|
||||
@Service
|
||||
public class CreatorService {
|
||||
private final CreatorRepository creatorRepository;
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final MangaService mangaService;
|
||||
private final ValidatorUtil validatorUtil;
|
||||
|
||||
public CreatorService(CreatorRepository creatorRepository,
|
||||
MangaService mangaService,
|
||||
ValidatorUtil validatorUtil) {
|
||||
ValidatorUtil validatorUtil,
|
||||
UserRepository userRepository) {
|
||||
this.creatorRepository = creatorRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.mangaService = mangaService;
|
||||
this.validatorUtil = validatorUtil;
|
||||
}
|
||||
@ -31,40 +37,17 @@ public class CreatorService {
|
||||
return creator.orElseThrow(() -> new CreatorNotFoundException(id));
|
||||
}
|
||||
|
||||
public Creator findByLogin(String login) {
|
||||
return findCreator(userRepository.findOneByLoginIgnoreCase(login).getId());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Creator> findAllCreators() { return creatorRepository.findAll(); }
|
||||
|
||||
@Transactional
|
||||
public Creator addCreator(String creatorName, String password) {
|
||||
final Creator creator = new Creator(creatorName, password);
|
||||
public Creator addCreator(User user) {
|
||||
final Creator creator = new Creator(user);
|
||||
validatorUtil.validate(creator);
|
||||
return creatorRepository.save(creator);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Creator updateCreator(Long id, String creatorName, String password) {
|
||||
final Creator currentCreator = findCreator(id);
|
||||
currentCreator.setCreatorName(creatorName);
|
||||
currentCreator.setHashedPassword(password);
|
||||
validatorUtil.validate(currentCreator);
|
||||
return currentCreator;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Creator deleteCreator(Long id) {
|
||||
final Creator currentCreator = findCreator(id);
|
||||
List<Manga> listManga = currentCreator.getMangas();
|
||||
for (Manga manga : listManga){
|
||||
for (final Reader reader :mangaService.getReader(manga.getId())){
|
||||
reader.getMangas().remove(manga);
|
||||
}
|
||||
}
|
||||
creatorRepository.delete(currentCreator);
|
||||
return currentCreator;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllCreators() {
|
||||
creatorRepository.deleteAll();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.LabWork.app.MangaStore.service.Repository.MangaRepository;
|
||||
import com.LabWork.app.MangaStore.service.Exception.CreatorNotFoundException;
|
||||
import com.LabWork.app.MangaStore.service.Exception.MangaNotFoundException;
|
||||
import com.LabWork.app.MangaStore.service.Repository.ReaderRepository;
|
||||
import com.LabWork.app.MangaStore.service.Repository.UserRepository;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidatorUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -18,17 +19,20 @@ import java.util.Optional;
|
||||
public class MangaService {
|
||||
public final MangaRepository mangaRepository;
|
||||
public final CreatorRepository creatorRepository;
|
||||
public final UserRepository userRepository;
|
||||
public final ReaderService readerService;
|
||||
private final ValidatorUtil validatorUtil;
|
||||
|
||||
public MangaService(MangaRepository mangaRepository,
|
||||
CreatorRepository creatorRepository,
|
||||
ReaderService readerService,
|
||||
ValidatorUtil validatorUtil) {
|
||||
ValidatorUtil validatorUtil,
|
||||
UserRepository userRepository) {
|
||||
this.mangaRepository = mangaRepository;
|
||||
this.readerService = readerService;
|
||||
this.creatorRepository = creatorRepository;
|
||||
this.validatorUtil = validatorUtil;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@ -36,6 +40,9 @@ public class MangaService {
|
||||
final Optional<Manga> manga = mangaRepository.findById(id);
|
||||
return manga.orElseThrow(() -> new MangaNotFoundException(id));
|
||||
}
|
||||
public Creator findCreatorByLogin(String login) {
|
||||
return findCreator(userRepository.findOneByLoginIgnoreCase(login).getId());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Reader> getReader(Long id) {
|
||||
@ -55,17 +62,9 @@ public class MangaService {
|
||||
return creator.orElseThrow(() -> new CreatorNotFoundException(id));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga addManga(Long creatorId, Integer chapterCount, String mangaName, String Image) {
|
||||
final Creator currentCreator = findCreator(creatorId);
|
||||
final Manga manga = new Manga(currentCreator, mangaName, chapterCount, Image);
|
||||
validatorUtil.validate(manga);
|
||||
return mangaRepository.save(manga);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga addManga(MangaDto mangaDto) {
|
||||
final Creator currentCreator = findCreator(mangaDto.getCreatorId());
|
||||
final Creator currentCreator = findCreatorByLogin(mangaDto.getLogin());
|
||||
final Manga manga = new Manga(currentCreator, mangaDto);
|
||||
validatorUtil.validate(manga);
|
||||
return mangaRepository.save(manga);
|
||||
@ -80,15 +79,6 @@ public class MangaService {
|
||||
return currentManga;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga updateManga(MangaDto mangaDto) {
|
||||
final Manga currentManga = findManga(mangaDto.getId());
|
||||
currentManga.setChapterCount(mangaDto.getChapterCount());
|
||||
currentManga.setImage(mangaDto.getImage().getBytes());
|
||||
validatorUtil.validate(currentManga);
|
||||
return currentManga;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga deleteManga(Long id) {
|
||||
final Manga currentManga = findManga(id);
|
||||
@ -99,9 +89,4 @@ public class MangaService {
|
||||
mangaRepository.delete(currentManga);
|
||||
return currentManga;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllMangas() {
|
||||
mangaRepository.deleteAll();
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,13 @@ package com.LabWork.app.MangaStore.service;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.Manga;
|
||||
import com.LabWork.app.MangaStore.model.Default.Reader;
|
||||
import com.LabWork.app.MangaStore.service.Exception.CreatorNotFoundException;
|
||||
import com.LabWork.app.MangaStore.service.Repository.MangaRepository;
|
||||
import com.LabWork.app.MangaStore.service.Repository.ReaderRepository;
|
||||
import com.LabWork.app.MangaStore.service.Exception.MangaNotFoundException;
|
||||
import com.LabWork.app.MangaStore.service.Exception.ReaderNotFoundException;
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import com.LabWork.app.MangaStore.service.Repository.UserRepository;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidatorUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -16,15 +19,18 @@ import java.util.Optional;
|
||||
@Service
|
||||
public class ReaderService {
|
||||
private final ReaderRepository readerRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final MangaRepository mangaRepository;
|
||||
private final ValidatorUtil validatorUtil;
|
||||
|
||||
public ReaderService(ReaderRepository readerRepository,
|
||||
ValidatorUtil validatorUtil,
|
||||
UserRepository userRepository,
|
||||
MangaRepository mangaRepository) {
|
||||
this.readerRepository = readerRepository;
|
||||
this.mangaRepository = mangaRepository;
|
||||
this.validatorUtil = validatorUtil;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -33,40 +39,22 @@ public class ReaderService {
|
||||
return reader.orElseThrow(() -> new ReaderNotFoundException(id));
|
||||
}
|
||||
|
||||
public Reader findByLogin(String login) {
|
||||
return findReader(userRepository.findOneByLoginIgnoreCase(login).getId());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Reader> findAllReaders() {
|
||||
return readerRepository.findAll();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Reader addReader(String readerName, String password) {
|
||||
final Reader reader = new Reader(readerName, password);
|
||||
public Reader addReader(User user) {
|
||||
final Reader reader = new Reader(user);
|
||||
validatorUtil.validate(reader);
|
||||
return readerRepository.save(reader);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Reader updateReader(Long id, String readername, String password) {
|
||||
final Reader currentReader = findReader(id);
|
||||
currentReader.setReaderName(readername);
|
||||
currentReader.setHashedPassword(password);
|
||||
validatorUtil.validate(currentReader);
|
||||
return currentReader;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Reader deleteReader(Long id) {
|
||||
final Reader currentReader = findReader(id);
|
||||
currentReader.getMangas().clear();
|
||||
readerRepository.delete(currentReader);
|
||||
return currentReader;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllReaders() {
|
||||
readerRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Manga findManga(Long id) {
|
||||
final Optional<Manga> manga = mangaRepository.findById(id);
|
||||
@ -74,9 +62,9 @@ public class ReaderService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga addManga(Long mangaId, Long readerId) {
|
||||
public Manga addManga(Long mangaId, String readerLogin) {
|
||||
final Manga manga = findManga(mangaId);
|
||||
final Reader reader = findReader(readerId);
|
||||
final Reader reader = findByLogin(readerLogin);
|
||||
validatorUtil.validate(reader);
|
||||
if (reader.getMangas().contains(manga))
|
||||
{
|
||||
@ -87,8 +75,8 @@ public class ReaderService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manga removeManga(Long mangaId, Long readerId) {
|
||||
final Reader currentReader = findReader(readerId);
|
||||
public Manga removeManga(Long mangaId, String readerLogin) {
|
||||
final Reader currentReader = findByLogin(readerLogin);
|
||||
final Manga currentManga = findManga(mangaId);
|
||||
currentReader.getMangas().remove(currentManga);
|
||||
return currentManga;
|
||||
|
@ -0,0 +1,9 @@
|
||||
package com.LabWork.app.MangaStore.service.Repository;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
User findOneByLoginIgnoreCase(String login);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.LabWork.app.MangaStore.service;
|
||||
|
||||
import com.LabWork.app.MangaStore.service.CreatorService;
|
||||
import com.LabWork.app.MangaStore.service.ReaderService;
|
||||
import com.LabWork.app.MangaStore.model.Default.UserRole;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidationException;
|
||||
import com.LabWork.app.MangaStore.util.validation.ValidatorUtil;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.LabWork.app.MangaStore.model.Default.User;
|
||||
import com.LabWork.app.MangaStore.service.Repository.UserRepository;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class UserService implements UserDetailsService {
|
||||
private final UserRepository userRepository;
|
||||
private final ReaderService readerService;
|
||||
private final CreatorService creatorService;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final ValidatorUtil validatorUtil;
|
||||
|
||||
public UserService(UserRepository userRepository,
|
||||
CreatorService creatorService,
|
||||
ReaderService readerService,
|
||||
PasswordEncoder passwordEncoder,
|
||||
ValidatorUtil validatorUtil) {
|
||||
this.userRepository = userRepository;
|
||||
this.readerService = readerService;
|
||||
this.creatorService = creatorService;
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.validatorUtil = validatorUtil;
|
||||
}
|
||||
|
||||
public Page<User> findAllPages(int page, int size) {
|
||||
return userRepository.findAll(PageRequest.of(page - 1, size, Sort.by("id").ascending()));
|
||||
}
|
||||
|
||||
public User findByLogin(String login) {
|
||||
return userRepository.findOneByLoginIgnoreCase(login);
|
||||
}
|
||||
|
||||
public User createUser(String login, String password, String passwordConfirm, UserRole role) {
|
||||
if (findByLogin(login) != null) {
|
||||
throw new ValidationException(String.format("User '%s' already exists", login));
|
||||
}
|
||||
final User user = new User(login, passwordEncoder.encode(password), role);
|
||||
validatorUtil.validate(user);
|
||||
if (!Objects.equals(password, passwordConfirm)) {
|
||||
throw new ValidationException("Passwords not equals");
|
||||
}
|
||||
userRepository.save(user);
|
||||
if (user.getRole() == UserRole.ADMIN) creatorService.addCreator(user);
|
||||
else readerService.addReader(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
final User userEntity = findByLogin(username);
|
||||
if (userEntity == null) {
|
||||
throw new UsernameNotFoundException(username);
|
||||
}
|
||||
return new org.springframework.security.core.userdetails.User(
|
||||
userEntity.getLogin(), userEntity.getPassword(), Collections.singleton(userEntity.getRole()));
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ControllerAdvice
|
||||
/*@ControllerAdvice*/
|
||||
public class AdviceController {
|
||||
@ExceptionHandler({
|
||||
CreatorNotFoundException.class,
|
||||
|
@ -3,7 +3,11 @@ package com.LabWork.app.MangaStore.util.validation;
|
||||
import java.util.Set;
|
||||
|
||||
public class ValidationException extends RuntimeException {
|
||||
public ValidationException(Set<String> errors) {
|
||||
public <T> ValidationException(Set<String> errors) {
|
||||
super(String.join("\n", errors));
|
||||
}
|
||||
|
||||
public <T> ValidationException(String error) {
|
||||
super(error);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div layout:fragment="content">
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/creator/{id}(id=${id})}" th:object="${CreatorMangaDto}" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="creatorName" class="form-label">creatorName</label>
|
||||
<input id="creatorName" type='text' class="form-control" th:field="${CreatorMangaDto.creatorName}" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="hashedPassword" class="form-label">hashedPassword</label>
|
||||
<input id="hashedPassword" type='text' class="form-control" th:field="${CreatorMangaDto.hashedPassword}" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span th:if="${id == null}">Добавить</span>
|
||||
<span th:if="${id != null}">Обновить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/creator}">
|
||||
Назад
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,60 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="root-div" layout:fragment="content">
|
||||
<div class="content">
|
||||
<h1>Creator</h1>
|
||||
<a class="btn btn-success"
|
||||
th:href="@{/creator/edit}">
|
||||
<i class="fa-solid fa-plus"></i> Добавить
|
||||
</a>
|
||||
<div class="row table-responsive text-white">
|
||||
<table class="table mt-3 text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">CreatorName</th>
|
||||
<th scope="col">Password</th>
|
||||
<th scope="col">Mangas</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="creator: ${creators}">
|
||||
<td th:text="${creator.id}"/>
|
||||
<td th:text="${creator.creatorName}"/>
|
||||
<td th:text="${creator.hashedPassword}"/>
|
||||
<td>
|
||||
<select className="form-select" aria-label="Default select example">
|
||||
<option th:each="manga, iterator: ${creator.mangas}" th:text="${manga.mangaName}"/>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 10%">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<a class="btn btn-warning button-fixed button-sm"
|
||||
th:href="@{/creator/edit/{id}(id=${creator.id})}">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
|
||||
</a>
|
||||
<button type="button" class="btn btn-danger button-fixed button-sm"
|
||||
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${creator.id}').click()|">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||
</button>
|
||||
</div>
|
||||
<form th:action="@{/creator/delete/{id}(id=${creator.id})}" method="post">
|
||||
<button th:id="'remove-' + ${creator.id}" type="submit" style="display: none">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -7,7 +7,30 @@
|
||||
<body>
|
||||
<div layout:fragment="content">
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/creatorAction/{controller}{id}(id=${id}, controller=${controller})}" th:object="${mangaDto}" enctype="multipart/form-data" method="post">
|
||||
<form th:if="${controller != 'creator/'}" action="#" th:action="@{/creatorAction/manga/{id}(id=${id})}" th:object="${mangaDto}" enctype="multipart/form-data" method="post">
|
||||
<div class="mb-3" th:if="${controller == 'creator/'}">
|
||||
<label for="mangaNameU" class="form-label">mangaName</label>
|
||||
<input id="mangaNameU" type='text' class="form-control" th:field="${mangaDto.mangaName}" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="chapterCountU" class="form-label">chapterCount</label>
|
||||
<input id="chapterCountU" type='number' class="form-control" th:field="${mangaDto.chapterCount}" required="true"/>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="multipartFileU" class="form-label">image</label>
|
||||
<input type="file" id="multipartFileU" th:name="multipartFile" accept="image/png, image/jpeg" class="form-control" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span>Обновить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/creator}">
|
||||
Назад
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
<form th:if="${controller == 'creator/'}" action="#" th:action="@{/creatorAction/creator}" th:object="${mangaDto}" enctype="multipart/form-data" method="post">
|
||||
<div class="mb-3" th:if="${controller == 'creator/'}">
|
||||
<label for="mangaName" class="form-label">mangaName</label>
|
||||
<input id="mangaName" type='text' class="form-control" th:field="${mangaDto.mangaName}" required="true"/>
|
||||
@ -23,8 +46,7 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span th:if="${controller == 'creator/'}">Добавить</span>
|
||||
<span th:if="${controller != 'creator/'}">Обновить</span>
|
||||
<span>Добавить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/creator}">
|
||||
Назад
|
||||
|
@ -14,23 +14,13 @@
|
||||
<div class="d-flex mt-3">
|
||||
<div class="d-grid col-sm-2">
|
||||
<a class="btn btn-success"
|
||||
th:href="@{/creatorAction/create/{id}(id=${creatorId})}">
|
||||
th:href="@{/creatorAction/create}">
|
||||
<i class="fa-solid fa-plus"></i> Добавить
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/creatorAction}" method="get">
|
||||
<div class="col-sm-2 mb-3">
|
||||
<label for="creatorId" class="form-label">Reader</label>
|
||||
<select id="creatorId" th:name="creatorId" class="form-select">
|
||||
<option value="" disabled selected>Select your option</option>
|
||||
<option th:each="value: ${creators}" th:selected="${creatorId} == ${value}" th:text="${value.creatorName}" th:value="${value.Id}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row table-responsive text-white">
|
||||
<div th:each="manga, iterator: ${currentCreator?.mangas}" class="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||
<div class="me-3">
|
||||
|
@ -1,7 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>ReManga</title>
|
||||
@ -25,15 +26,21 @@
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<ul class="navbar-nav" sec:authorize="!isAuthenticated()">
|
||||
<a class="nav-link" href="/login">Вход</a>
|
||||
</ul>
|
||||
<ul class="navbar-nav" sec:authorize="isAuthenticated()">
|
||||
<a class="nav-link" href="/">Index</a>
|
||||
<a class="nav-link" th:href="@{/creator}">Creator</a>
|
||||
<a class="nav-link" href="/reader">Reader</a>
|
||||
<a class="nav-link" href="/creatorAction">CreatorAction</a>
|
||||
<a class="nav-link" href="/readerAction">ReaderAction</a>
|
||||
<!--(login=${#authentication.name})-->
|
||||
<a class="nav-link" sec:authorize="hasRole('ROLE_ADMIN')" th:href="@{/creatorAction(login=${#authentication.name})}">CreatorAction</a>
|
||||
<a class="nav-link" sec:authorize="hasRole('ROLE_USER')" th:href="@{/readerAction(readerLogin=${#authentication.name})}">ReaderAction</a>
|
||||
<a sec:authorize="hasRole('ROLE_USER')" class="nav-link" href="/users">Users</a>
|
||||
<a class="nav-link" href="/manga">Catalog</a>
|
||||
<a class="nav-link" href="/swagger-ui/index.html" target="_blank">Документация REST API</a>
|
||||
<a class="nav-link" href="/h2-console/" target="_blank">Консоль H2</a>
|
||||
<a class="nav-link" href="/swagger-ui/index.html">Документация REST API</a>
|
||||
<a class="nav-link" href="/h2-console/">Консоль H2</a>
|
||||
<a class="nav-link" href="/logout">
|
||||
Выход (<span th:text="${#authentication.name}"></span>)
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div layout:fragment="content_header" th:text="'Главная'"></div>
|
||||
<div layout:fragment="content">
|
||||
<div>It's works!</div>
|
||||
<a href="123">ERROR</a>
|
||||
|
31
src/main/resources/templates/login.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<div th:if="${param.error}" class="alert alert-danger margin-bottom">
|
||||
Пользователь не найден или пароль указан не верно
|
||||
</div>
|
||||
<div th:if="${param.logout}" class="alert alert-success margin-bottom">
|
||||
Выход успешно произведен
|
||||
</div>
|
||||
<div th:if="${param.created}" class="alert alert-success margin-bottom">
|
||||
Пользователь '<span th:text="${param.created}"></span>' успешно создан
|
||||
</div>
|
||||
<form th:action="@{/login}" method="post" class="container-padding">
|
||||
<div class="mb-3">
|
||||
<input type="text" name="username" id="username" class="form-control"
|
||||
placeholder="Логин" required="true" autofocus="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<input type="password" name="password" id="password" class="form-control"
|
||||
placeholder="Пароль" required="true"/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success button-fixed">Войти</button>
|
||||
<a class="btn btn-primary button-fixed" href="/signup">Регистрация</a>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
@ -45,7 +45,7 @@
|
||||
<div>
|
||||
<div class="pt-3 description mb-3 fs-6 fw-bold">
|
||||
Имя пользователя:
|
||||
<a th:href="@{/readerAction/{id}(id=${reader.id})}" th:text="${reader.readerName}"></a>
|
||||
<a th:href="@{/readerAction/(readerLogin=${reader.readerName})}" th:text="${reader.readerName}"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div layout:fragment="content">
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/reader/{id}(id=${id})}" th:object="${ReaderMangaDto}" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="readerName" class="form-label">readerName</label>
|
||||
<input id="readerName" type='text' value class="form-control" th:field="${ReaderMangaDto.readerName}" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="hashedPassword" class="form-label">hashedPassword</label>
|
||||
<input id="hashedPassword" type='text' value class="form-control" th:field="${ReaderMangaDto.hashedPassword}" required="true"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span th:if="${id == null}">Добавить</span>
|
||||
<span th:if="${id != null}">Обновить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/reader}">
|
||||
Назад
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,60 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="root-div" layout:fragment="content">
|
||||
<div class="content">
|
||||
<h1>Reader</h1>
|
||||
<a class="btn btn-success"
|
||||
th:href="@{/reader/edit}">
|
||||
<i class="fa-solid fa-plus"></i> Добавить
|
||||
</a>
|
||||
<div class="row table-responsive text-white">
|
||||
<table class="table mt-3 text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">ReaderName</th>
|
||||
<th scope="col">Password</th>
|
||||
<th scope="col">Mangas</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="reader, iterator: ${readers}">
|
||||
<td th:text="${reader.id}"/>
|
||||
<td th:text="${reader.readerName}"/>
|
||||
<td th:text="${reader.hashedPassword}"/>
|
||||
<td>
|
||||
<select className="form-select" aria-label="Default select example">
|
||||
<option th:each="manga, iterator: ${reader.mangas}" th:text="${manga.mangaName}"/>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 10%">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<a class="btn btn-warning button-fixed button-sm"
|
||||
th:href="@{/reader/edit/{id}(id=${reader.id})}">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
|
||||
</a>
|
||||
<button type="button" class="btn btn-danger button-fixed button-sm"
|
||||
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${reader.id}').click()|">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||
</button>
|
||||
</div>
|
||||
<form th:action="@{/reader/delete/{id}(id=${reader.id})}" method="post">
|
||||
<button th:id="'remove-' + ${reader.id}" type="submit" style="display: none">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -13,7 +13,7 @@
|
||||
<div class="d-flex mt-3">
|
||||
<div class="d-grid col-sm-2">
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/readerAction/manga/{id}(id=${readerId})}" method="post">
|
||||
<form action="#" th:action="@{/readerAction/manga}" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="mangaId" class="form-label">Манга</label>
|
||||
<select th:name="mangaId" id="mangaId" class="form-select">
|
||||
@ -29,16 +29,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||
<form action="#" th:action="@{/readerAction}" method="get">
|
||||
<div class="col-sm-2 mb-3">
|
||||
<label for="readerId" class="form-label">Reader</label>
|
||||
<select id="readerId" th:name="readerId" class="form-select">
|
||||
<option value="" disabled selected>Select your option</option>
|
||||
<option th:each="value: ${readers}" th:selected="${readerId} == ${value}" th:text="${value.readerName}" th:value="${value.Id}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row table-responsive text-white">
|
||||
<div th:each="manga: ${reader?.mangas}" class="d-flex flex-row flex-wrap flex-grow-1 align-items-center mt-3">
|
||||
<div class="me-3">
|
||||
@ -58,7 +48,7 @@
|
||||
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${manga.id}').click()|">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||
</button>
|
||||
<form th:action="@{'/readerAction/' + ${readerId} + '/removeManga/' + ${manga.id}}" method="post">
|
||||
<form th:action="@{'/readerAction/' + 'removeManga/' + ${manga.id}}" method="post">
|
||||
<button th:id="'remove-' + ${manga.id}" type="submit" style="display: none">
|
||||
Удалить
|
||||
</button>
|
||||
|
35
src/main/resources/templates/signup.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<body>
|
||||
<div class="container container-padding" layout:fragment="content">
|
||||
<div th:if="${errors}" th:text="${errors}" class="margin-bottom alert alert-danger"></div>
|
||||
<form action="#" th:action="@{/signup}" th:object="${userDto}" method="post">
|
||||
<div class="mb-3">
|
||||
<input type="text" class="form-control" th:field="${userDto.login}"
|
||||
placeholder="Логин" required="true" autofocus="true" maxlength="64"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<input type="password" class="form-control" th:field="${userDto.password}"
|
||||
placeholder="Пароль" required="true" minlength="6" maxlength="64"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<input type="password" class="form-control" th:field="${userDto.passwordConfirm}"
|
||||
placeholder="Пароль (подтверждение)" required="true" minlength="6" maxlength="64"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-success button-fixed">Создать</button>
|
||||
<a class="btn btn-primary button-fixed" href="/login">Назад</a>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="userRole" class="form-label">Роль</label>
|
||||
<select th:field="${userDto.userRole}" id="userRole" class="form-select">
|
||||
<option th:value="'creator'" th:text="creator"></option>
|
||||
<option th:value="'reader'" th:text="reader"></option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
37
src/main/resources/templates/users.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<div class="table-responsive">
|
||||
<table class="table text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Логин</th>
|
||||
<th scope="col">Роль</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="user, iterator: ${users}">
|
||||
<th scope="row" th:text="${iterator.index} + 1"></th>
|
||||
<td th:text="${user.id}"></td>
|
||||
<td th:text="${user.login}" style="width: 60%"></td>
|
||||
<td th:text="${user.role}" style="width: 20%"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div th:if="${totalPages > 0}" class="pagination text-white">
|
||||
<span style="float: left; padding: 5px 5px;">Страницы:</span>
|
||||
<a th:each="page : ${pages}"
|
||||
th:href="@{/users(page=${page}, size=${users.size})}"
|
||||
th:text="${page}"
|
||||
th:class="${page == users.number + 1} ? active">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,4 @@
|
||||
/*
|
||||
package com.LabWork.app;
|
||||
|
||||
import com.LabWork.app.MangaStore.model.Default.Creator;
|
||||
@ -103,6 +104,7 @@ public class ReMangaTest {
|
||||
creatorService.deleteAllCreators();
|
||||
}
|
||||
|
||||
*/
|
||||
/* @Test
|
||||
void testCreatorAddManga() {
|
||||
readerService.deleteAllReaders();
|
||||
@ -119,8 +121,10 @@ public class ReMangaTest {
|
||||
log.info(m1.getCreator().toString());
|
||||
log.info(c1.toString());
|
||||
Assertions.assertEquals(c1.getCreatorName(), m1.getCreator().getCreatorName());
|
||||
}*/
|
||||
}*//*
|
||||
|
||||
|
||||
*/
|
||||
/* //бесполезня штука
|
||||
@Test
|
||||
void testCreatorDeleteManga() {
|
||||
@ -147,8 +151,11 @@ public class ReMangaTest {
|
||||
|
||||
Assertions.assertEquals(1, c1.getMangas().size());
|
||||
|
||||
}*/
|
||||
/*тестстим работоспособность гита*/
|
||||
}*//*
|
||||
|
||||
*/
|
||||
/*тестстим работоспособность гита*//*
|
||||
|
||||
@Test
|
||||
void testCreatorUpdated() {
|
||||
readerService.deleteAllReaders();
|
||||
@ -429,3 +436,4 @@ public class ReMangaTest {
|
||||
creatorService.deleteAllCreators();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|