From 62f5d0d3fa89ea8f03f73c029163deaeef8bfa0f Mon Sep 17 00:00:00 2001 From: Belyaev <228p@BTK.MAIN> Date: Thu, 15 Oct 2026 14:48:16 +0300 Subject: [PATCH] Backup --- API/Lab1 - PokeAPI.zip | Bin 0 -> 444 bytes API/Lab1 — PokeAPI/.gitignore | 9 + API/Lab1 — PokeAPI/PokedexApi/PokedexApi.sln | 16 ++ .../PokedexApi/PokedexApi/PokedexApi.csproj | 14 ++ .../PokedexApi/PokedexApi/PokedexApi.http | 6 + .../PokedexApi/PokedexApi/Program.cs | 46 +++++ .../PokedexApi/Properties/launchSettings.json | 23 +++ .../PokedexApi/appsettings.Development.json | 8 + .../PokedexApi/PokedexApi/appsettings.json | 9 + API/Lab1 — PokeAPI/opencollection.yml | 10 ++ API/Lab1 — PokeAPI/pokeapi.bruno.json | Bin 0 -> 3608 bytes CSharp/lab-07/lab-07.sln | 16 ++ CSharp/lab-07/lab-07/Program.cs | 166 ++++++++++++++++++ CSharp/lab-07/lab-07/lab-07.csproj | 11 ++ PostgresSQL/Script.sql | 108 ++++++++++++ Новый текстовый документ.txt | 52 ++++++ 16 files changed, 494 insertions(+) create mode 100644 API/Lab1 - PokeAPI.zip create mode 100644 API/Lab1 — PokeAPI/.gitignore create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi.sln create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.csproj create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.http create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Program.cs create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Properties/launchSettings.json create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.Development.json create mode 100644 API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.json create mode 100644 API/Lab1 — PokeAPI/opencollection.yml create mode 100644 API/Lab1 — PokeAPI/pokeapi.bruno.json create mode 100644 CSharp/lab-07/lab-07.sln create mode 100644 CSharp/lab-07/lab-07/Program.cs create mode 100644 CSharp/lab-07/lab-07/lab-07.csproj create mode 100644 PostgresSQL/Script.sql create mode 100644 Новый текстовый документ.txt diff --git a/API/Lab1 - PokeAPI.zip b/API/Lab1 - PokeAPI.zip new file mode 100644 index 0000000000000000000000000000000000000000..6e40192bdb9ea7ef976568ca8e83d99aa5c5ce56 GIT binary patch literal 444 zcmWIWW@Zs#-~d9WSpQfCB)|n^>!oLwWTxlk7o`S=arpV_dFg6CyX1XV`|_hlL16`+ zx*lh}Ja@RS@A2Qf@Z&+%pROxo6eXAL^gLRn z>B$h_&CZd#Tywc6(0Csp4#4REA)su2L26!deojtma!F=>o?c~cj_qkfuEPcbE*IO(dYuuR^mKqX RD;r1+6A)GaX+1^|4*=9Bg+~AY literal 0 HcmV?d00001 diff --git a/API/Lab1 — PokeAPI/.gitignore b/API/Lab1 — PokeAPI/.gitignore new file mode 100644 index 0000000..e19311f --- /dev/null +++ b/API/Lab1 — PokeAPI/.gitignore @@ -0,0 +1,9 @@ +# Secrets +.env* + +# Dependencies +node_modules + +# OS files +.DS_Store +Thumbs.db \ No newline at end of file diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi.sln b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi.sln new file mode 100644 index 0000000..5f83476 --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokedexApi", "PokedexApi\PokedexApi.csproj", "{0AC1C38E-7B58-4271-9193-B74B674ECF6C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0AC1C38E-7B58-4271-9193-B74B674ECF6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AC1C38E-7B58-4271-9193-B74B674ECF6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AC1C38E-7B58-4271-9193-B74B674ECF6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AC1C38E-7B58-4271-9193-B74B674ECF6C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.csproj b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.csproj new file mode 100644 index 0000000..17efa5e --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.csproj @@ -0,0 +1,14 @@ + + + + net10.0 + enable + enable + + + + + + + + diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.http b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.http new file mode 100644 index 0000000..f4fd3c7 --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/PokedexApi.http @@ -0,0 +1,6 @@ +@PokedexApi_HostAddress = http://localhost:5116 + +GET {{PokedexApi_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Program.cs b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Program.cs new file mode 100644 index 0000000..dbec262 --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Program.cs @@ -0,0 +1,46 @@ +using Scalar.AspNetCore; + +// 1. Модели теперь можно объявить здесь, так как они находятся внутри пространства имен +public record Pokemon(int Id, string Name, string Type, int Level); +public record PokemonInput(string Name, string Type, int Level); + +public class Program +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + builder.Services.AddOpenApi(); + + var app = builder.Build(); + + var pokemons = new List + { + new(1, "Pikachu", "Electric", 12), + new(2, "Charmander", "Fire", 8), + new(3, "Squirtle", "Water", 10) + }; + + // GET /pokemons + app.MapGet("/pokemons/{id}", (int id) => + { + var pokemon = pokemons.FirstOrDefault(p => p.Id == id); + + return pokemon is null + ? Results.NotFound() + : Results.Ok(pokemon); + }); + + if (app.Environment.IsDevelopment()) + { + app.MapOpenApi(); + app.MapScalarApiReference(options => + { + options.WithTitle("Pokedex API") + .WithOpenApiRoutePattern("/openapi/v1.json"); + }); + } + + app.Run(); + } +} \ No newline at end of file diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Properties/launchSettings.json b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Properties/launchSettings.json new file mode 100644 index 0000000..555b35a --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5116", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7103;http://localhost:5116", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.Development.json b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.json b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/API/Lab1 — PokeAPI/PokedexApi/PokedexApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/API/Lab1 — PokeAPI/opencollection.yml b/API/Lab1 — PokeAPI/opencollection.yml new file mode 100644 index 0000000..58c2d98 --- /dev/null +++ b/API/Lab1 — PokeAPI/opencollection.yml @@ -0,0 +1,10 @@ +opencollection: 1.0.0 + +info: + name: Lab1 — PokeAPI +bundled: false +extensions: + bruno: + ignore: + - node_modules + - .git diff --git a/API/Lab1 — PokeAPI/pokeapi.bruno.json b/API/Lab1 — PokeAPI/pokeapi.bruno.json new file mode 100644 index 0000000000000000000000000000000000000000..97680e0ef9dc5bfcb03512dcac153e5120f75b24 GIT binary patch literal 3608 zcmb`J2{=^y8^_PsmqaR4Da|N`VH8FDOO|Y7tl91@6q9|d4N*FXOL9%SR$!hWQn-`=Ww5EblvBFpXdMoojLQIIlt%kd*AuI@9+D*W&}>IEdU>M z^=g{f0c=A6dRB08BfGhHdHXq8So4_}D;VNrhuaBlavcK$$E|(vID<9@-8?#(|Op;2i#@QUYmS+ zo^g<0mAt70Oo|qGp@2;2y^YbI4Q_XZe8 zJR|bw9S`*GOgH}A%&hy28<3??$V&%{~(+BO$cLC=Hn`n(D)*xU&p6ks@%RQQ$(EK(wF z$8nv`kKG|PrB|mu;`qdxVbsggDCzIJeDjWM3f(ioo+`3c)a`;ek)Bz##rv(^2M>~l zwm4ZC@A}QTM5bp!z~ZZ~_Nxa^Z~xdmu8Li>otrAk?+IF@8yvn6gVo)Kw$P0j5QL*s z=349|jR1gZ=>8+4py<^66dh$aI$03;8dex93ao;7UqL~z>!1MCLm{b!LIlBQC7{51 z6e|>(VSp8IAdFuq8geU&G)-JGnaF$;J)TY$%c&SaG>#RC_ZWAb=_;_E+~UcU3*;7e z(4yEo`0a@a{pCe-*6zV$NF1Ueo|L`s;j39c8wr2eo0D92Q)NA$D|<$x>XUixo*y8` z-Dl}Crs9EWT6YdIjqmA2hkKHDT%7cik5-CB@nX1I-M-_>l$~QgevxK$=nP7GE6f@t zZ4mA;m=r>ICBJWsqEV4Kt&&GGhDQBd9a{=sQ4gM_JifZq*k($X8Z?+ zE7@kL>6K|(mqNvlvMI$mam>-kJpnjO+zX+!PvS5|Cx?BVgAgOhH57|}qKI3UA_Kzu z5UhY0)`N9mDGEYYk8(S+OfNy*gsHhf??P511|`$3(%~6G*YgQBZ$gVbQ*8|la3ILI zR&m@tMIp5b#1fXHotvfJmYnD#*IpO z(;|?_i5l%S*m(HWCXoZZszr$8>JL2aCZUfzsDhgEg-gn1|Gr~h^6cuxPJM> z-*$J}iuq@c-<4O_Fw@~n-Gz*@C0|aYRHD~n*nm6N$76iCW-2PDTW}Bo+N|DV7WCTi2VB6 zOck#K2GsL4&Sbrt8FVVg;RiIvnPwB_|McO-NxHSuF zm8>%ON*OiTRDZ71Ik39&)a~ld-|>3Hg<UwMCq^hNPzZfLrNPZ*g`t8uHdcen~lXO2O8zl8QDArz|(#HOt@rs!D@JL<*? zkQ9ANN9HAC)AOk`gt-dmuTzqoD6td2)&i-6@-cg9C*xk*oD2Tt?9wqYkJd*7zhkOy z-Bsw+<}%`DwY2o)nC9~DZE@4ig3%?h54K$|*vUmtG%yf$vd`}HAmlB#k)r|t_P8;>xu@{qKc`HK1JFR-Z*}o*B%#w)48(PRjCI; zA+aW%f38L1E3oPzI^|GeE>|K*5Lh9s&}B%81e3>_8zN`V3Q(2HQ4P)kUruum_y(f~ zuWR9@TUD_`XsusMgZH4Udg$7gnzH=@H1TYF3(;w@Yv~Qc^EoYvgKo)f*oX1@o^&d3 zXJkL(d)!T*&5<0zJX;N)Mq?3u6PAq+Ma=c8G@lnGm)4YBMgi_AFN^I1YB2AUtxAr! zl1f6Ocz~XzzR5k$I(M&aNjXQKqd7uU=>|~}-LLQUUEMh| z+~d;5*|V(i8<-=5ks8z?4S6s3Li60fCgSga#DutM(9W^OukDx5ePwxm)@gj3b507d zG*08Pa30yf-+%4tjpn1n%}TU@ZNFh`hzmDm!LGdyR=^aA_U?BH_rd*AOCH$HH;iGu z&t%Hbl(TV~|FG?~dqZN_coS{YA&Do4VESQ;X(P&irYeF1$GO_xviF^Ed%H4FKxGL0 zwA$>N5!S9_@BQGebY;Nn;DvwfQU6^3M~BGXoxmO9%7E9yp8o&(MRvPzzOmPHxCE`* z?ci8PO#ewI#BKs^4A|=*+!(By*v_?{iFIq&gDn4d6=mNLjx~GU!`iaC;VJ&*4gXGQ V%n01je+2-3=#t_DfZpYk@gH76JMI7g literal 0 HcmV?d00001 diff --git a/CSharp/lab-07/lab-07.sln b/CSharp/lab-07/lab-07.sln new file mode 100644 index 0000000..aa7c3a4 --- /dev/null +++ b/CSharp/lab-07/lab-07.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-07", "lab-07\lab-07.csproj", "{F608480B-8D2E-4069-A2AB-5420A1102070}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F608480B-8D2E-4069-A2AB-5420A1102070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F608480B-8D2E-4069-A2AB-5420A1102070}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F608480B-8D2E-4069-A2AB-5420A1102070}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F608480B-8D2E-4069-A2AB-5420A1102070}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/CSharp/lab-07/lab-07/Program.cs b/CSharp/lab-07/lab-07/Program.cs new file mode 100644 index 0000000..6b0fcb7 --- /dev/null +++ b/CSharp/lab-07/lab-07/Program.cs @@ -0,0 +1,166 @@ +class Program +{ + static void Main(string[] args) + { + // Pokemon pika = new Pikachu("Пикачу", 5, 100); + // Pokemon squirtle = new Squirtle("Сквиртл", 7, 90); + // Pokemon charmander = new Charmander("Charmander", 9, 80); + Console.WriteLine("=== ЗАДАНИЕ 1 ==="); + Console.WriteLine("=== ПОКЕДЕКС: АТАКИ ===\n"); + List pokemons = new List(4) + { + new Pikachu("Пикачу", 5, 100), + new Squirtle("Сквиртл", 7, 90), + new Charmander("Чармандер", 9, 80), + new Bulbasaur("Бульбазавр", 6, 95) + }; + foreach (Pokemon pokemon in pokemons) + { + pokemon.ShowInfo(); + pokemon.Attack(); + Console.WriteLine(); + } + } + // class Pokemon + // { + // protected string name; + // + // protected int hp; + // + // protected int level; + // + // public int HP + // { + // get { return hp; } + // set + // { + // if (value < 0) hp = 0; + // else if (value > 100) hp = 100; + // else hp = value; + // } + // } + // + // public int Level + // { + // get { return level; } + // set + // { + // if (value < 1) level = 1; + // else if (value > 100) level = 100; + // else level = value; + // } + // } + // + // public string Name; + // + // public Pokemon(string name, int level, int hp) + // { + // this.Name = name == "" ? "Безымянный" : name; + // this.Level = level; + // this.HP = hp; + // } + // + // public abstract void Attack() + // { + // Console.WriteLine("Покемон аттакует"); + // } + // + // public void ShowInfo() + // { + // Console.WriteLine($"Name: {Name}, Уровень: {Level}, HP: {HP}"); + // } + // } + abstract class Pokemon + { + protected string name; + + protected int hp; + + protected int level; + + public int HP + { + get { return hp; } + set + { + if (value < 0) hp = 0; + else if (value > 100) hp = 100; + else hp = value; + } + } + + public int Level + { + get { return level; } + set + { + if (value < 1) level = 1; + else if (value > 100) level = 100; + else level = value; + } + } + + public string Name; + + public Pokemon(string name, int level, int hp) + { + this.Name = name == "" ? "Безымянный" : name; + this.Level = level; + this.HP = hp; + } + + virtual public void Attack() + { + Console.WriteLine("Покемон аттакует"); + } + + public void ShowInfo() + { + Console.WriteLine($"Name: {Name}, Уровень: {Level}, HP: {HP}"); + } + } + class Pikachu : Pokemon + { + public Pikachu(string name, int level, int hp) : base(name, level, hp) + { + + } + public override void Attack() + { + Console.WriteLine($"{Name} бьёт током! Пика-пика!"); + } + } + class Charmander : Pokemon + { + public Charmander(string name, int level, int hp) : base(name, level, hp) + { + + } + public override void Attack() + { + Console.WriteLine($"{Name} Чар-чар! Огненный хвост!"); + } + } + class Squirtle : Pokemon + { + public Squirtle(string name, int level, int hp) : base(name, level, hp) + { + + } + public override void Attack() + { + Console.WriteLine($"{Name} Сквирт-сквирт! Водяной пистолет!"); + } + } + class Bulbasaur : Pokemon + { + public Bulbasaur(string name, int level, int hp) : base(name, level, hp) + { + + } + public override void Attack() + { + Console.WriteLine($"{Name} Бульба! Листовой удар!"); + } + } +} \ No newline at end of file diff --git a/CSharp/lab-07/lab-07/lab-07.csproj b/CSharp/lab-07/lab-07/lab-07.csproj new file mode 100644 index 0000000..74f610c --- /dev/null +++ b/CSharp/lab-07/lab-07/lab-07.csproj @@ -0,0 +1,11 @@ + + + + Exe + net10.0 + lab_07 + enable + enable + + + diff --git a/PostgresSQL/Script.sql b/PostgresSQL/Script.sql new file mode 100644 index 0000000..c1ecf9a --- /dev/null +++ b/PostgresSQL/Script.sql @@ -0,0 +1,108 @@ +CREATE TABLE region ( + region_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + region_name VARCHAR(50) NOT NULL UNIQUE, + region_generation SMALLINT NOT NULL CHECK (region_generation >= 1), + region_description TEXT +); + +CREATE TABLE type ( + type_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + type_name VARCHAR(30) NOT NULL UNIQUE, + type_color_hex CHAR(7) NOT NULL CHECK (type_color_hex ~ '^#[0-9A-Fa-f]{6}$') + +); + +CREATE TABLE ability ( + ability_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ability_name VARCHAR(60) NOT NULL UNIQUE, + ability_description TEXT, + ability_is_hidden BOOLEAN NOT NULL DEFAULT FALSE +); + +CREATE TABLE move ( + move_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + move_name VARCHAR(80) NOT NULL UNIQUE, + type_id INTEGER NOT NULL REFERENCES type(type_id) ON DELETE RESTRICT, + move_category VARCHAR(10) NOT NULL CHECK (move_category IN ('physical', 'special', 'status')), + move_power SMALLINT CHECK (move_power BETWEEN 0 AND 250), + move_accuracy SMALLINT CHECK (move_accuracy BETWEEN 0 AND 100), + move_pp SMALLINT NOT NULL CHECK (move_pp BETWEEN 1 AND 64), + move_description TEXT +); + +CREATE TABLE pokemon ( + pokemon_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + pokemon_national_dex_number INTEGER NOT NULL UNIQUE CHECK (pokemon_national_dex_number > 0), + pokemon_name VARCHAR(50) NOT NULL UNIQUE, + pokemon_species VARCHAR(50), + pokemon_height NUMERIC(4,2) CHECK (pokemon_height >= 0), + pokemon_weight NUMERIC(5,2) CHECK (pokemon_weight >= 0), + pokemon_base_hp SMALLINT NOT NULL CHECK (pokemon_base_hp BETWEEN 1 AND 255), + pokemon_base_attack SMALLINT NOT NULL CHECK (pokemon_base_attack BETWEEN 1 AND 255), + pokemon_base_defense SMALLINT NOT NULL CHECK (pokemon_base_defense BETWEEN 1 AND 255), + pokemon_base_sp_attack SMALLINT NOT NULL CHECK (pokemon_base_sp_attack BETWEEN 1 AND 255), + pokemon_base_sp_defense SMALLINT NOT NULL CHECK (pokemon_base_sp_defense BETWEEN 1 AND 255), + pokemon_base_speed SMALLINT NOT NULL CHECK (pokemon_base_speed BETWEEN 1 AND 255), + pokemon_is_legendary BOOLEAN NOT NULL DEFAULT FALSE, + pokemon_is_mythical BOOLEAN NOT NULL DEFAULT FALSE, + region_id INTEGER REFERENCES region(region_id) ON DELETE SET NULL, + pokemon_description TEXT, + pokemon_created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE pokemon_type ( + pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE CASCADE, + type_id INTEGER NOT NULL REFERENCES type(type_id) ON DELETE RESTRICT, + pokemon_type_slot SMALLINT NOT NULL CHECK (pokemon_type_slot IN (1, 2)), + PRIMARY KEY (pokemon_id, type_id), + CONSTRAINT uq_pokemon_slot UNIQUE (pokemon_id, pokemon_type_slot) +); + +CREATE TABLE pokemon_ability ( + pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE CASCADE, + ability_id INTEGER NOT NULL REFERENCES ability(ability_id) ON DELETE RESTRICT, + pokemon_ability_is_hidden BOOLEAN NOT NULL DEFAULT FALSE, + pokemon_ability_slot SMALLINT NOT NULL CHECK (pokemon_ability_slot >= 1), + PRIMARY KEY (pokemon_id, ability_id) +); + +CREATE TABLE pokemon_move ( + pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE CASCADE, + move_id INTEGER NOT NULL REFERENCES move(move_id) ON DELETE CASCADE, + pokemon_move_learn_method VARCHAR(20) NOT NULL CHECK (pokemon_move_learn_method IN ('level-up', 'tm', 'egg', 'tutor')), + pokemon_move_level_learned SMALLINT CHECK (pokemon_move_level_learned BETWEEN 1 AND 100), + PRIMARY KEY (pokemon_id, move_id, pokemon_move_learn_method) +); + +CREATE TABLE evolution ( + evolution_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + from_pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE CASCADE, + to_pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE CASCADE, + evolution_trigger VARCHAR(30) NOT NULL CHECK (evolution_trigger IN ('level-up', 'trade', 'item', 'friendship')), + evolution_min_level SMALLINT CHECK (evolution_min_level BETWEEN 1 AND 100), + evolution_item_name VARCHAR(50), + CONSTRAINT chk_different_pokemon CHECK (from_pokemon_id <> to_pokemon_id), + CONSTRAINT uq_evolution_pair UNIQUE (from_pokemon_id, to_pokemon_id) +); + +CREATE TABLE trainer ( + trainer_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + trainer_name VARCHAR(50) NOT NULL, + trainer_email VARCHAR(120) UNIQUE, + home_region_id INTEGER REFERENCES region(region_id) ON DELETE SET NULL, + trainer_registered_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE caught_pokemon ( + caught_pokemon_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + trainer_id INTEGER NOT NULL REFERENCES trainer(trainer_id) ON DELETE CASCADE, + pokemon_id INTEGER NOT NULL REFERENCES pokemon(pokemon_id) ON DELETE RESTRICT, + caught_pokemon_nickname VARCHAR(50), + caught_pokemon_level SMALLINT NOT NULL CHECK (caught_pokemon_level BETWEEN 1 AND 100), + caught_pokemon_gender CHAR(1) CHECK (caught_pokemon_gender IN ('M', 'F', 'N')), + caught_pokemon_is_shiny BOOLEAN NOT NULL DEFAULT FALSE, + caught_pokemon_catch_date DATE NOT NULL DEFAULT CURRENT_DATE, + catch_region_id INTEGER REFERENCES region(region_id) ON DELETE SET NULL +); + + diff --git a/Новый текстовый документ.txt b/Новый текстовый документ.txt new file mode 100644 index 0000000..300d034 --- /dev/null +++ b/Новый текстовый документ.txt @@ -0,0 +1,52 @@ +PS Z:\> Get-Service -Name postgresql* +PS Z:\> Start-Service -Name postgresql-x64-14 26.1.5 +Start-Service : Не удается найти позиционный параметр, принимающий аргумент "26.1.5". +строка:1 знак:1 ++ Start-Service -Name postgresql-x64-14 26.1.5 ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + CategoryInfo : InvalidArgument: (:) [Start-Service], ParameterBindingException + + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartServiceCommand + +PS Z:\> docker ps +failed to connect to the docker API at npipe:////./pipe/dockerDesktopLinuxEngine; check if the path is correct and if the daemon is running: open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified. +PS Z:\> docker ps -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +a9d7eff4a438 postgres "docker-entrypoint.s…" 6 weeks ago Exited (1) 6 weeks ago test +PS Z:\> docker start postgres +Error response from daemon: No such container: postgres +failed to start containers: postgres +PS Z:\> docker start test +test +PS Z:\> docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +PS Z:\> docker logs test +Error: Database is uninitialized and superuser password is not specified. + You must specify POSTGRES_PASSWORD to a non-empty value for the + superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". + + You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. + + See PostgreSQL documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html +Error: Database is uninitialized and superuser password is not specified. + You must specify POSTGRES_PASSWORD to a non-empty value for the + superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". + + You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. + + See PostgreSQL documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html +Error: Database is uninitialized and superuser password is not specified. + You must specify POSTGRES_PASSWORD to a non-empty value for the + superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". + +PS Z:\> docker rm test +test +PS Z:\> docker run --name test -p 5432:5432 -e POSTGRES_PASSWORD=pokedex_pass -d postgres +37830188239ba74b3fb1bdaaee83681304754f815f2ffeae507900b85f82b2d8 +PS Z:\> docker ps +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +37830188239b postgres "docker-entrypoint.s…" 18 seconds ago Up 17 seconds 0.0.0.0:5432->5432/tcp, [::]:5432->5432/tcp test +PS Z:\> \ No newline at end of file