21 Commits

Author SHA1 Message Date
78a9b50c7e lab3 2025-12-02 11:38:00 +04:00
de78719cbf версия 2.0 2025-10-23 20:58:20 +04:00
5136cf2876 лаба 3 2025-10-22 19:43:31 +04:00
211d9b5974 чето не то 2025-10-22 18:36:47 +04:00
b1cdb05630 Готовая лаба2 и отчет 2025-10-09 13:21:28 +04:00
2aeb01eaca Доделал чето 2025-10-08 15:25:07 +04:00
af411710b8 Create PostServiceTest.java 2025-09-19 20:21:00 +04:00
ff3bc0b9ef Create PostService.java 2025-09-19 20:20:58 +04:00
27a4dca41d Create PostRepository.java 2025-09-19 20:20:57 +04:00
4d5ce8b8b7 Create MapRepository.java 2025-09-19 20:20:55 +04:00
f5d0752036 Create CommonRepository.java 2025-09-19 20:20:53 +04:00
8233f29056 Update Post.java 2025-09-19 20:20:51 +04:00
dc5b47be73 Create PostRsDto.java 2025-09-19 20:20:50 +04:00
53f53d43c2 Create BaseEntity.java 2025-09-19 20:20:48 +04:00
077f334ebb Create PostRqDto.java 2025-09-19 20:20:45 +04:00
8aacaa0126 Update PostMapper.java 2025-09-19 20:20:42 +04:00
0d5ca036e5 Create PostController.java 2025-09-19 20:20:40 +04:00
3b831c8485 111 2025-09-19 20:20:26 +04:00
a3dcf8e887 Готовая ЛР с отчетом 2025-09-11 14:17:53 +04:00
f2d5e404ed Наговнокодил 2025-09-10 11:52:51 +04:00
30dcc1a649 Сделал 1 Лабораторную 2025-09-07 15:18:38 +04:00
9381 changed files with 21940 additions and 874722 deletions

3
ip-backend-labs/.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary

37
ip-backend-labs/.gitignore vendored Normal file
View File

@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/

View File

@@ -0,0 +1,37 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.5.5'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'io.github.f1rstteam'
version = '0.0.1-SNAPSHOT'
description = 'Demo project for Spring Boot'
defaultTasks "bootRun"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5'
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
}
tasks.named('test') {
useJUnitPlatform()
}

BIN
ip-backend-labs/data.mv.db Normal file

Binary file not shown.

View File

@@ -0,0 +1,70 @@
2025-10-23 11:17:44.638086+04:00 database: close
org.h2.message.DbException: Ошибка ввода/вывода: "Closing"
IO Exception: "Closing" [90028-232]
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.mvstore.db.Store.close(Store.java:374)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:1292)
at org.h2.engine.Database.closeImpl(Database.java:1254)
at org.h2.engine.Database.close(Database.java:1173)
at org.h2.engine.Database.onShutdown(Database.java:1158)
at org.h2.engine.OnExitDatabaseCloser.onShutdown(OnExitDatabaseCloser.java:85)
at org.h2.engine.OnExitDatabaseCloser.run(OnExitDatabaseCloser.java:114)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Ошибка ввода/вывода: "Closing"
IO Exception: "Closing" [90028-232]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
... 8 more
Caused by: org.h2.mvstore.MVStoreException: java.lang.AssertionError [2.3.232/3]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.MVStore.executeFilestoreOperation(MVStore.java:926)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:463)
at org.h2.mvstore.RandomAccessStore.compactStore(RandomAccessStore.java:443)
at org.h2.mvstore.FileStore.compactStore(FileStore.java:890)
at org.h2.mvstore.FileStore.stop(FileStore.java:275)
at org.h2.mvstore.MVStore.closeStore(MVStore.java:693)
at org.h2.mvstore.MVStore.close(MVStore.java:643)
at org.h2.mvstore.db.Store.close(Store.java:364)
... 6 more
Caused by: java.lang.AssertionError
at org.h2.mvstore.RandomAccessStore.moveChunkInside(RandomAccessStore.java:630)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:569)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:481)
at org.h2.mvstore.RandomAccessStore.lambda$compactMoveChunks$1(RandomAccessStore.java:468)
at org.h2.mvstore.FileStore.executeFileStoreOperation(FileStore.java:1893)
at org.h2.mvstore.MVStore.executeFilestoreOperation(MVStore.java:922)
... 13 more
2025-10-23 20:22:40.401035+04:00 database: close
org.h2.message.DbException: Ошибка ввода/вывода: "Closing"
IO Exception: "Closing" [90028-232]
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.mvstore.db.Store.close(Store.java:374)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:1292)
at org.h2.engine.Database.closeImpl(Database.java:1254)
at org.h2.engine.Database.close(Database.java:1173)
at org.h2.engine.Database.onShutdown(Database.java:1158)
at org.h2.engine.OnExitDatabaseCloser.onShutdown(OnExitDatabaseCloser.java:85)
at org.h2.engine.OnExitDatabaseCloser.run(OnExitDatabaseCloser.java:114)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Ошибка ввода/вывода: "Closing"
IO Exception: "Closing" [90028-232]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
... 8 more
Caused by: org.h2.mvstore.MVStoreException: java.lang.AssertionError [2.3.232/3]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.MVStore.executeFilestoreOperation(MVStore.java:926)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:463)
at org.h2.mvstore.RandomAccessStore.compactStore(RandomAccessStore.java:443)
at org.h2.mvstore.FileStore.compactStore(FileStore.java:890)
at org.h2.mvstore.FileStore.stop(FileStore.java:275)
at org.h2.mvstore.MVStore.closeStore(MVStore.java:693)
at org.h2.mvstore.MVStore.close(MVStore.java:643)
at org.h2.mvstore.db.Store.close(Store.java:364)
... 6 more
Caused by: java.lang.AssertionError
at org.h2.mvstore.RandomAccessStore.moveChunkInside(RandomAccessStore.java:630)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:569)
at org.h2.mvstore.RandomAccessStore.compactMoveChunks(RandomAccessStore.java:481)
at org.h2.mvstore.RandomAccessStore.lambda$compactMoveChunks$1(RandomAccessStore.java:468)
at org.h2.mvstore.FileStore.executeFileStoreOperation(FileStore.java:1893)
at org.h2.mvstore.MVStore.executeFilestoreOperation(MVStore.java:922)
... 13 more

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
ip-backend-labs/gradlew vendored Normal file
View File

@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
ip-backend-labs/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%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
: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%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1 @@
[{"id":10,"text":"324234","image":"","group":"Моя группа","likes":3,"comments":2,"shares":2,"createdAt":[2025,9,7,14,57,10,10870800]},{"id":11,"text":"53456453","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,7,14,57,11,853363900]},{"id":16,"text":"11111111111","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,11,12,32,41,210363800]},{"id":17,"text":"673453","image":"","group":"Моя группа","likes":0,"comments":0,"shares":0,"createdAt":[2025,9,11,12,36,36,393719200]}]

View File

@@ -0,0 +1 @@
rootProject.name = 'ip-backend-labs'

View File

@@ -0,0 +1,19 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
public class CommentRqDTO {
@NotBlank(message = "Text is required")
@Size(max = 1000, message = "Text must not exceed 1000 characters")
private String text;
public CommentRqDTO() {}
public CommentRqDTO(String text) {
this.text = text;
}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
}

View File

@@ -0,0 +1,26 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
import java.time.LocalDateTime;
public class CommentRsDTO {
private Long id;
private String text;
private LocalDateTime createdAt;
public CommentRsDTO() {}
public CommentRsDTO(Long id, String text, LocalDateTime createdAt) {
this.id = id;
this.text = text;
this.createdAt = createdAt;
}
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}

View File

@@ -0,0 +1,75 @@
package io.github.f1rstteam.ip_backend_labs.DTO.Mappers;
import org.springframework.stereotype.Service;
import io.github.f1rstteam.ip_backend_labs.DTO.*;
import io.github.f1rstteam.ip_backend_labs.model.*;
@Service
public class MapperService {
// Post -> PostRsDTO
public PostRsDTO toPostRsDTO(Post post) {
if (post == null) {
return null;
}
// return new PostRsDTO(
// post.getId(),
// post.getText(),
// post.getImageUrl(),
// post.getLikesCount(),
// post.getCommentsCount(),
// post.getSharesCount(),
// post.getIsPublished(),
// post.getCreatedAt()
// );
PostRsDTO dto = new PostRsDTO();
dto.setId(post.getId());
dto.setText(post.getText());
dto.setImageUrl(post.getImageUrl());
dto.setLikesCount(post.getLikesCount());
dto.setCommentsCount(post.getCommentsCount());
dto.setSharesCount(post.getSharesCount());
dto.setCreatedAt(post.getCreatedAt());
return dto;
}
// PostRqDTO -> Post
public Post toPost(PostRqDTO postRqDTO) {
if (postRqDTO == null) {
return null;
}
Post post = new Post();
post.setText(postRqDTO.getText());
post.setImageUrl(postRqDTO.getImageUrl());
return post;
}
// Comment -> CommentRsDTO
public CommentRsDTO toCommentRsDTO(Comment comment) {
if (comment == null) {
return null;
}
return new CommentRsDTO(
comment.getId(),
comment.getText(),
comment.getCreatedAt()
);
}
// CommentRqDTO -> Comment
public Comment toComment(CommentRqDTO commentRqDTO) {
if (commentRqDTO == null) {
return null;
}
Comment comment = new Comment();
comment.setText(commentRqDTO.getText());
return comment;
}
}

View File

@@ -0,0 +1,24 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
import jakarta.validation.constraints.*;
public class PostRqDTO {
@Size(max = 2000, message = "Text must not exceed 2000 characters")
private String text;
private String imageUrl;
public PostRqDTO() {}
public PostRqDTO(String text, String imageUrl) {
this.text = text;
this.imageUrl = imageUrl;
}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
}

View File

@@ -0,0 +1,47 @@
package io.github.f1rstteam.ip_backend_labs.DTO;
import java.time.LocalDateTime;
public class PostRsDTO {
private Long id;
private String text;
private String imageUrl;
private Integer likesCount;
private Integer commentsCount;
private Integer sharesCount;
private LocalDateTime createdAt;
public PostRsDTO() {}
public PostRsDTO(Long id, String text, String imageUrl, Integer likesCount,
Integer commentsCount, Integer sharesCount, LocalDateTime createdAt) {
this.id = id;
this.text = text;
this.imageUrl = imageUrl;
this.likesCount = likesCount;
this.commentsCount = commentsCount;
this.sharesCount = sharesCount;
this.createdAt = createdAt;
}
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
public Integer getLikesCount() { return likesCount; }
public void setLikesCount(Integer likesCount) { this.likesCount = likesCount; }
public Integer getCommentsCount() { return commentsCount; }
public void setCommentsCount(Integer commentsCount) { this.commentsCount = commentsCount; }
public Integer getSharesCount() { return sharesCount; }
public void setSharesCount(Integer sharesCount) { this.sharesCount = sharesCount; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}

View File

@@ -0,0 +1,13 @@
package io.github.f1rstteam.ip_backend_labs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class InternetProgrammingBackendLabsApplication {
public static void main(String[] args) {
SpringApplication.run(InternetProgrammingBackendLabsApplication.class, args);
}
}

View File

@@ -0,0 +1,10 @@
package io.github.f1rstteam.ip_backend_labs.Projections;
import java.time.LocalDateTime;
public interface CommentProjection {
Long getId();
String getText();
LocalDateTime getCreatedAt();
Long getPostId();
}

View File

@@ -0,0 +1,13 @@
package io.github.f1rstteam.ip_backend_labs.Projections;
import java.time.LocalDateTime;
public interface PostProjection {
Long getId();
String getText();
String getImageUrl();
Integer getLikesCount();
Integer getCommentsCount();
Integer getSharesCount();
LocalDateTime getCreatedAt();
}

View File

@@ -0,0 +1,24 @@
package io.github.f1rstteam.ip_backend_labs.Repositories;
import org.springframework.stereotype.Repository;
import io.github.f1rstteam.ip_backend_labs.model.*;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
@Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
List<Comment> findByPostId(Long postId);
@Query("SELECT c FROM Comment c JOIN c.post p WHERE LENGTH(c.text) >= :minLength AND LENGTH(c.text) <= :maxLength ")
List<Comment> findLongCommentsInPosts(@Param("minLength") int minLength, @Param("maxLength") int maxLength);
@Query("SELECT c.post.id, COUNT(c), MAX(LENGTH(c.text)), AVG(LENGTH(c.text)), MIN(LENGTH(c.text)) " +
"FROM Comment c GROUP BY c.post.id HAVING COUNT(c) > :minComments")
List<Object[]> getCommentStatsByPost(@Param("minComments") long minComments);
}

View File

@@ -0,0 +1,24 @@
package io.github.f1rstteam.ip_backend_labs.Repositories;
import org.springframework.stereotype.Repository;
import io.github.f1rstteam.ip_backend_labs.Projections.PostProjection;
import io.github.f1rstteam.ip_backend_labs.model.Post;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
@Repository
public interface PostRepository extends JpaRepository<Post, Long> {
@Query("SELECT p.id as id, p.text as text, p.likesCount as likesCount, p.commentsCount as commentsCount, p.sharesCount as sharesCount, p.createdAt as createdAt " +
"FROM Post p ORDER BY p.commentsCount DESC")
List<PostProjection[]> getPostsWithMetrics();
@Query("SELECT p.id as id, p.text as text, p.imageUrl as imageUrl, p.likesCount as likesCount, " +
"p.commentsCount as commentsCount, p.sharesCount as sharesCount, p.createdAt as createdAt " +
"FROM Post p")
List<PostProjection> findPostsWithProjection();
}

View File

@@ -0,0 +1,34 @@
package io.github.f1rstteam.ip_backend_labs.Service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import io.github.f1rstteam.ip_backend_labs.Repositories.CommentRepository;
import io.github.f1rstteam.ip_backend_labs.model.Comment;
@Service
@Transactional
public class CommentService {
@Autowired
private CommentRepository commentRepository;
@Transactional(readOnly = true)
public List<Comment> getCommentsByPostId(Long postId) {
return commentRepository.findByPostId(postId);
}
@Transactional(readOnly = true)
public List<Comment> getLongCommentsInPosts(int minLength, int maxLength) {
return commentRepository.findLongCommentsInPosts(minLength, maxLength);
}
// STATISTICS
@Transactional(readOnly = true)
public List<Object[]> getCommentStatistics(long minComments) {
return commentRepository.getCommentStatsByPost(minComments);
}
}

View File

@@ -0,0 +1,90 @@
package io.github.f1rstteam.ip_backend_labs.Service;
import io.github.f1rstteam.ip_backend_labs.model.*;
import io.github.f1rstteam.ip_backend_labs.Projections.*;
import io.github.f1rstteam.ip_backend_labs.Repositories.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
@Service
@Transactional
public class PostService {
@Autowired
private PostRepository postRepository;
@Autowired
private CommentRepository commentRepository;
// CREATE
@Transactional
public Post createPost(Post post) {
return postRepository.save(post);
}
// READ
@Transactional(readOnly = true)
public List<Post> getAllPosts() {
return postRepository.findAll();
}
@Transactional(readOnly = true)
public Optional<Post> getPostById(Long id) {
return postRepository.findById(id);
}
@Transactional(readOnly = true)
public List<PostProjection> getPublishedPostsWithProjection() {
return postRepository.findPostsWithProjection();
}
// UPDATE
@Transactional
public Post updatePost(Post post) {
return postRepository.save(post);
}
// DELETE
@Transactional
public void deletePost(Long id) {
postRepository.deleteById(id);
}
// COMMENTS
@Transactional
public Comment addCommentToPost(Long postId, String commentText) {
Post post = postRepository.findById(postId)
.orElseThrow(() -> new RuntimeException("Post not found"));
Comment comment = new Comment();
comment.setText(commentText);
post.addComment(comment);
return commentRepository.save(comment);
}
@Transactional
public void removeCommentFromPost(Long postId, Long commentId) {
Post post = postRepository.findById(postId)
.orElseThrow(() -> new RuntimeException("Post not found"));
Comment comment = commentRepository.findById(commentId)
.orElseThrow(() -> new RuntimeException("Comment not found"));
post.removeComment(comment);
commentRepository.delete(comment);
}
// STATISTICS
@Transactional(readOnly = true)
public List<PostProjection[]> getPostStatistics() {
return postRepository.getPostsWithMetrics();
}
@Transactional(readOnly = true)
public List<PostProjection> getPostsFromProjection() {
return postRepository.findPostsWithProjection();
}
}

View File

@@ -0,0 +1,23 @@
package io.github.f1rstteam.ip_backend_labs.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**") //запросы ко всем API endpoints
.allowedOrigins("http://localhost:3000") //React фронт
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
};
}
}

View File

@@ -0,0 +1,51 @@
package io.github.f1rstteam.ip_backend_labs.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import io.github.f1rstteam.ip_backend_labs.Service.*;
import io.github.f1rstteam.ip_backend_labs.model.Comment;
@RestController
@RequestMapping("/api/comments")
public class CommentController {
@Autowired
private CommentService commentService;
@GetMapping("/post/{postId}")
public ResponseEntity<List<Comment>> getCommentsByPostId(@PathVariable Long postId) {
try {
List<Comment> comments = commentService.getCommentsByPostId(postId);
return ResponseEntity.ok(comments);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
@GetMapping("/{minLength}/{maxLength}")
public ResponseEntity<List<Comment>> getLongComments(int minLength, int maxLength){
try{
List<Comment> statistics = commentService.getLongCommentsInPosts(minLength, maxLength);
return ResponseEntity.ok(statistics);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
@GetMapping("/statistics/{count}")
public ResponseEntity<List<Object[]>> getPostStatistics(int count) {
try {
List<Object[]> statistics = commentService.getCommentStatistics(count);
return ResponseEntity.ok(statistics);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
}

View File

@@ -0,0 +1,133 @@
package io.github.f1rstteam.ip_backend_labs.controllers;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import io.github.f1rstteam.ip_backend_labs.DTO.CommentRqDTO;
import io.github.f1rstteam.ip_backend_labs.DTO.CommentRsDTO;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRqDTO;
import io.github.f1rstteam.ip_backend_labs.DTO.PostRsDTO;
import io.github.f1rstteam.ip_backend_labs.DTO.Mappers.MapperService;
import io.github.f1rstteam.ip_backend_labs.Projections.PostProjection;
import io.github.f1rstteam.ip_backend_labs.Service.CommentService;
import io.github.f1rstteam.ip_backend_labs.Service.PostService;
import io.github.f1rstteam.ip_backend_labs.model.Comment;
import jakarta.validation.Valid;
@RestController
@RequestMapping("/api/posts")
public class PostController {
@Autowired
private PostService postService;
@Autowired
private CommentService commentService;
@Autowired
private MapperService mapper;
@GetMapping
public List<PostRsDTO> getAllPosts() {
return postService.getAllPosts().stream()
.map(mapper::toPostRsDTO)
.collect(Collectors.toList());
}
@GetMapping("/{id}")
public ResponseEntity<PostRsDTO> getPostById(@PathVariable Long id) {
return postService.getPostById(id)
.map(post -> ResponseEntity.ok(mapper.toPostRsDTO(post)))
.orElse(ResponseEntity.notFound().build());
}
@PostMapping
public ResponseEntity<PostRsDTO> createPost(@RequestBody @Valid PostRqDTO postRqDTO) {
try {
PostRsDTO createdPost = mapper.toPostRsDTO(postService.createPost(mapper.toPost(postRqDTO)));
return ResponseEntity.status(HttpStatus.CREATED).body(createdPost);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
}
}
@PutMapping("/{id}")
public ResponseEntity<PostRsDTO> updatePost(@PathVariable Long id, @RequestBody @Valid PostRqDTO postRqDTO) {
try {
PostRsDTO updatedPost = mapper.toPostRsDTO(postService.updatePost(mapper.toPost(postRqDTO)));
return ResponseEntity.ok(updatedPost);
} catch (RuntimeException e) {
return ResponseEntity.notFound().build();
}
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deletePost(@PathVariable Long id) {
try {
postService.deletePost(id);
return ResponseEntity.noContent().build();
} catch (RuntimeException e) {
return ResponseEntity.notFound().build();
}
}
//COMMENTS
@GetMapping("/{postId}/comments")
public List<CommentRsDTO> getCommentsByPostId(@PathVariable Long postId) {
return commentService.getCommentsByPostId(postId).stream()
.map(mapper::toCommentRsDTO)
.collect(Collectors.toList());
}
@PostMapping("/{postId}/comments")
public ResponseEntity<CommentRsDTO> addCommentToPost(@PathVariable Long postId, @RequestBody @Valid CommentRqDTO commentRqDTO) {
try {
Comment createdComment = postService.addCommentToPost(postId, commentRqDTO.getText());
CommentRsDTO result = mapper.toCommentRsDTO(createdComment);
return ResponseEntity.status(HttpStatus.CREATED).body(result);
} catch (RuntimeException e) {
return ResponseEntity.badRequest().build();
}
}
@DeleteMapping("/{postId}/comments/{commentId}")
public ResponseEntity<Void> deleteCommentFromPost(@PathVariable Long postId, @PathVariable Long commentId) {
try {
postService.removeCommentFromPost(postId, commentId);
return ResponseEntity.noContent().build();
} catch (RuntimeException e) {
return ResponseEntity.notFound().build();
}
}
//STATISTICS
@GetMapping("/statistics/summary")
public ResponseEntity<List<PostProjection[]>> getPostStatistics() {
try {
List<PostProjection[]> statistics = postService.getPostStatistics();
return ResponseEntity.ok(statistics);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
@GetMapping("/statistics/projection")
public ResponseEntity<List<PostProjection>> getPostsFromprojection() {
try {
List<PostProjection> posts = postService.getPostsFromProjection();
return ResponseEntity.ok(posts);
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
}

View File

@@ -0,0 +1,34 @@
package io.github.f1rstteam.ip_backend_labs.model;
import java.time.LocalDateTime;
import jakarta.persistence.*;
@MappedSuperclass
public abstract class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "created_at", nullable = false, updatable = false)
private LocalDateTime createdAt;
@PrePersist
protected void onCreate() {
createdAt = LocalDateTime.now();
}
public BaseEntity() {}
public BaseEntity(Long id, LocalDateTime createdAt) {
this.id = id;
this.createdAt = createdAt;
}
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}

View File

@@ -0,0 +1,27 @@
package io.github.f1rstteam.ip_backend_labs.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
@Entity
@Table(name = "comments")
public class Comment extends BaseEntity {
@Column(name = "text", nullable = false, length = 1000)
private String text;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", nullable = false)
@JsonIgnore
private Post post;
public Comment() {}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public Post getPost() { return post; }
public void setPost(Post post) { this.post = post; }
}

View File

@@ -0,0 +1,67 @@
package io.github.f1rstteam.ip_backend_labs.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
@Entity
@Table(name = "posts")
public class Post extends BaseEntity {
@Column(name = "text", length = 2000)
private String text;
@Column(name = "image_url")
private String imageUrl;
@Column(name = "likes_count")
private Integer likesCount = 0;
@Column(name = "comments_count")
private Integer commentsCount = 0;
@Column(name = "shares_count")
private Integer sharesCount = 0;
@OneToMany(mappedBy = "post", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JsonIgnore
private List<Comment> comments = new ArrayList<>();
public Post() {}
public String getText() { return text; }
public void setText(String text) { this.text = text; }
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
public Integer getLikesCount() { return likesCount; }
public void setLikesCount(Integer likesCount) { this.likesCount = likesCount; }
public Integer getCommentsCount() { return commentsCount; }
public void setCommentsCount(Integer commentsCount) { this.commentsCount = commentsCount; }
public Integer getSharesCount() { return sharesCount; }
public void setSharesCount(Integer sharesCount) { this.sharesCount = sharesCount; }
public List<Comment> getComments() { return comments; }
public void setComments(List<Comment> comments) { this.comments = comments; }
public void addComment(Comment comment) {
comments.add(comment);
comment.setPost(this);
this.commentsCount = comments.size();
}
public void removeComment(Comment comment) {
comments.remove(comment);
comment.setPost(null);
this.commentsCount = comments.size();
}
}

View File

@@ -0,0 +1,15 @@
spring.main.banner-mode=off
spring.application.name=Internet Programming Backend Labs
# Available levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
logging.level.ru.ulstu.is.server=DEBUG
spring.datasource.url=jdbc:h2:file:./data
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create
# spring.jpa.show-sql=true
# spring.jpa.properties.hibernate.format_sql=true
spring.h2.console.enabled=true

View File

@@ -0,0 +1,253 @@
package io.github.f1rstteam.ip_backend_labs;
import io.github.f1rstteam.ip_backend_labs.model.*;
import io.github.f1rstteam.ip_backend_labs.Repositories.*;
import io.github.f1rstteam.ip_backend_labs.Service.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
@ExtendWith(MockitoExtension.class)
class CommentServiceTest {
@Mock
private CommentRepository commentRepository;
@InjectMocks
private CommentService commentService;
private Post testPost;
private Comment testComment1;
private Comment testComment2;
@BeforeEach
void setUp() {
testPost = new Post();
testPost.setId(1L);
testPost.setText("Test post content");
testComment1 = new Comment();
testComment1.setId(1L);
testComment1.setText("First test comment");
testComment1.setPost(testPost);
testComment2 = new Comment();
testComment2.setId(2L);
testComment2.setText("Second test comment with more content");
testComment2.setPost(testPost);
}
@Test
void getCommentsByPostId_WithValidPostId_ShouldReturnComments() {
// Arrange
Long postId = 1L;
List<Comment> expectedComments = Arrays.asList(testComment1, testComment2);
when(commentRepository.findByPostId(postId)).thenReturn(expectedComments);
// Act
List<Comment> result = commentService.getCommentsByPostId(postId);
// Assert
assertNotNull(result);
assertEquals(2, result.size());
assertEquals(expectedComments, result);
verify(commentRepository, times(1)).findByPostId(postId);
}
@Test
void getCommentsByPostId_WithNonExistingPostId_ShouldReturnEmptyList() {
// Arrange
Long postId = 999L;
when(commentRepository.findByPostId(postId)).thenReturn(Arrays.asList());
// Act
List<Comment> result = commentService.getCommentsByPostId(postId);
// Assert
assertNotNull(result);
assertTrue(result.isEmpty());
verify(commentRepository, times(1)).findByPostId(postId);
}
@Test
void getLongCommentsInPosts_WithValidMinLength_ShouldReturnLongComments() {
// Arrange
int minLength = 10;
int maxLength = 100;
List<Comment> expectedComments = Arrays.asList(testComment2);
when(commentRepository.findLongCommentsInPosts(minLength, maxLength)).thenReturn(expectedComments);
// Act
List<Comment> result = commentService.getLongCommentsInPosts(minLength, maxLength);
// Assert
assertNotNull(result);
assertEquals(1, result.size());
assertEquals(testComment2, result.get(0));
verify(commentRepository, times(1)).findLongCommentsInPosts(minLength, maxLength);
}
@Test
void getLongCommentsInPosts_WithHighMinLength_ShouldReturnEmptyList() {
// Arrange
int minLength = 100;
int maxLength = 150;
when(commentRepository.findLongCommentsInPosts(minLength, maxLength)).thenReturn(Arrays.asList());
// Act
List<Comment> result = commentService.getLongCommentsInPosts(minLength, maxLength);
// Assert
assertNotNull(result);
assertTrue(result.isEmpty());
verify(commentRepository, times(1)).findLongCommentsInPosts(minLength, maxLength);
}
@Test
void getLongCommentsInPosts_WithZeroMinLength_ShouldReturnAllComments() {
// Arrange
int minLength = 0;
int maxLength = 150;
List<Comment> expectedComments = Arrays.asList(testComment1, testComment2);
when(commentRepository.findLongCommentsInPosts(minLength, maxLength)).thenReturn(expectedComments);
// Act
List<Comment> result = commentService.getLongCommentsInPosts(minLength, maxLength);
// Assert
assertNotNull(result);
assertEquals(2, result.size());
verify(commentRepository, times(1)).findLongCommentsInPosts(minLength, maxLength);
}
@Test
void getLongCommentsInPosts_WithNegativeMinLength_ShouldHandleGracefully() {
// Arrange
int minLength = -5;
int maxLength = 100;
List<Comment> expectedComments = Arrays.asList(testComment1, testComment2);
when(commentRepository.findLongCommentsInPosts(minLength, maxLength)).thenReturn(expectedComments);
// Act
List<Comment> result = commentService.getLongCommentsInPosts(minLength, maxLength);
// Assert
assertNotNull(result);
assertEquals(2, result.size());
verify(commentRepository, times(1)).findLongCommentsInPosts(minLength, maxLength);
}
@Test
void getCommentStatistics_WithValidMinComments_ShouldReturnStatistics() {
// Arrange
long minComments = 5L;
Object[] stat1 = new Object[]{"Post 1", 10L};
Object[] stat2 = new Object[]{"Post 2", 8L};
List<Object[]> expectedStats = Arrays.asList(stat1, stat2);
when(commentRepository.getCommentStatsByPost(minComments)).thenReturn(expectedStats);
// Act
List<Object[]> result = commentService.getCommentStatistics(minComments);
// Assert
assertNotNull(result);
assertEquals(2, result.size());
assertEquals(expectedStats, result);
verify(commentRepository, times(1)).getCommentStatsByPost(minComments);
}
@Test
void getCommentStatistics_WithZeroMinComments_ShouldReturnAllStatistics() {
// Arrange
long minComments = 0L;
Object[] stat1 = new Object[]{"Post 1", 2L};
List<Object[]> expectedStats = Arrays.<Object[]>asList(stat1);
when(commentRepository.getCommentStatsByPost(minComments)).thenReturn(expectedStats);
// Act
List<Object[]> result = commentService.getCommentStatistics(minComments);
// Assert
assertNotNull(result);
assertEquals(1, result.size());
verify(commentRepository, times(1)).getCommentStatsByPost(minComments);
}
@Test
void getCommentStatistics_WithHighMinComments_ShouldReturnFilteredStatistics() {
// Arrange
long minComments = 100L;
List<Object[]> expectedStats = Arrays.asList();
when(commentRepository.getCommentStatsByPost(minComments)).thenReturn(expectedStats);
// Act
List<Object[]> result = commentService.getCommentStatistics(minComments);
// Assert
assertNotNull(result);
assertTrue(result.isEmpty());
verify(commentRepository, times(1)).getCommentStatsByPost(minComments);
}
@Test
void getCommentStatistics_WithNegativeMinComments_ShouldHandleGracefully() {
// Arrange
long minComments = -5L;
Object[] stat1 = new Object[]{"Post 1", 10L};
List<Object[]> expectedStats = Arrays.<Object[]>asList(stat1);
when(commentRepository.getCommentStatsByPost(minComments)).thenReturn(expectedStats);
// Act
List<Object[]> result = commentService.getCommentStatistics(minComments);
// Assert
assertNotNull(result);
assertEquals(1, result.size());
verify(commentRepository, times(1)).getCommentStatsByPost(minComments);
}
@Test
void getCommentsByPostId_ShouldCallRepositoryWithCorrectParameters() {
// Arrange
Long expectedPostId = 123L;
when(commentRepository.findByPostId(expectedPostId)).thenReturn(Arrays.asList(testComment1));
// Act
commentService.getCommentsByPostId(expectedPostId);
// Assert
verify(commentRepository, times(1)).findByPostId(expectedPostId);
}
@Test
void getCommentStatistics_ShouldCallRepositoryWithCorrectParameters() {
// Arrange
long expectedMinComments = 50L;
when(commentRepository.getCommentStatsByPost(expectedMinComments)).thenReturn(Arrays.asList());
// Act
commentService.getCommentStatistics(expectedMinComments);
// Assert
verify(commentRepository, times(1)).getCommentStatsByPost(expectedMinComments);
}
}

View File

@@ -0,0 +1,13 @@
package io.github.f1rstteam.ip_backend_labs;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class InternetProgrammingBackendLabsApplicationTests {
@Test
void contextLoads() {
}
}

View File

@@ -0,0 +1,274 @@
package io.github.f1rstteam.ip_backend_labs;
import io.github.f1rstteam.ip_backend_labs.model.*;
import io.github.f1rstteam.ip_backend_labs.Projections.PostProjection;
import io.github.f1rstteam.ip_backend_labs.Repositories.*;
import io.github.f1rstteam.ip_backend_labs.Service.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.*;
@ExtendWith(MockitoExtension.class)
class PostServiceTest {
@Mock
private PostRepository postRepository;
@Mock
private CommentRepository commentRepository;
@InjectMocks
private PostService postService;
private Post testPost;
private Comment testComment;
@BeforeEach
void setUp() {
testPost = new Post();
testPost.setId(1L);
testPost.setText("Test post content");
testComment = new Comment();
testComment.setId(1L);
testComment.setText("Test Comment Content");
}
@Test
void createPost_ShouldReturnSavedPost() {
// Arrange
when(postRepository.save(any(Post.class))).thenReturn(testPost);
// Act
Post result = postService.createPost(testPost);
// Assert
assertNotNull(result);
assertEquals(testPost.getId(), result.getId());
assertEquals(testPost.getText(), result.getText());
verify(postRepository, times(1)).save(testPost);
}
@Test
void getAllPosts_ShouldReturnAllPosts() {
// Arrange
List<Post> expectedPosts = Arrays.asList(testPost, new Post());
when(postRepository.findAll()).thenReturn(expectedPosts);
// Act
List<Post> result = postService.getAllPosts();
// Assert
assertNotNull(result);
assertEquals(2, result.size());
verify(postRepository, times(1)).findAll();
}
@Test
void getPostById_WithExistingId_ShouldReturnPost() {
// Arrange
when(postRepository.findById(1L)).thenReturn(Optional.of(testPost));
// Act
Optional<Post> result = postService.getPostById(1L);
// Assert
assertTrue(result.isPresent());
assertEquals(testPost.getId(), result.get().getId());
verify(postRepository, times(1)).findById(1L);
}
@Test
void getPostById_WithNonExistingId_ShouldReturnEmpty() {
// Arrange
when(postRepository.findById(999L)).thenReturn(Optional.empty());
// Act
Optional<Post> result = postService.getPostById(999L);
// Assert
assertFalse(result.isPresent());
verify(postRepository, times(1)).findById(999L);
}
@Test
void getPublishedPostsWithProjection_ShouldReturnProjections() {
// Arrange
PostProjection projection = mock(PostProjection.class);
List<PostProjection> expectedProjections = Arrays.asList(projection);
when(postRepository.findPostsWithProjection()).thenReturn(expectedProjections);
// Act
List<PostProjection> result = postService.getPublishedPostsWithProjection();
// Assert
assertNotNull(result);
assertEquals(1, result.size());
verify(postRepository, times(1)).findPostsWithProjection();
}
@Test
void updatePost_ShouldReturnUpdatedPost() {
// Arrange
Post updatedPost = new Post();
updatedPost.setId(1L);
updatedPost.setText("Updated Text");
when(postRepository.save(any(Post.class))).thenReturn(updatedPost);
// Act
Post result = postService.updatePost(updatedPost);
// Assert
assertNotNull(result);
assertEquals(updatedPost.getText(), result.getText());
verify(postRepository, times(1)).save(updatedPost);
}
@Test
void deletePost_ShouldCallRepository() {
// Act
postService.deletePost(1L);
// Assert
verify(postRepository, times(1)).deleteById(1L);
}
@Test
void addCommentToPost_WithExistingPost_ShouldAddComment() {
// Arrange
when(postRepository.findById(1L)).thenReturn(Optional.of(testPost));
when(commentRepository.save(any(Comment.class))).thenReturn(testComment);
// Act
Comment result = postService.addCommentToPost(1L, "Test Comment Content");
// Assert
assertNotNull(result);
assertEquals("Test Comment Content", result.getText());
verify(postRepository, times(1)).findById(1L);
verify(commentRepository, times(1)).save(any(Comment.class));
}
@Test
void addCommentToPost_WithNonExistingPost_ShouldThrowException() {
// Arrange
when(postRepository.findById(999L)).thenReturn(Optional.empty());
// Act & Assert
RuntimeException exception = assertThrows(RuntimeException.class,
() -> postService.addCommentToPost(999L, "Test Comment"));
assertEquals("Post not found", exception.getMessage());
verify(postRepository, times(1)).findById(999L);
verify(commentRepository, never()).save(any(Comment.class));
}
@Test
void removeCommentFromPost_WithValidIds_ShouldRemoveComment() {
// Arrange
when(postRepository.findById(1L)).thenReturn(Optional.of(testPost));
when(commentRepository.findById(1L)).thenReturn(Optional.of(testComment));
doNothing().when(commentRepository).delete(testComment);
// Act
postService.removeCommentFromPost(1L, 1L);
// Assert
verify(postRepository, times(1)).findById(1L);
verify(commentRepository, times(1)).findById(1L);
verify(commentRepository, times(1)).delete(testComment);
}
@Test
void removeCommentFromPost_WithNonExistingPost_ShouldThrowException() {
// Arrange
when(postRepository.findById(999L)).thenReturn(Optional.empty());
// Act & Assert
RuntimeException exception = assertThrows(RuntimeException.class,
() -> postService.removeCommentFromPost(999L, 1L));
assertEquals("Post not found", exception.getMessage());
verify(postRepository, times(1)).findById(999L);
verify(commentRepository, never()).findById(anyLong());
verify(commentRepository, never()).delete(any(Comment.class));
}
@Test
void removeCommentFromPost_WithNonExistingComment_ShouldThrowException() {
// Arrange
when(postRepository.findById(1L)).thenReturn(Optional.of(testPost));
when(commentRepository.findById(999L)).thenReturn(Optional.empty());
// Act & Assert
RuntimeException exception = assertThrows(RuntimeException.class,
() -> postService.removeCommentFromPost(1L, 999L));
assertEquals("Comment not found", exception.getMessage());
verify(postRepository, times(1)).findById(1L);
verify(commentRepository, times(1)).findById(999L);
verify(commentRepository, never()).delete(any(Comment.class));
}
@Test
void getPostsFromProjection_ShouldReturnProjections() {
// Arrange
PostProjection projection = mock(PostProjection.class);
List<PostProjection> expectedProjections = Arrays.asList(projection);
when(postRepository.findPostsWithProjection()).thenReturn(expectedProjections);
// Act
List<PostProjection> result = postService.getPostsFromProjection();
// Assert
assertNotNull(result);
assertEquals(1, result.size());
verify(postRepository, times(1)).findPostsWithProjection();
}
@Test
void createPost_WithNullPost_ShouldThrowException() {
// Arrange
when(postRepository.save(null)).thenThrow(new IllegalArgumentException("Post cannot be null"));
// Act & Assert
assertThrows(IllegalArgumentException.class,
() -> postService.createPost(null));
}
@Test
void updatePost_WithNullPost_ShouldThrowException() {
// Arrange
when(postRepository.save(null)).thenThrow(new IllegalArgumentException("Post cannot be null"));
// Act & Assert
assertThrows(IllegalArgumentException.class,
() -> postService.updatePost(null));
}
@Test
void deletePost_WithNullId_ShouldThrowException() {
// Arrange
doThrow(new IllegalArgumentException("ID cannot be null"))
.when(postRepository).deleteById(null);
// Act & Assert
assertThrows(IllegalArgumentException.class,
() -> postService.deletePost(null));
}
}

View File

@@ -0,0 +1 @@
[{"id":1,"title":"4534","description":"45","completed":false}]

View File

@@ -1,208 +0,0 @@
body {
color: #c5c6c7;
background-color: #141414;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.right-part > img {
border-radius: 25px;
}
/* Основная страница */
.leftbar {
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 120px;
}
.leftbar-content > a {
border-radius: 5px;
}
.leftbar-settings {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.leftbar-settings > a{
border-radius: 5px;
}
.footer {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.footer > span {
z-index: 1;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -6%;
width: 110%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
min-width: 120px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
border-radius: 5px;
}
.content {
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
min-width: 250px;
}
.post-header {
color: #fff;
border-top: 0.5px solid #BF1723;
padding-top: 3%;
}
.image .post-img {
border-radius: 2%;
}
.post-footer {
color: #fff;
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 150px;
}
.rightbar-content > a {
border-radius: 5px;
}
.bottombar{
bottom: 0;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
background-color: #222222;
}
.bottombar > a > img {
width: 25px;
}
/*Форма для добавления*/
.formContainer{
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
max-width: 300px;
}
/* Обновлённые стили для кнопок управления постом */
.post-header {
display: flex;
align-items: center;
gap: 8px;
}
.post-actions {
margin-left: auto;
display: flex;
gap: 5px;
}
.post-actions button {
font-size: 0.8rem;
padding: 0.1rem 0.4rem;
}
/* Стили для изображений */
.image-preview {
max-width: 100%;
max-height: 200px;
margin-top: 10px;
display: none;
border-radius: 8px;
}
.post-img {
border-radius: 8px;
object-fit: cover;
}
.like-btn {
cursor: pointer;
transition: color 0.2s;
}
.like-btn.text-danger {
color: #dc3545 !important;
}

View File

@@ -1,159 +0,0 @@
body {
color: #c5c6c7;
background-color: #141414;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.right-part > img {
border-radius: 25px;
}
/* Основная страница */
.leftbar {
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 120px;
}
.leftbar-content > a {
border-radius: 5px;
}
.leftbar-settings {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.leftbar-settings > a{
border-radius: 5px;
}
.footer {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.footer > span {
z-index: 1;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -6%;
width: 110%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
min-width: 120px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
border-radius: 5px;
}
.content {
background-color: #222222;
border-radius: 15px;
border: 0.1px solid #BF1723;
min-width: 250px;
}
.chat {
border-bottom: 0.5px solid rgba(128, 128, 128, 0.479);
}
.chat > .avatar > img {
border-radius: 25px;
}
.username {
color: white;
}
.message {
color: rgb(158, 158, 158);
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 150px;
}
.rightbar-content > a {
border-radius: 5px;
}
.bottombar{
bottom: 0;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
background-color: #222222;
}
.bottombar > a > img {
width: 25px;
}

View File

@@ -1,176 +0,0 @@
* {
box-sizing: border-box;
}
body {
color: #c5c6c7;
background-color: #141414;
margin: 0px;
}
a:link {
color: white;
text-decoration: none;
}
a:visited {
color: white;
}
a:hover {
color: #BF1723;
background-color: #2a2a2a;
}
a:active {
color: #FCD116;
}
img {
width: 50px;
}
li {
list-style: none;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.right-part > img {
border-radius: 25px;
}
/* Основная страница */
.leftbar {
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 120px;
}
.leftbar-content > a {
border-radius: 5px;
}
.leftbar-settings {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.leftbar-settings > a{
border-radius: 5px;
}
.footer {
border-top: 1px solid rgba(128, 128, 128, 0.479);
}
.footer > span {
z-index: 1;
cursor: pointer;
color: white;
}
span:hover {
color: #BF1723;
}
.footer:hover .footer-menu {
display: flex;
flex-direction: column;
top: 150%;
left: -6%;
width: 110%;
position: absolute;
background-color: #222222;
border-radius: 10px;
padding: 10px;
min-width: 120px;
}
.footer-menu {
display: none;
}
.footer-menu > a {
border-radius: 5px;
}
.profile-card {
max-width: 250px;
width: 100%;
background-color: #222222;
border-radius: 25px;
}
.image {
width: 150px;
height: 150px;
border-radius: 50%;
background-color: #FCD116;
}
.image .profile-img {
border-radius: 50%;
border: 3px solid #FFF;
}
.text-data .name {
font-size: 22px;
font-weight: 500;
color: #fff;
}
.text-data .about {
font-size: 15px;
font-weight: 400;
color: #fff;
margin-bottom: 10px;
}
.profile-card .more-info {
width: 90%;
}
.rightbar {
height: 100%;
width: 10%;
background-color: #222222;
border-radius: 15px;
min-width: 150px;
}
.rightbar-content > a {
border-radius: 5px;
}
.bottombar{
bottom: 0;
border-top: 3px solid #BF1723;
border-top-right-radius: 25px;
border-top-left-radius: 25px;
background-color: #222222;
}
.bottombar > a > img {
width: 25px;
}

View File

@@ -1,76 +0,0 @@
body {
color: #c5c6c7;
background-color: #0b0c10;
}
/* Шапка */
header .container-fluid {
border-bottom: 3px solid #BF1723;
border-bottom-right-radius: 25px;
border-bottom-left-radius: 25px;
}
.first-part {
color:#FCD116;
font-size: 1.4em;
}
.last-part {
color: #BF1723;
font-size: 1.5em;
}
.right-part > nav > ul > li > a {
border: 0.5px solid #FFF;
border-radius: 10px;
}
/* Блок регистрации */
.login-page {
background-color: #222222;
border-radius: 15%;
border: 0.5px solid #BF1723;
color: #FFF;
}
.remember-forgot label input {
accent-color: #BF1723;
}
.login-page .btn {
background-color: #BF1723;
border-radius: 10px;
color: #fff;
}
.input-box input {
border-radius: 4px;
}
.input-box input:focus {
border-color: #BF1723;
outline: none;
}
/* Ссылки */
a {
outline: none;
text-decoration: none;
}
a:link{
color: #FCD116;
}
a:visited{
color: #FCD116;
}
a:hover{
color: #c5c6c7;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,70 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>СОЦИАЛьная сеть</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="css/index-style.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
</head>
<body>
<header>
<div class="container-fluid d-flex justify-content-evenly">
<div class="left-part d-flex">
<img src="source/logo.svg" alt="Logo" width="50">
<div class="d-flex align-items-center pt-3">
<p class="first-part ms-3">СОЦИАЛ</p>
<p class="last-part">ьная сеть</p>
</div>
</div>
<div class="right-part d-none d-sm-flex me-4 pt-3">
<nav>
<ul class="d-flex list-unstyled p-0 m-0">
<li><a class="d-block me-2 p-2" href="messages.html" >Войти</a></li>
<li><a class="d-block me-2 p-2" href="signup.html">Зарегистрироваться</a></li>
</ul>
</nav>
</div>
</div>
</header>
<section>
<div class="container-fluid d-flex justify-content-center align-items-center" style="height: calc(100vh - 200px);">
<div class="login-page" style="min-width: 300px; max-width: 400px; width: 100%;">
<form class="px-3">
<h1 class="text-center">Авторизация</h1>
<div class="input-div d-flex flex-column align-items-center mb-2">
<div class="input-box my-1">
<input type="text" placeholder="Логин">
<i class="bi bi-person"></i>
</div>
<div class="input-box my-1">
<input type="password" placeholder="Пароль">
<i class="bi bi-shield-lock"></i>
</div>
</div>
<div class="remember-forgot d-flex justify-content-evenly mb-2 px-2">
<label><input type="checkbox"> Запомнить меня</label>
<a href="#">Забыли пароль?</a>
</div>
<button type="submit" class="btn w-100">Войти</button>
<div class="register-link d-flex justify-content-evenly align-items-center">
<p class="pt-3">У меня нет аккаунта</p>
<a href="signup.html">Зарегистрироваться</a>
</div>
</form>
</div>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>

View File

@@ -1,451 +0,0 @@
// Модель
class PostModel {
constructor() {
this.apiUrl = 'http://localhost:3000/posts';
}
async getAllPosts() {
try {
const response = await fetch(this.apiUrl);
return await response.json();
} catch (error) {
console.error('Error fetching posts:', error);
return [];
}
}
async getPostById(id) {
try {
const response = await fetch(`${this.apiUrl}/${id}`);
return await response.json();
} catch (error) {
console.error(`Error fetching post ${id}:`, error);
return null;
}
}
async createPost(postData) {
try {
const response = await fetch(this.apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(postData),
});
return await response.json();
} catch (error) {
console.error('Error creating post:', error);
return null;
}
}
async updatePost(id, postData) {
try {
const response = await fetch(`${this.apiUrl}/${id}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(postData),
});
return await response.json();
} catch (error) {
console.error(`Error updating post ${id}:`, error);
return null;
}
}
async deletePost(id) {
try {
const response = await fetch(`${this.apiUrl}/${id}`, {
method: 'DELETE',
});
return response.ok;
} catch (error) {
console.error(`Error deleting post ${id}:`, error);
return false;
}
}
}
// Представление
class PostView {
constructor() {
this.app = document.querySelector('.content');
this.postTemplate = this.createPostTemplate();
}
createPostTemplate() {
const template = document.createElement('template');
template.innerHTML = `
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label class="group-name"></label>
<div class="post-actions">
<button class="btn btn-sm btn-outline-secondary edit-post"><i class="bi bi-pencil"></i></button>
<button class="btn btn-sm btn-outline-danger delete-post"><i class="bi bi-trash"></i></button>
</div>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img class="post-img w-100 h-100 object-fit-cover"/>
</div>
<p class="post-text p-2"></p>
<div class="post-footer p-1">
<i class='bi bi-heart me-2 like-btn'><span class="ms-1 likes-count">0</span></i>
<i class='bi bi-chat-left me-2'><span class="ms-1 comments-count">0</span></i>
<i class='bi bi-reply me-2'><span class="ms-1 shares-count">0</span></i>
</div>
</div>
`;
return template;
}
renderPosts(posts) {
// Очищаем контейнер с постами
const oldPosts = this.app.querySelectorAll('.post');
oldPosts.forEach(post => {
if (!post.id.startsWith('post-form')) {
post.remove();
}
});
// Добавляем новые посты
posts.forEach(post => {
const postElement = this.postTemplate.content.cloneNode(true);
const postNode = postElement.querySelector('.post');
postNode.id = `post-${post.id}`;
postNode.querySelector('.group-name').textContent = post.groupName || 'Моя группа';
postNode.querySelector('.post-text').textContent = post.text || '';
const imgElement = postNode.querySelector('.post-img');
if (post.image) {
// Используем полный путь к изображению или base64 данные
if (post.image.startsWith('data:')) {
imgElement.src = post.image;
} else {
imgElement.src = post.image;
}
imgElement.alt = post.text || 'Post image';
} else {
imgElement.parentElement.remove();
}
postNode.querySelector('.likes-count').textContent = post.likes || 0;
postNode.querySelector('.comments-count').textContent = post.comments || 0;
postNode.querySelector('.shares-count').textContent = post.shares || 0;
// Добавляем обработчики для кнопок
postNode.querySelector('.edit-post').addEventListener('click', () => {
this.onEditPost(post.id);
});
postNode.querySelector('.delete-post').addEventListener('click', () => {
this.onDeletePost(post.id);
});
postNode.querySelector('.like-btn').addEventListener('click', () => {
this.onLikePost(post.id);
});
this.app.appendChild(postNode);
});
}
renderPostForm(post = null) {
// Удаляем существующую форму, если есть
const existingForm = document.getElementById('post-form');
if (existingForm) {
existingForm.remove();
}
// Создаем новую форму
const formTemplate = document.createElement('template');
formTemplate.innerHTML = `
<div class="add-post-form mb-4 pb-3" id="post-form">
<h5>${post ? 'Редактировать пост' : 'Новый пост'}</h5>
<form id="${post ? 'editPostForm' : 'createPostForm'}">
<div class="mb-3">
<textarea id="postText" class="form-control" placeholder="Напишите что-нибудь..." rows="3">${post ? post.text : ''}</textarea>
</div>
<div class="mb-3">
<label for="postImage" class="btn btn-outline-secondary">
<i class="bi bi-image"></i> ${post && post.image ? 'Заменить изображение' : 'Выбрать изображение'}
</label>
<input type="file" id="postImage" accept="image/*" class="d-none">
${post && post.image ? `<img src="${post.image}" id="imagePreview" class="image-preview" style="display: block;">` : '<img id="imagePreview" class="image-preview">'}
</div>
<input type="hidden" id="postId" value="${post ? post.id : ''}">
<div class="d-flex justify-content-between">
<button type="button" id="cancelPostBtn" class="btn btn-outline-secondary">
Отмена
</button>
<button type="submit" class="btn btn-danger">
<i class="bi bi-send"></i> ${post ? 'Обновить' : 'Опубликовать'}
</button>
</div>
</form>
</div>
`;
const formNode = formTemplate.content.cloneNode(true);
this.app.insertBefore(formNode, this.app.firstChild);
// Обработка загрузки изображения
document.getElementById('postImage')?.addEventListener('change', (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
const preview = document.getElementById('imagePreview');
preview.src = event.target.result;
preview.style.display = 'block';
};
reader.readAsDataURL(file);
}
});
// Обработка отмены
document.getElementById('cancelPostBtn')?.addEventListener('click', () => {
document.getElementById('post-form').remove();
document.getElementById('showFormBtn').classList.remove('d-none');
});
}
bindCreatePost(handler) {
document.getElementById('showFormBtn')?.addEventListener('click', () => {
this.renderPostForm();
document.getElementById('showFormBtn').classList.add('d-none');
});
document.addEventListener('submit', (e) => {
if (e.target.id === 'createPostForm') {
e.preventDefault();
const text = document.getElementById('postText').value;
const imageFile = document.getElementById('postImage').files[0];
handler({ text, imageFile });
}
});
}
bindEditPost(handler) {
document.addEventListener('submit', (e) => {
if (e.target.id === 'editPostForm') {
e.preventDefault();
const id = document.getElementById('postId').value;
const text = document.getElementById('postText').value;
const imageFile = document.getElementById('postImage').files[0];
handler(id, { text, imageFile });
}
});
}
bindDeletePost(handler) {
this.onDeletePost = handler;
}
bindLikePost(handler) {
this.onLikePost = handler;
}
bindOnEditPost(handler) {
this.onEditPost = handler;
}
}
// Контроллер
class PostController {
constructor(model, view) {
this.model = model;
this.view = view;
// Привязываем обработчики событий
this.view.bindCreatePost(this.handleCreatePost.bind(this));
this.view.bindEditPost(this.handleUpdatePost.bind(this));
this.view.bindDeletePost(this.handleDeletePost.bind(this));
this.view.bindLikePost(this.handleLikePost.bind(this));
this.view.bindOnEditPost(this.handleEditPost.bind(this));
// Загружаем начальные данные
this.initialize();
}
async initialize() {
const posts = await this.model.getAllPosts();
//Сортировка по дате
const sortedPosts = posts.sort((a, b) => {
const dateA = new Date(a.createdAt || 0);
const dateB = new Date(b.createdAt || 0);
return dateB - dateA;
});
const postsWithGroups = sortedPosts.map(post => ({
...post,
groupName: `Какая-то группа`
}));
this.view.renderPosts(postsWithGroups);
}
async checkImageDimensions(file) {
return new Promise((resolve, reject) => {
const img = new Image();
const url = URL.createObjectURL(file);
img.onload = function() {
URL.revokeObjectURL(url);
resolve({
isSquare: this.width === this.height,
width: this.width,
height: this.height
});
};
img.onerror = function() {
URL.revokeObjectURL(url);
reject(new Error('Не удалось загрузить изображение'));
};
img.src = url;
});
}
async handleCreatePost(postData) {
const { text, imageFile } = postData;
if (!text.trim() && !imageFile) {
alert('Добавьте текст или изображение');
return;
}
// Если есть изображение, сохраняем его как base64
let imageData = null;
if (imageFile) {
try {
const { isSquare, width, height } = await this.checkImageDimensions(imageFile);
if (!isSquare) {
alert(`Изображение должно быть квадратным! Текущий размер: ${width}×${height}px`);
return;
}
imageData = await this.getImageData(imageFile);
} catch (error) {
console.error('Ошибка проверки изображения:', error);
alert('Не удалось обработать изображение');
return;
}
}
const newPost = {
text,
image: imageData,
likes: 0,
comments: 0,
shares: 0,
groupId: 1,
createdAt: new Date().toISOString()
};
const createdPost = await this.model.createPost(newPost);
if (createdPost) {
this.initialize(); // Перезагружаем посты
document.getElementById('post-form').remove();
document.getElementById('showFormBtn').classList.remove('d-none');
}
}
async handleUpdatePost(id, postData) {
const { text, imageFile } = postData;
if (!text.trim() && !imageFile) {
alert('Добавьте текст или изображение');
return;
}
const post = await this.model.getPostById(id);
if (!post) return;
// Если есть новое изображение, сохраняем его как base64
let imageData = post.image;
if (imageFile) {
try {
const { isSquare, width, height } = await this.checkImageDimensions(imageFile);
if (!isSquare) {
alert(`Изображение должно быть квадратным! Текущий размер: ${width}×${height}px`);
return;
}
imageData = await this.getImageData(imageFile);
} catch (error) {
console.error('Ошибка проверки изображения:', error);
alert('Не удалось обработать изображение');
return;
}
}
const updatedPost = {
...post,
text,
image: imageData
};
const result = await this.model.updatePost(id, updatedPost);
if (result) {
this.initialize(); // Перезагружаем посты
document.getElementById('post-form').remove();
document.getElementById('showFormBtn').classList.remove('d-none');
}
}
async handleDeletePost(id) {
if (confirm('Вы уверены, что хотите удалить этот пост?')) {
const success = await this.model.deletePost(id);
if (success) {
this.initialize(); // Перезагружаем посты
}
}
}
async handleLikePost(id) {
const post = await this.model.getPostById(id);
if (!post) return;
const updatedPost = {
...post,
likes: (post.likes || 0) + 1
};
const result = await this.model.updatePost(id, updatedPost);
if (result) {
this.initialize(); // Перезагружаем посты
}
}
async handleEditPost(id) {
const post = await this.model.getPostById(id);
if (post) {
this.view.renderPostForm(post);
document.getElementById('showFormBtn').classList.add('d-none');
}
}
// Преобразование изображения в base64
async getImageData(file) {
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = (event) => {
resolve(event.target.result);
};
reader.readAsDataURL(file);
});
}
}
// Инициализация приложения
document.addEventListener('DOMContentLoaded', () => {
const model = new PostModel();
const view = new PostView();
new PostController(model, view);
});

View File

@@ -1,180 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Лента новостей</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="css/lenta-style.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
</head>
<body class="m-0">
<header>
<div class="container-fluid d-flex justify-content-evenly">
<div class="left-part d-flex">
<img src="source/logo.svg" alt="Logo" width="50">
</div>
<div class="right-part d-none d-sm-flex me-4 my-1">
<img src="source/photo.jpg" alt="" class="account-image">
</div>
</div>
</header>
<section>
<div class="page d-flex justify-content-center mt-3">
<div class="leftbar d-none h-100 m-1 d-sm-flex flex-column">
<div class="leftbar-content d-flex flex-column mt-2 mx-2 mb-1">
<a class="mb-1 p-1" href="profile.html">Профиль</a>
<a class="mb-1 p-1" href="lenta.html">Лента</a>
<a class="mb-1 p-1" href="messages.html">Сообщения</a>
</div>
<div class="leftbar-settings d-flex flex-column mt-2 mx-2 mb-0 pt-1">
<a class="p-1" href="index.html">Настройки</a>
</div>
<div class="footer position-relative m-2 pt-1">
<span class="position-relative">Ещё &#9660;</span>
<div class="footer-menu">
<a class="mb-1 p-1" href="#">Разработчикам</a>
<a class="mb-1 p-1" href="#">О нас</a>
<a class="mb-1 p-1" href="#">Правовая информация</a>
<a class="mb-1 p-1" href="#">Помощь</a>
</div>
</div>
</div>
<div class="content h-100 w-25 m-1 p-2 mb-5 d-flex flex-column justify-content-center">
<button id="showFormBtn" class="btn btn-danger add-post-btn m-3">
<i class="bi bi-plus-circle"></i> Добавить пост
</button>
<div class="add-post-form mb-4 d-none pb-3" id="postFormContainer">
<h5>Новый пост</h5>
<form id="postForm">
<div class="mb-3">
<textarea id="postText" class="form-control" placeholder="Напишите что-нибудь..." rows="3"></textarea>
</div>
<div class="mb-3">
<label for="postImage" class="btn btn-outline-secondary">
<i class="bi bi-image"></i> Выбрать изображение
</label>
<input type="file" id="postImage" accept="image/*" class="d-none">
<img id="imagePreview" class="image-preview">
</div>
<div class="d-flex justify-content-between">
<button type="button" id="cancelPostBtn" class="btn btn-outline-secondary">
Отмена
</button>
<button type="submit" class="btn btn-danger">
<i class="bi bi-send"></i> Опубликовать
</button>
</div>
</form>
</div>
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label>Какая-то группа 1</label>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img src="source/meme1.jpg" class="post-img w-100 h-100 object-fit-cover"/>
</div>
<div class="post-footer p-1">
<i class='bi bi-heart me-2' ><span class="ms-1">8</span></i>
<i class='bi bi-chat-left me-2' ><span class="ms-1">2</span></i>
<i class='bi bi-reply me-2' ><span class="ms-1">1</span></i>
</div>
</div>
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label>Какая-то группа 2</label>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img src="source/meme2.jpg" class="post-img w-100 h-100 object-fit-cover"/>
</div>
<div class="post-footer p-1">
<i class='bi bi-heart me-2' ><span class="ms-1">785</span></i>
<i class='bi bi-chat-left me-2' ><span class="ms-1">102</span></i>
<i class='bi bi-reply me-2' ><span class="ms-1">14</span></i>
</div>
</div>
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label>Какая-то группа 3</label>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img src="source/meme3.jpg" class="post-img w-100 h-100 object-fit-cover"/>
</div>
<div class="post-footer p-1">
<i class='bi bi-heart me-2' ><span class="ms-1">156</span></i>
<i class='bi bi-chat-left me-2' ><span class="ms-1">10</span></i>
<i class='bi bi-reply me-2' ><span class="ms-1">0</span></i>
</div>
</div>
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label>Какая-то группа 4</label>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img src="source/meme4.jpg" class="post-img w-100 h-100 object-fit-cover"/>
<label>Горшок для ФИСТа, в котором хранится прах студентов, которые не сдали сессию</label>
</div>
<div class="post-footer p-1">
<i class='bi bi-heart me-2' ><span class="ms-1">456</span></i>
<i class='bi bi-chat-left me-2' ><span class="ms-1">32</span></i>
<i class='bi bi-reply me-2' ><span class="ms-1">4</span></i>
</div>
</div>
<div class="post mb-3">
<div class="post-header mb-2">
<i class='bi bi-people'></i>
<label>Какая-то группа 5</label>
</div>
<div class="image position-relative w-98 p-1 mb-2">
<img src="source/meme5.jpg" class="post-img w-100 h-100 object-fit-cover"/>
</div>
<div class="post-footer p-1">
<i class='bi bi-heart me-2' ><span class="ms-1">1067</span></i>
<i class='bi bi-chat-left me-2' ><span class="ms-1">467</span></i>
<i class='bi bi-reply me-2' ><span class="ms-1">56</span></i>
</div>
</div>
</div>
<div class="rightbar d-none d-sm-flex m-1">
<div class="rightbar-content d-flex flex-column m-2">
<a class="mb-1 p-1" href="#">Все</a>
<a class="mb-1 p-1" href="#">Непрочитанные</a>
<a class="mb-1 p-1" href="#">Архив</a>
</div>
</div>
</div>
<div class="bottombar d-flex d-sm-none position-fixed w-100 justify-content-evenly py-2 px-0">
<a href="lenta.html"><img src="source/home-icon.svg" alt=""></a>
<a href="messages.html"><img src="source/message-icon.svg" alt=""></a>
<a href="profile.html"><img src="source/profile-icon.svg" alt=""></a>
<a href="index.html"><img src="source/exit-icon.svg" alt=""></a>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</script>
<script src="js/postComponent.js"></script>
</body>
</html>

View File

@@ -1,136 +0,0 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Сообщения</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="css/message-style.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
</head>
<body>
<header>
<div class="container-fluid d-flex justify-content-evenly">
<div class="left-part d-flex">
<img src="source/logo.svg" alt="Logo" width="50">
</div>
<div class="right-part d-none d-sm-flex me-4 my-1">
<img src="source/photo.jpg" alt="" class="account-image">
</div>
</div>
</header>
<section>
<div class="page d-flex justify-content-center mt-3">
<div class="leftbar d-none h-100 m-1 d-sm-flex flex-column">
<div class="leftbar-content d-flex flex-column mt-2 mx-2 mb-1">
<a class="mb-1 p-1" href="profile.html">Профиль</a>
<a class="mb-1 p-1" href="lenta.html">Лента</a>
<a class="mb-1 p-1" href="messages.html">Сообщения</a>
</div>
<div class="leftbar-settings d-flex flex-column mt-2 mx-2 mb-0 pt-1">
<a class="p-1" href="index.html">Настройки</a>
</div>
<div class="footer position-relative m-2 pt-1">
<span class="position-relative">Ещё &#9660;</span>
<div class="footer-menu">
<a class="mb-1 p-1" href="#">Разработчикам</a>
<a class="mb-1 p-1" href="#">О нас</a>
<a class="mb-1 p-1" href="#">Правовая информация</a>
<a class="mb-1 p-1" href="#">Помощь</a>
</div>
</div>
</div>
<div class="content h-100 w-25 m-1 p-2">
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
<div class="chat d-flex align-items-center mb-2 pb-2">
<div class="avatar">
<img src="source/photo.jpg" alt="" class="avatar">
</div>
<div class="chat-content ms-2">
<h3 class="username m-0">username</h3>
<p class="message m-0">Сделал вторую лабу</p>
</div>
</div>
</div>
<div class="rightbar d-none d-sm-flex m-1">
<div class="rightbar-content d-flex flex-column m-2">
<a class="mb-1 p-1" href="#">Все</a>
<a class="mb-1 p-1" href="#">Непрочитанные</a>
<a class="mb-1 p-1" href="#">Архив</a>
</div>
</div>
</div>
<div class="bottombar d-flex d-sm-none position-fixed w-100 justify-content-evenly py-2 px-0">
<a href="lenta.html"><img src="source/home-icon.svg" alt=""></a>
<a href="messages.html"><img src="source/message-icon.svg" alt=""></a>
<a href="profile.html"><img src="source/profile-icon.svg" alt=""></a>
<a href="index.html"><img src="source/exit-icon.svg" alt=""></a>
</div>
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>

16
ИП4/node_modules/.bin/acorn generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
else
exec node "$basedir/../acorn/bin/acorn" "$@"
fi

17
ИП4/node_modules/.bin/acorn.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\acorn\bin\acorn" %*

28
ИП4/node_modules/.bin/acorn.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
} else {
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../acorn/bin/acorn" $args
} else {
& "node$exe" "$basedir/../acorn/bin/acorn" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/esbuild generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@"
else
exec node "$basedir/../esbuild/bin/esbuild" "$@"
fi

17
ИП4/node_modules/.bin/esbuild.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %*

28
ИП4/node_modules/.bin/esbuild.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
} else {
& "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../esbuild/bin/esbuild" $args
} else {
& "node$exe" "$basedir/../esbuild/bin/esbuild" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/eslint generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../eslint/bin/eslint.js" "$@"
else
exec node "$basedir/../eslint/bin/eslint.js" "$@"
fi

17
ИП4/node_modules/.bin/eslint.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\eslint\bin\eslint.js" %*

28
ИП4/node_modules/.bin/eslint.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../eslint/bin/eslint.js" $args
} else {
& "$basedir/node$exe" "$basedir/../eslint/bin/eslint.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../eslint/bin/eslint.js" $args
} else {
& "node$exe" "$basedir/../eslint/bin/eslint.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/he generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../he/bin/he" "$@"
else
exec node "$basedir/../he/bin/he" "$@"
fi

17
ИП4/node_modules/.bin/he.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\he\bin\he" %*

28
ИП4/node_modules/.bin/he.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../he/bin/he" $args
} else {
& "$basedir/node$exe" "$basedir/../he/bin/he" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../he/bin/he" $args
} else {
& "node$exe" "$basedir/../he/bin/he" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/http-server generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../http-server/bin/http-server" "$@"
else
exec node "$basedir/../http-server/bin/http-server" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\http-server\bin\http-server" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../http-server/bin/http-server" $args
} else {
& "$basedir/node$exe" "$basedir/../http-server/bin/http-server" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../http-server/bin/http-server" $args
} else {
& "node$exe" "$basedir/../http-server/bin/http-server" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/js-yaml generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@"
else
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
fi

17
ИП4/node_modules/.bin/js-yaml.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %*

28
ИП4/node_modules/.bin/js-yaml.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
} else {
& "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
} else {
& "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/json-server generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../json-server/lib/bin.js" "$@"
else
exec node "$basedir/../json-server/lib/bin.js" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\json-server\lib\bin.js" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../json-server/lib/bin.js" $args
} else {
& "$basedir/node$exe" "$basedir/../json-server/lib/bin.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../json-server/lib/bin.js" $args
} else {
& "node$exe" "$basedir/../json-server/lib/bin.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/json5 generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../json5/lib/cli.js" "$@"
else
exec node "$basedir/../json5/lib/cli.js" "$@"
fi

17
ИП4/node_modules/.bin/json5.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\json5\lib\cli.js" %*

28
ИП4/node_modules/.bin/json5.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../json5/lib/cli.js" $args
} else {
& "node$exe" "$basedir/../json5/lib/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/mime generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../mime/cli.js" "$@"
else
exec node "$basedir/../mime/cli.js" "$@"
fi

17
ИП4/node_modules/.bin/mime.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %*

28
ИП4/node_modules/.bin/mime.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
} else {
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../mime/cli.js" $args
} else {
& "node$exe" "$basedir/../mime/cli.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/nanoid generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@"
else
exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@"
fi

17
ИП4/node_modules/.bin/nanoid.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*

28
ИП4/node_modules/.bin/nanoid.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
} else {
& "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
} else {
& "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/node-which generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../which/bin/node-which" "$@"
else
exec node "$basedir/../which/bin/node-which" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\node-which" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../which/bin/node-which" $args
} else {
& "$basedir/node$exe" "$basedir/../which/bin/node-which" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../which/bin/node-which" $args
} else {
& "node$exe" "$basedir/../which/bin/node-which" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/npm-run-all generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../npm-run-all/bin/npm-run-all/index.js" "$@"
else
exec node "$basedir/../npm-run-all/bin/npm-run-all/index.js" "$@"
fi

View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\npm-run-all\bin\npm-run-all\index.js" %*

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../npm-run-all/bin/npm-run-all/index.js" $args
} else {
& "$basedir/node$exe" "$basedir/../npm-run-all/bin/npm-run-all/index.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../npm-run-all/bin/npm-run-all/index.js" $args
} else {
& "node$exe" "$basedir/../npm-run-all/bin/npm-run-all/index.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/opener generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../opener/bin/opener-bin.js" "$@"
else
exec node "$basedir/../opener/bin/opener-bin.js" "$@"
fi

17
ИП4/node_modules/.bin/opener.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\opener\bin\opener-bin.js" %*

28
ИП4/node_modules/.bin/opener.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../opener/bin/opener-bin.js" $args
} else {
& "$basedir/node$exe" "$basedir/../opener/bin/opener-bin.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../opener/bin/opener-bin.js" $args
} else {
& "node$exe" "$basedir/../opener/bin/opener-bin.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/pidtree generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../pidtree/bin/pidtree.js" "$@"
else
exec node "$basedir/../pidtree/bin/pidtree.js" "$@"
fi

17
ИП4/node_modules/.bin/pidtree.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\pidtree\bin\pidtree.js" %*

28
ИП4/node_modules/.bin/pidtree.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../pidtree/bin/pidtree.js" $args
} else {
& "$basedir/node$exe" "$basedir/../pidtree/bin/pidtree.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../pidtree/bin/pidtree.js" $args
} else {
& "node$exe" "$basedir/../pidtree/bin/pidtree.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/prettier generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../prettier/bin/prettier.cjs" "$@"
else
exec node "$basedir/../prettier/bin/prettier.cjs" "$@"
fi

17
ИП4/node_modules/.bin/prettier.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\prettier\bin\prettier.cjs" %*

28
ИП4/node_modules/.bin/prettier.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../prettier/bin/prettier.cjs" $args
} else {
& "$basedir/node$exe" "$basedir/../prettier/bin/prettier.cjs" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../prettier/bin/prettier.cjs" $args
} else {
& "node$exe" "$basedir/../prettier/bin/prettier.cjs" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/resolve generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../resolve/bin/resolve" "$@"
else
exec node "$basedir/../resolve/bin/resolve" "$@"
fi

17
ИП4/node_modules/.bin/resolve.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\resolve\bin\resolve" %*

28
ИП4/node_modules/.bin/resolve.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
} else {
& "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../resolve/bin/resolve" $args
} else {
& "node$exe" "$basedir/../resolve/bin/resolve" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/rollup generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../rollup/dist/bin/rollup" "$@"
else
exec node "$basedir/../rollup/dist/bin/rollup" "$@"
fi

17
ИП4/node_modules/.bin/rollup.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rollup\dist\bin\rollup" %*

28
ИП4/node_modules/.bin/rollup.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args
} else {
& "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../rollup/dist/bin/rollup" $args
} else {
& "node$exe" "$basedir/../rollup/dist/bin/rollup" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/run-p generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../npm-run-all/bin/run-p/index.js" "$@"
else
exec node "$basedir/../npm-run-all/bin/run-p/index.js" "$@"
fi

17
ИП4/node_modules/.bin/run-p.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\npm-run-all\bin\run-p\index.js" %*

28
ИП4/node_modules/.bin/run-p.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../npm-run-all/bin/run-p/index.js" $args
} else {
& "$basedir/node$exe" "$basedir/../npm-run-all/bin/run-p/index.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../npm-run-all/bin/run-p/index.js" $args
} else {
& "node$exe" "$basedir/../npm-run-all/bin/run-p/index.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

16
ИП4/node_modules/.bin/run-s generated vendored
View File

@@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../npm-run-all/bin/run-s/index.js" "$@"
else
exec node "$basedir/../npm-run-all/bin/run-s/index.js" "$@"
fi

17
ИП4/node_modules/.bin/run-s.cmd generated vendored
View File

@@ -1,17 +0,0 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\npm-run-all\bin\run-s\index.js" %*

28
ИП4/node_modules/.bin/run-s.ps1 generated vendored
View File

@@ -1,28 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../npm-run-all/bin/run-s/index.js" $args
} else {
& "$basedir/node$exe" "$basedir/../npm-run-all/bin/run-s/index.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../npm-run-all/bin/run-s/index.js" $args
} else {
& "node$exe" "$basedir/../npm-run-all/bin/run-s/index.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

Some files were not shown because too many files have changed in this diff Show More