This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
edu-dis-labs/software/index.html

282 lines
58 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Реалізація інформаційного та програмного забезпечення | Xpertise</title>
<meta name="generator" content="VuePress 1.8.2">
<link rel="icon" href="/OBD-lab6/favicon.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="description" content="Лабораторні роботи з дисципліни "Організація баз даних"">
<link rel="preload" href="/OBD-lab6/assets/css/0.styles.4f6bfcd3.css" as="style"><link rel="preload" href="/OBD-lab6/assets/js/app.05910fbb.js" as="script"><link rel="preload" href="/OBD-lab6/assets/js/2.d3067b7e.js" as="script"><link rel="preload" href="/OBD-lab6/assets/js/24.34b35d62.js" as="script"><link rel="prefetch" href="/OBD-lab6/assets/js/10.35d89b73.js"><link rel="prefetch" href="/OBD-lab6/assets/js/11.3c19866e.js"><link rel="prefetch" href="/OBD-lab6/assets/js/12.9a82e5ab.js"><link rel="prefetch" href="/OBD-lab6/assets/js/13.49bd7085.js"><link rel="prefetch" href="/OBD-lab6/assets/js/14.1b3343f2.js"><link rel="prefetch" href="/OBD-lab6/assets/js/15.0dcddaf1.js"><link rel="prefetch" href="/OBD-lab6/assets/js/16.2ed446b3.js"><link rel="prefetch" href="/OBD-lab6/assets/js/17.fda359b2.js"><link rel="prefetch" href="/OBD-lab6/assets/js/18.0fc04f5f.js"><link rel="prefetch" href="/OBD-lab6/assets/js/19.040c6f24.js"><link rel="prefetch" href="/OBD-lab6/assets/js/20.90003659.js"><link rel="prefetch" href="/OBD-lab6/assets/js/21.e05a7bdf.js"><link rel="prefetch" href="/OBD-lab6/assets/js/22.c693ab35.js"><link rel="prefetch" href="/OBD-lab6/assets/js/23.cf94de76.js"><link rel="prefetch" href="/OBD-lab6/assets/js/25.039587ec.js"><link rel="prefetch" href="/OBD-lab6/assets/js/26.c4b8726e.js"><link rel="prefetch" href="/OBD-lab6/assets/js/27.9a1f882a.js"><link rel="prefetch" href="/OBD-lab6/assets/js/3.1e247dfc.js"><link rel="prefetch" href="/OBD-lab6/assets/js/4.86a4386e.js"><link rel="prefetch" href="/OBD-lab6/assets/js/5.53518b16.js"><link rel="prefetch" href="/OBD-lab6/assets/js/6.234fb2a8.js"><link rel="prefetch" href="/OBD-lab6/assets/js/7.7990c5f1.js"><link rel="prefetch" href="/OBD-lab6/assets/js/8.7de00471.js"><link rel="prefetch" href="/OBD-lab6/assets/js/9.0fa86d82.js">
<link rel="stylesheet" href="/OBD-lab6/assets/css/0.styles.4f6bfcd3.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/OBD-lab6/" class="home-link router-link-active"><!----> <span class="site-name">Xpertise</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/OBD-lab6/" class="nav-link">
Початок
</a></div> <a href="http://139.162.162.130:3000/hasslesstech/edu-dis-labs" target="_blank" rel="noopener noreferrer" class="repo-link">
Gitea
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/OBD-lab6/" class="nav-link">
Початок
</a></div> <a href="http://139.162.162.130:3000/hasslesstech/edu-dis-labs" target="_blank" rel="noopener noreferrer" class="repo-link">
Gitea
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><a href="/OBD-lab6/intro/" class="sidebar-link">Вступ</a></li><li><section class="sidebar-group collapsable depth-0"><a href="/OBD-lab6/requirements/" class="sidebar-heading clickable"><span>Розроблення вимог до системи</span> <span class="arrow right"></span></a> <!----></section></li><li><a href="/OBD-lab6/use-cases/" class="sidebar-link">Розроблення вимог до функціональности системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/OBD-lab6/use-cases/#загальна-схема" class="sidebar-link">Загальна схема</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/use-cases/#схеми-використання-для-окремих-діячів" class="sidebar-link">Схеми використання для окремих діячів</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/use-cases/#сценаріі-використання" class="sidebar-link">Сценарії використання</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/OBD-lab6/use-cases/#для-гостя" class="sidebar-link">Для гостя</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/use-cases/#для-зареєстрованого-користувача" class="sidebar-link">Для зареєстрованого користувача</a></li></ul></li></ul></li><li><a href="/OBD-lab6/design/" class="sidebar-link">Проєктування архітектури системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/OBD-lab6/design/#be-модель" class="sidebar-link">BE модель</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/design/#er-модель" class="sidebar-link">ER-модель</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/design/#реляціина-схема" class="sidebar-link">Реляційна схема</a></li></ul></li><li><a href="/OBD-lab6/software/" aria-current="page" class="active sidebar-link">Реалізація інформаційного та програмного забезпечення</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/OBD-lab6/software/#sql-скрипт-для-створення-та-початкового-наповнення-бази-даних" class="sidebar-link">SQL-скрипт для створення та початкового наповнення бази даних</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/software/#програмнии-код-restful-сервісу" class="sidebar-link">Програмний код RESTful-сервісу</a></li></ul></li><li><a href="/OBD-lab6/test/" class="sidebar-link">Тестування працездатності системи</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/OBD-lab6/test/#обробка-запитів-з-методом-get" class="sidebar-link">Обробка запитів з методом GET</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/test/#обробка-запитів-з-методом-post" class="sidebar-link">Обробка запитів з методом POST</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/test/#обробка-запитів-з-методом-put" class="sidebar-link">Обробка запитів з методом PUT</a></li><li class="sidebar-sub-header"><a href="/OBD-lab6/test/#обробка-запиті<D182>
<span class="token keyword">SET</span> <span class="token variable">@OLD_UNIQUE_CHECKS</span><span class="token operator">=</span>@<span class="token variable">@UNIQUE_CHECKS</span><span class="token punctuation">,</span> UNIQUE_CHECKS<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@OLD_FOREIGN_KEY_CHECKS</span><span class="token operator">=</span>@<span class="token variable">@FOREIGN_KEY_CHECKS</span><span class="token punctuation">,</span> FOREIGN_KEY_CHECKS<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> <span class="token variable">@OLD_SQL_MODE</span><span class="token operator">=</span>@<span class="token variable">@SQL_MODE</span><span class="token punctuation">,</span> SQL_MODE<span class="token operator">=</span><span class="token string">'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'</span><span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Schema mydb</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Schema mydb</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">SCHEMA</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span> <span class="token keyword">DEFAULT</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8 <span class="token punctuation">;</span>
<span class="token keyword">USE</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span> <span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Table `mydb`.`Account`</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Account<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>username<span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>password<span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">`</span>id_UNIQUE<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> VISIBLE<span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">`</span>username_UNIQUE<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>username<span class="token punctuation">`</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> VISIBLE<span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">InnoDB</span><span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Table `mydb`.`Survey`</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Survey<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>isPaused<span class="token punctuation">`</span> <span class="token keyword">TINYINT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>isNamed<span class="token punctuation">`</span> <span class="token keyword">TINYINT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>name<span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>duration<span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">`</span>id_UNIQUE<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> VISIBLE<span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>fk_Survey_Account1<span class="token punctuation">`</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Account<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">InnoDB</span><span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Table `mydb`.`Question`</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Question<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span><span class="token keyword">Text</span><span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">`</span>id_UNIQUE<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> VISIBLE<span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>fk_Question_Survey1<span class="token punctuation">`</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Survey<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">InnoDB</span><span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Table `mydb`.`Response`</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Response<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span><span class="token keyword">Value</span><span class="token punctuation">`</span> <span class="token keyword">VARCHAR</span><span class="token punctuation">(</span><span class="token number">16384</span><span class="token punctuation">)</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">UNIQUE</span> <span class="token keyword">INDEX</span> <span class="token punctuation">`</span>id_UNIQUE<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">ASC</span><span class="token punctuation">)</span> VISIBLE<span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>fk_Response_Question<span class="token punctuation">`</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Question<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span><span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>fk_Response_Account1<span class="token punctuation">`</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Account<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">InnoDB</span><span class="token punctuation">;</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token comment">-- Table `mydb`.`Link`</span>
<span class="token comment">-- -----------------------------------------------------</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> <span class="token keyword">IF</span> <span class="token operator">NOT</span> <span class="token keyword">EXISTS</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Link<span class="token punctuation">`</span> <span class="token punctuation">(</span>
<span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token keyword">UNSIGNED</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span> <span class="token keyword">AUTO_INCREMENT</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>uses<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>responces<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>usageLimit<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>responceLimit<span class="token punctuation">`</span> <span class="token keyword">INT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token punctuation">`</span>path<span class="token punctuation">`</span> <span class="token keyword">CHAR</span><span class="token punctuation">(</span><span class="token number">32</span><span class="token punctuation">)</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span>
<span class="token keyword">PRIMARY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token keyword">CONSTRAINT</span> <span class="token punctuation">`</span>fk_Link_Survey1<span class="token punctuation">`</span>
<span class="token keyword">FOREIGN</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">REFERENCES</span> <span class="token punctuation">`</span>mydb<span class="token punctuation">`</span><span class="token punctuation">.</span><span class="token punctuation">`</span>Survey<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token keyword">ON</span> <span class="token keyword">DELETE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span>
<span class="token keyword">ON</span> <span class="token keyword">UPDATE</span> <span class="token keyword">NO</span> <span class="token keyword">ACTION</span><span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">InnoDB</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> SQL_MODE<span class="token operator">=</span><span class="token variable">@OLD_SQL_MODE</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> FOREIGN_KEY_CHECKS<span class="token operator">=</span><span class="token variable">@OLD_FOREIGN_KEY_CHECKS</span><span class="token punctuation">;</span>
<span class="token keyword">SET</span> UNIQUE_CHECKS<span class="token operator">=</span><span class="token variable">@OLD_UNIQUE_CHECKS</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="програмнии-код-restful-сервісу"><a href="#програмнии-код-restful-сервісу" class="header-anchor">#</a> Програмний код RESTful-сервісу</h2> <div class="language-python extra-class"><pre class="language-python"><code><span class="token keyword">from</span> flask <span class="token keyword">import</span> Flask<span class="token punctuation">,</span> request<span class="token punctuation">,</span> jsonify
<span class="token keyword">import</span> mysql<span class="token punctuation">.</span>connector
<span class="token keyword">from</span> mysql<span class="token punctuation">.</span>connector <span class="token keyword">import</span> Error
<span class="token keyword">from</span> db_config <span class="token keyword">import</span> db_config
app <span class="token operator">=</span> Flask<span class="token punctuation">(</span>name<span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">get_db_connection</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
conn <span class="token operator">=</span> mysql<span class="token punctuation">.</span>connector<span class="token punctuation">.</span>connect<span class="token punctuation">(</span><span class="token operator">**</span>db_config<span class="token punctuation">)</span>
<span class="token keyword">return</span> conn
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error in connection to database: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>route</span><span class="token punctuation">(</span><span class="token string">'/links'</span><span class="token punctuation">,</span> methods<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'GET'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">get_links</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
conn <span class="token operator">=</span> get_db_connection<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>conn<span class="token punctuation">,</span> <span class="token builtin">tuple</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> conn
cursor <span class="token operator">=</span> conn<span class="token punctuation">.</span>cursor<span class="token punctuation">(</span>dictionary<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token string">'SELECT * FROM link'</span><span class="token punctuation">)</span>
links <span class="token operator">=</span> cursor<span class="token punctuation">.</span>fetchall<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span>links<span class="token punctuation">)</span>
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error getting data: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>route</span><span class="token punctuation">(</span><span class="token string">'/link/&lt;int:id&gt;'</span><span class="token punctuation">,</span> methods<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'GET'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">get_link</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
conn <span class="token operator">=</span> get_db_connection<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>conn<span class="token punctuation">,</span> <span class="token builtin">tuple</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> conn
cursor <span class="token operator">=</span> conn<span class="token punctuation">.</span>cursor<span class="token punctuation">(</span>dictionary<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token string">'SELECT * FROM link WHERE id = %s'</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
link <span class="token operator">=</span> cursor<span class="token punctuation">.</span>fetchone<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> link <span class="token keyword">is</span> <span class="token boolean">None</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;Link is not found&quot;</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">404</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span>link<span class="token punctuation">)</span>
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error getting data: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>route</span><span class="token punctuation">(</span><span class="token string">'/link'</span><span class="token punctuation">,</span> methods<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'POST'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">create_link</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
new_link <span class="token operator">=</span> request<span class="token punctuation">.</span>json
conn <span class="token operator">=</span> get_db_connection<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>conn<span class="token punctuation">,</span> <span class="token builtin">tuple</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> conn
cursor <span class="token operator">=</span> conn<span class="token punctuation">.</span>cursor<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token triple-quoted-string string">'''
INSERT INTO link (uses, responses, usageLimit, responseLimit, path, Survey_id)
VALUES (%s, %s, %s, %s, %s, %s)
'''</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'uses'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'responses'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'usageLimit'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'responseLimit'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'path'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
new_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'Survey_id'</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>commit<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;success&quot;</span><span class="token punctuation">:</span> <span class="token string">&quot;Link created successfully&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;data&quot;</span><span class="token punctuation">:</span> new_link<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">201</span>
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error creating link: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>route</span><span class="token punctuation">(</span><span class="token string">'/link/&lt;int:id&gt;'</span><span class="token punctuation">,</span> methods<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'PUT'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">update_link</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
update_link <span class="token operator">=</span> request<span class="token punctuation">.</span>json
conn <span class="token operator">=</span> get_db_connection<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>conn<span class="token punctuation">,</span> <span class="token builtin">tuple</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> conn
cursor <span class="token operator">=</span> conn<span class="token punctuation">.</span>cursor<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token triple-quoted-string string">'''
UPDATE link SET
uses = %s,
responses = %s,
usageLimit = %s,
responseLimit = %s,
path = %s,
Survey_id = %s
WHERE id = %s
'''</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'uses'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'responses'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'usageLimit'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'responseLimit'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'path'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
update_link<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">'Survey_id'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token builtin">id</span>
<span class="token punctuation">)</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>commit<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> cursor<span class="token punctuation">.</span>rowcount <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Update error: link is not found&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">404</span>
<span class="token keyword">else</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;success&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Link from ID </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">id</span><span class="token punctuation">}</span></span><span class="token string"> updated successfully&quot;</span></span><span class="token punctuation">,</span> <span class="token string">&quot;data&quot;</span><span class="token punctuation">:</span> update_link<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">202</span>
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error updating link: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>route</span><span class="token punctuation">(</span><span class="token string">'/link/&lt;int:id&gt;'</span><span class="token punctuation">,</span> methods<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'DELETE'</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">def</span> <span class="token function">delete_link</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">try</span><span class="token punctuation">:</span>
conn <span class="token operator">=</span> get_db_connection<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>conn<span class="token punctuation">,</span> <span class="token builtin">tuple</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> conn
cursor <span class="token operator">=</span> conn<span class="token punctuation">.</span>cursor<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token string">'DELETE FROM Link WHERE id = %s'</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>commit<span class="token punctuation">(</span><span class="token punctuation">)</span>
cursor<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
conn<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">if</span> cursor<span class="token punctuation">.</span>rowcount <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Delete error: link is not found&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">404</span>
<span class="token keyword">else</span><span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;success&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Link from ID </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">id</span><span class="token punctuation">}</span></span><span class="token string"> deleted successfully&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">200</span>
<span class="token keyword">except</span> Error <span class="token keyword">as</span> e<span class="token punctuation">:</span>
<span class="token keyword">return</span> jsonify<span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">:</span> <span class="token string-interpolation"><span class="token string">f&quot;Error deleting link: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">str</span><span class="token punctuation">(</span>e<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">&quot;</span></span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">500</span>
<span class="token keyword">if</span> name <span class="token operator">==</span> <span class="token string">'main'</span><span class="token punctuation">:</span>
app<span class="token punctuation">.</span>run<span class="token punctuation">(</span>debug<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span>
</code></pre></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Останнє оновлення:</span> <span class="time">6/6/2024, 5:47:14 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
<a href="/OBD-lab6/design/" class="prev">
Проєктування архітектури системи
</a></span> <span class="next"><a href="/OBD-lab6/test/">
Тестування працездатності системи
</a>
</span></p></div> </main></div><div class="global-ui"><!----></div></div>
<script src="/OBD-lab6/assets/js/app.05910fbb.js" defer></script><script src="/OBD-lab6/assets/js/2.d3067b7e.js" defer></script><script src="/OBD-lab6/assets/js/24.34b35d62.js" defer></script>
</body>
</html>