bugs fix, request error suppert
This commit is contained in:
parent
1b7ff43178
commit
14cf52fc77
@ -3,23 +3,25 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="baac0fea-ba77-4412-8e4a-c4ee1e16e324" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/booking.go" beforeDir="false" afterPath="$PROJECT_DIR$/booking.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/calendarController.go" beforeDir="false" afterPath="$PROJECT_DIR$/calendarController.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/dbConnector.go" beforeDir="false" afterPath="$PROJECT_DIR$/dbConnector.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/queriesController.go" beforeDir="false" afterPath="$PROJECT_DIR$/queriesController.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/proba.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/router.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/routes.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/app.module.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/nav-bar/nav-bar.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/nav-bar/nav-bar.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/app.router.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/app.router.module.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/admin-menu/admin-menu.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/admin-menu/admin-menu.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/environments/DataSources.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/environments/DataSources.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/models/Query.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/models/Query.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/services/query.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/services/query.service.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.prod.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.prod.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/services/term.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/services/term.service.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt_visio.exe" beforeDir="false" afterPath="$PROJECT_DIR$/szt_visio.exe" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@ -62,7 +64,7 @@
|
||||
<session id="2110107836">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="12" />
|
||||
<entry key="project.closed" value="13" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.open.time.10" value="4" />
|
||||
<entry key="project.open.time.12" value="1" />
|
||||
@ -71,28 +73,28 @@
|
||||
<entry key="project.open.time.21" value="1" />
|
||||
<entry key="project.open.time.22" value="1" />
|
||||
<entry key="project.open.time.7" value="1" />
|
||||
<entry key="project.open.time.9" value="2" />
|
||||
<entry key="project.opened" value="13" />
|
||||
<entry key="project.open.time.9" value="3" />
|
||||
<entry key="project.opened" value="14" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="go" value="9672" />
|
||||
<entry key="go" value="9707" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Go" value="9672" />
|
||||
<entry key="Go" value="9707" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="go" value="45" />
|
||||
<entry key="go" value="54" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="Go" value="45" />
|
||||
<entry key="Go" value="54" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.go.postfix.template.usages.trigger">
|
||||
@ -104,11 +106,11 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="337">
|
||||
<caret line="29" column="29" selection-start-line="29" selection-start-column="29" selection-end-line="29" selection-end-column="29" />
|
||||
<state relative-caret-position="422">
|
||||
<caret line="32" selection-start-line="32" selection-end-line="32" />
|
||||
<folding>
|
||||
<element signature="e#14#128#0" expanded="true" />
|
||||
</folding>
|
||||
@ -116,20 +118,23 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/calendarController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="38" column="96" selection-start-line="38" selection-start-column="96" selection-end-line="38" selection-end-column="96" />
|
||||
<state relative-caret-position="473">
|
||||
<caret line="289" selection-start-line="289" selection-end-line="289" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="714">
|
||||
<caret line="48" column="5" selection-start-line="48" selection-start-column="5" selection-end-line="48" selection-end-column="5" />
|
||||
<state relative-caret-position="208">
|
||||
<caret line="94" column="5" selection-start-line="94" selection-start-column="5" selection-end-line="94" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#14#80#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -161,17 +166,17 @@
|
||||
<option value="$PROJECT_DIR$/calendar/controller.go" />
|
||||
<option value="$PROJECT_DIR$/test/controller.go" />
|
||||
<option value="$PROJECT_DIR$/dbConfig/config.go" />
|
||||
<option value="$PROJECT_DIR$/dbConnector.go" />
|
||||
<option value="$PROJECT_DIR$/router/routes.go" />
|
||||
<option value="$PROJECT_DIR$/proba.go" />
|
||||
<option value="$PROJECT_DIR$/booking.go" />
|
||||
<option value="$PROJECT_DIR$/routes.go" />
|
||||
<option value="$PROJECT_DIR$/router.go" />
|
||||
<option value="$PROJECT_DIR$/alghoritms.go" />
|
||||
<option value="$PROJECT_DIR$/models.go" />
|
||||
<option value="$PROJECT_DIR$/main.go" />
|
||||
<option value="$PROJECT_DIR$/queriesController.go" />
|
||||
<option value="$PROJECT_DIR$/router.go" />
|
||||
<option value="$PROJECT_DIR$/dbConnector.go" />
|
||||
<option value="$PROJECT_DIR$/booking.go" />
|
||||
<option value="$PROJECT_DIR$/calendarController.go" />
|
||||
<option value="$PROJECT_DIR$/main.go" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -269,9 +274,8 @@
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.29637527" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.29957357" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
@ -297,6 +301,18 @@
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/booking.go</url>
|
||||
<line>2</line>
|
||||
<properties />
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/logger/logger.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -308,13 +324,27 @@
|
||||
<entry file="file://$PROJECT_DIR$/dbConfig/config.go" />
|
||||
<entry file="file://$PROJECT_DIR$/calendar/controller.go" />
|
||||
<entry file="file://$PROJECT_DIR$/test/controller.go" />
|
||||
<entry file="file://$PROJECT_DIR$/alghoritms.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="19" column="1" selection-start-line="19" selection-start-column="1" selection-end-line="19" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/proba.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="694">
|
||||
<state relative-caret-position="-275">
|
||||
<caret line="42" column="9" lean-forward="true" selection-start-line="42" selection-start-column="9" selection-end-line="42" selection-end-column="9" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/router.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="4" lean-forward="true" selection-start-line="9" selection-start-column="4" selection-end-line="9" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/routes.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
@ -322,41 +352,10 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/alghoritms.go">
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="19" column="1" selection-start-line="19" selection-start-column="1" selection-end-line="19" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="541">
|
||||
<caret line="150" column="1" selection-start-line="79" selection-end-line="150" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/dbConnector.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="357">
|
||||
<caret line="24" column="19" selection-start-line="24" selection-start-column="19" selection-end-line="24" selection-end-column="19" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/router.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" selection-start-line="2" selection-start-column="2" selection-end-line="18" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="337">
|
||||
<caret line="29" column="29" selection-start-line="29" selection-start-column="29" selection-end-line="29" selection-end-column="29" />
|
||||
<folding>
|
||||
<element signature="e#14#128#0" expanded="true" />
|
||||
</folding>
|
||||
<state relative-caret-position="-1224">
|
||||
<caret line="48" column="5" selection-start-line="48" selection-start-column="5" selection-end-line="48" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -367,17 +366,37 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<entry file="file://$PROJECT_DIR$/dbConnector.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="714">
|
||||
<caret line="48" column="5" selection-start-line="48" selection-start-column="5" selection-end-line="48" selection-end-column="5" />
|
||||
<state relative-caret-position="255">
|
||||
<caret line="18" selection-start-line="18" selection-end-line="18" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="208">
|
||||
<caret line="94" column="5" selection-start-line="94" selection-start-column="5" selection-end-line="94" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#14#80#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/calendarController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="323">
|
||||
<caret line="38" column="96" selection-start-line="38" selection-start-column="96" selection-end-line="38" selection-end-column="96" />
|
||||
<state relative-caret-position="473">
|
||||
<caret line="289" selection-start-line="289" selection-end-line="289" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="422">
|
||||
<caret line="32" selection-start-line="32" selection-end-line="32" />
|
||||
<folding>
|
||||
<element signature="e#14#128#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
18
booking.go
18
booking.go
@ -83,25 +83,29 @@ func delBooking(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
log.Println(string(body))
|
||||
var term Term
|
||||
err = json.Unmarshal(body, &term)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
fmt.Println(term)
|
||||
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("DELETE FROM contracts WHERE date=$1;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
@ -123,12 +127,14 @@ func delBooking(w http.ResponseWriter, req *http.Request) {
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("UPDATE calendar SET status=$1, contractno=$2 WHERE date=$3;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
|
@ -287,29 +287,3 @@ func putTerm(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
func postTest(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
fmt.Println("postTest")
|
||||
log.Println(string(body));
|
||||
}
|
||||
|
||||
func deleteTest(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "content-Type")
|
||||
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
http.Error(w, "błąd zapisu danych", 500)
|
||||
return
|
||||
}
|
||||
fmt.Println("deleteTest");
|
||||
log.Println(string(body));
|
||||
}
|
@ -16,10 +16,7 @@ const (
|
||||
)
|
||||
|
||||
func initDb() {
|
||||
//config := dbConfig()
|
||||
var err error
|
||||
//psqlInfo := fmt.Sprintf("host=localhost port=%s user=%s password=%s dbname=%s sslmode=disable",
|
||||
// config[dbport], config[dbuser], config[dbpass], config[dbname])
|
||||
|
||||
db, err = sql.Open("postgres", "port=5432 password=admin user=postgres dbname=mydb sslmode=disable")
|
||||
if err != nil {
|
||||
|
4
main.go
4
main.go
@ -17,7 +17,6 @@ func main() {
|
||||
initDb()
|
||||
defer db.Close()
|
||||
|
||||
//router := NewRouter()
|
||||
router:=mux.NewRouter()
|
||||
|
||||
router.HandleFunc("/term/{year}/{month}", getTerms).Methods("GET", "OPTIONS")
|
||||
@ -29,9 +28,6 @@ func main() {
|
||||
router.HandleFunc("/query", getQueryList).Methods("GET", "OPTIONS")
|
||||
router.HandleFunc("/query", updateQuery).Methods("PUT", "OPTIONS")
|
||||
|
||||
|
||||
router.HandleFunc("/test", postTest).Methods("POST", "OPTIONS")
|
||||
router.HandleFunc("/test", deleteTest).Methods("DELETE", "OPTIONS")
|
||||
log.Fatal(http.ListenAndServe(":8080", handlers.CORS(alowedHeaders, allowedOrigins, allowedMethods)(router)))
|
||||
}
|
||||
|
||||
|
87
proba.go
87
proba.go
@ -1,87 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type repositorySummary struct {
|
||||
ID int
|
||||
Name string
|
||||
Owner string
|
||||
TotalStars int
|
||||
}
|
||||
|
||||
type repositories struct {
|
||||
Repositories []repositorySummary
|
||||
}
|
||||
|
||||
func proba(w http.ResponseWriter, req *http.Request) {
|
||||
repos := []repositorySummary{}
|
||||
|
||||
enableCors(&w)
|
||||
|
||||
rows, err := db.Query(`
|
||||
SELECT
|
||||
*
|
||||
FROM repositories2`)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
repo := repositorySummary{}
|
||||
err = rows.Scan(
|
||||
&repo.ID,
|
||||
&repo.Owner,
|
||||
&repo.Name,
|
||||
&repo.TotalStars,
|
||||
)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
|
||||
out, err := json.Marshal(repos)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, string(out))
|
||||
}
|
||||
|
||||
func queryRepos(repos []repositorySummary) error {
|
||||
rows, err := db.Query(`
|
||||
SELECT
|
||||
id,
|
||||
repository_owner,
|
||||
repository_name,
|
||||
total_stars
|
||||
FROM repositories2`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
repo := repositorySummary{}
|
||||
err = rows.Scan(
|
||||
&repo.ID,
|
||||
&repo.Owner,
|
||||
&repo.Name,
|
||||
&repo.TotalStars,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
fmt.Println(repos)
|
||||
err = rows.Err()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
19
router.go
19
router.go
@ -1,19 +0,0 @@
|
||||
package main
|
||||
|
||||
//func NewRouter() *mux.Router {
|
||||
// router := mux.NewRouter().StrictSlash(true)
|
||||
// for _, route := range routes {
|
||||
// var handler http.Handler
|
||||
//
|
||||
// handler = route.HandlerFunc
|
||||
// handler = logger.Logger(handler, route.Name)
|
||||
//
|
||||
// router.
|
||||
// Methods(route.Method).
|
||||
// Path(route.Pattern).
|
||||
// Name(route.Name).
|
||||
// Handler(handler)
|
||||
// }
|
||||
//
|
||||
// return router
|
||||
//}
|
24
routes.go
24
routes.go
@ -1,24 +0,0 @@
|
||||
package main
|
||||
|
||||
//type Route struct {
|
||||
// Name string
|
||||
// Method string
|
||||
// Pattern string
|
||||
// HandlerFunc http.HandlerFunc
|
||||
//}
|
||||
//
|
||||
//type Routes []Route
|
||||
//
|
||||
//var routes = Routes{
|
||||
// Route{"addTerm", "POST", "/term", newTerm},
|
||||
// Route{"getTerms", "GET", "/term", getTerms},
|
||||
// Route{"getTerm","GET","/term/{year}/{month}", getTerm},
|
||||
// Route{"test", "GET", "/test", proba},
|
||||
//
|
||||
// Route{"newQuery", "POST", "/query", newQuery},
|
||||
// Route{"bookTerm", "POST", "/book", newBooking},
|
||||
// Route{"bookTerm", "DELETE", "/book", delBooking},
|
||||
//
|
||||
// Route{"postTest", "POST", "/test", postTest},
|
||||
// Route{"postTest", "DELETE", "/test", deleteTest},
|
||||
//}
|
@ -24,6 +24,7 @@ import {registerLocaleData} from '@angular/common';
|
||||
import pl from '@angular/common/locales/pl';
|
||||
import {QueryDetailesComponent} from './components/dialogs/query-detailes/query-detailes.component';
|
||||
import {QueriesListAdminComponent} from './components/queries-list-admin/queries-list-admin.component';
|
||||
import { StartComponent } from './components/start/start.component';
|
||||
|
||||
const config = {
|
||||
apiKey: 'AIzaSyBuOHXooBv4bsWWgEZxd7Y86TrxkrbYZIU',
|
||||
@ -49,7 +50,8 @@ registerLocaleData(pl);
|
||||
EditTermAdminComponent,
|
||||
LoginComponent,
|
||||
QueriesListAdminComponent,
|
||||
QueryDetailesComponent
|
||||
QueryDetailesComponent,
|
||||
StartComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {AddTermsComponent} from './components/add-terms/add-terms.component';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {TestComponent} from './components/test/test.component';
|
||||
import {TermListComponent} from './components/term-list/term-list.component';
|
||||
import {AdminMenuComponent} from './components/admin-menu/admin-menu.component';
|
||||
import {TermListAdminComponent} from './components/term-list-admin/term-list-admin.component';
|
||||
@ -8,8 +7,13 @@ import {NgModule} from '@angular/core';
|
||||
import {LoginComponent} from './components/login/login.component';
|
||||
import {AuthGuardsService} from './services/auth-guards.service';
|
||||
import {QueriesListAdminComponent} from './components/queries-list-admin/queries-list-admin.component';
|
||||
import {StartComponent} from './components/start/start.component';
|
||||
|
||||
export const appRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: StartComponent
|
||||
},
|
||||
{
|
||||
path: 'list-term',
|
||||
component: TermListComponent
|
||||
|
@ -11,12 +11,12 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="row" *ngFor="let month of form.controls.orders.controls; let i = index" formArrayName="orders">
|
||||
<div class="row" *ngFor="let month of months ; let i = index" formArrayName="orders">
|
||||
<mat-checkbox [formControlName]="i" color="primary">{{months[i].value}}</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<button mat-raised-button color="primary" type="submit">Primary</button>
|
||||
<button mat-raised-button color="primary" type="submit">Dodaj</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -14,7 +14,7 @@ export class AddTermsComponent implements OnInit {
|
||||
|
||||
form: FormGroup;
|
||||
|
||||
yearItems = [2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030];
|
||||
yearItems = [ 2019, 2020, 2021, 2022, 2023];
|
||||
months = [
|
||||
{key: 1, value: 'Styczeń'},
|
||||
{key: 2, value: 'Luty'},
|
||||
@ -55,12 +55,12 @@ export class AddTermsComponent implements OnInit {
|
||||
x => {
|
||||
this.openSnackBar('Dodano terminy !');
|
||||
},
|
||||
error => this.openSnackBar('Coś poszło nie tak.. Sprawdź poprawność terminów i spróbuj ponownie'));
|
||||
error => this.openSnackBar('Coś poszło nie tak, być może istnieją już terminy w bazie danych.\nJeśli tak to zostały dodane tylko te, których brak.\nDla pewności sprawdź czy dane się zapisały'));
|
||||
}
|
||||
|
||||
openSnackBar(message: string) {
|
||||
this.snackBar.open(message, null, {
|
||||
duration: 2500,
|
||||
duration: 5000,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
<a routerLink="add-term">Dodaj terminy</a>
|
||||
<a routerLink="term-list-admin">Terminy</a>
|
||||
<a routerLink="queries">Zapytania</a>
|
||||
<br>
|
||||
<div style="margin: auto 0">
|
||||
<button type="button" class="btn btn-info" style="margin: 10px" routerLink="add-term">Dodaj terminy</button>
|
||||
<button type="button" class="btn btn-info" style="margin: 10px" routerLink="term-list-admin">Terminy</button>
|
||||
<button type="button" class="btn btn-info" style="margin: 10px" routerLink="queries">Zapytania</button>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {Month} from '../../models/Month';
|
||||
|
||||
export class DataSources {
|
||||
public static yearsList = [ '2018', '2019', '2020', '2021', '2022', '2023'];
|
||||
public static yearsList = [ '2019', '2020', '2021', '2022', '2023'];
|
||||
|
||||
public static monthsList: Month[] = [
|
||||
{
|
||||
key: '01',
|
||||
key: '1',
|
||||
value: 'styczeń'
|
||||
},
|
||||
{
|
||||
|
@ -19,12 +19,14 @@
|
||||
<td>{{query.startdate | date: 'dd - MM - yyyy' }}</td>
|
||||
<td>{{query.enddate | date: 'dd - MM - yyyy' }}</td>
|
||||
<td>{{query.contactperson }}</td>
|
||||
<td><span *ngIf="query.status === 1"><strong>Nowe</strong></span><span *ngIf="query.status === 2">Przeczytanie</span><span *ngIf="query.status === 3">Wysłano ofertę</span></td>
|
||||
<td><span *ngIf="query.status === 1"><strong>Nowe</strong></span><span *ngIf="query.status === 2">Przeczytano</span><span *ngIf="query.status === 3">Wysłano ofertę</span></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-info" (click)="showDetails(query)">Szczegóły</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div *ngIf="(queryList$ | async)?.length < 1" class="alert alert-danger">
|
||||
Brak zapytań.
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,5 @@
|
||||
<div class="alert alert-info" style="margin: 0 auto; margin-top: 20px">
|
||||
<p><strong>Witaj w terminarzu VISIO STUDIO !</strong></p>
|
||||
<p>Aby sprawdzić dostępność terminów proszę wybrać z menu 'Terminarz',<br> następnie wskazać rok oraz miesiąc.</p>
|
||||
<p>Aby poznać ofrtę na żądany termin proszę użyć formularza pod przyciskiem "Poproś o wycenę"</p>
|
||||
</div>
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StartComponent } from './start.component';
|
||||
|
||||
describe('StartComponent', () => {
|
||||
let component: StartComponent;
|
||||
let fixture: ComponentFixture<StartComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ StartComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(StartComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
15
szt-visio-app/src/app/components/start/start.component.ts
Normal file
15
szt-visio-app/src/app/components/start/start.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-start',
|
||||
templateUrl: './start.component.html',
|
||||
styleUrls: ['./start.component.css']
|
||||
})
|
||||
export class StartComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -22,7 +22,9 @@
|
||||
</div>
|
||||
<br>
|
||||
<div style="margin: 0 auto; width: 80%">
|
||||
|
||||
<div *ngIf="!searchedProperty" class="alert alert-info">
|
||||
Proszę wybrać termin
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
@ -43,5 +45,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div *ngIf="(allTerms$ | async)?.length < 1 && searchedProperty" class="alert alert-danger">
|
||||
Brak dostępnych terminów.
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,8 +6,6 @@ import {Term} from '../../models/Term';
|
||||
import {TermService} from '../../services/term.service';
|
||||
import {MatDialog, MatSnackBar} from '@angular/material';
|
||||
import {DataSources} from '../environments/DataSources';
|
||||
import {CreateQueryComponent} from '../dialogs/create-query/create-query.component';
|
||||
import {PeriodicElement} from '../term-list/term-list.component';
|
||||
import {TermAdminService} from '../../services/termin-admin-service.service';
|
||||
import {EditTermAdminComponent} from '../dialogs/edit-term-admin/edit-term-admin.component';
|
||||
|
||||
@ -21,6 +19,7 @@ export class TermListAdminComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
yearsList = [];
|
||||
monthsList: Month[];
|
||||
searchedProperty = false;
|
||||
|
||||
allTerms$: Observable<Array<Term>>;
|
||||
|
||||
@ -36,10 +35,14 @@ export class TermListAdminComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.allTerms$ = this.termService.terms$;
|
||||
this.termService.termsObs.next(null);
|
||||
}
|
||||
|
||||
search() {
|
||||
this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
|
||||
async search() {
|
||||
await this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
|
||||
this.searchedProperty = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
editTerm(event: Term) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="search()" [disabled]="form.invalid">Szukaj</button>
|
||||
</form>
|
||||
<button mat-raised-button color="primary" (click)="openDialog()">Zarezerwuj termin</button>
|
||||
<button mat-raised-button color="primary" (click)="openDialog()">Poproś o ofertę</button>
|
||||
</div>
|
||||
<br>
|
||||
<div style="margin: 0 auto; width: 80%">
|
||||
|
@ -8,26 +8,6 @@ import {Observable} from 'rxjs';
|
||||
import {MatDialog} from '@angular/material';
|
||||
import {CreateQueryComponent} from '../dialogs/create-query/create-query.component';
|
||||
|
||||
export interface PeriodicElement {
|
||||
name: string;
|
||||
position: number;
|
||||
weight: number;
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
const ELEMENT_DATA: PeriodicElement[] = [
|
||||
{position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
|
||||
{position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
|
||||
{position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
|
||||
{position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
|
||||
{position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
|
||||
{position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
|
||||
{position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
|
||||
{position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
|
||||
{position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
|
||||
{position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'app-term-list',
|
||||
templateUrl: './term-list.component.html',
|
||||
@ -40,7 +20,6 @@ export class TermListComponent implements OnInit {
|
||||
searchedProperty = false;
|
||||
|
||||
displayedColumns: string[] = ['weekDay', 'date', 'availability'];
|
||||
dataSource = ELEMENT_DATA;
|
||||
|
||||
allTerms$: Observable<Array<Term>>;
|
||||
|
||||
@ -72,8 +51,3 @@ export class TermListComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// export interface DialogData {
|
||||
// animal: string;
|
||||
// name: string;
|
||||
// }
|
||||
|
@ -15,7 +15,7 @@ export class TermService {
|
||||
endpoint = 'term';
|
||||
|
||||
// terms: Array<Terms>;
|
||||
private termsObs = new BehaviorSubject<Array<Term>>([]);
|
||||
termsObs = new BehaviorSubject<Array<Term>>([]);
|
||||
terms$ = this.termsObs.asObservable();
|
||||
|
||||
getTerms(year: string, month: string) {
|
||||
|
BIN
szt_visio.exe
BIN
szt_visio.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user