-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
294 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,29 +8,15 @@ | |
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
<script src="https://unpkg.com/[email protected]" | ||
integrity="sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2" | ||
crossorigin="anonymous"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="max-w-3xl m-auto mb-12"> | ||
<h1 class="mt-12 mb-6 text-2xl font-semibold">Job Summoner</h1> | ||
{{range .JobPostings}} | ||
<a class="p-4 bg-gray-100 mb-2 flex justify-between items-center" href="{{.JobPostingUrl}}"> | ||
<div class="flex items-center"> | ||
{{if .CompanyAvatar.String}} | ||
<img class="size-10 rounded-lg mr-4" src="{{.CompanyAvatar.String}}" alt=""> | ||
{{else}} | ||
<div class="size-10 rounded-lg mr-4 bg-gray-300 flex items-center justify-center"> | ||
<p class="text-lg text-gray-600">?</p> | ||
</div> | ||
{{end}} | ||
<div> | ||
<p class="font-bold">{{.Position}}</p> | ||
<p>{{.CompanyName}}</p> | ||
</div> | ||
</div> | ||
<p class="text-sm text-gray-500">Posted {{.TimeAgo}}</p> | ||
</a> | ||
{{end}} | ||
{{template "user_job_postings" .}} | ||
</div> | ||
</body> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{define "user_job_postings"}} | ||
{{range .JobPostings}} | ||
<div id="user_job_posting-{{ .JobPostingID }}" class="p-4 bg-gray-100 mb-2 flex justify-between items-center" | ||
href="{{.JobPostingUrl}}"> | ||
<div class="flex items-center"> | ||
{{if .CompanyAvatar.String}} | ||
<img class="size-10 rounded-lg mr-4" src="{{.CompanyAvatar.String}}" alt=""> | ||
{{else}} | ||
<div class="size-10 rounded-lg mr-4 bg-gray-300 flex items-center justify-center"> | ||
<p class="text-lg text-gray-600">?</p> | ||
</div> | ||
{{end}} | ||
<div> | ||
<p class="font-bold">{{.Position}}</p> | ||
<p>{{.CompanyName}}</p> | ||
<p class="text-sm text-gray-500">Posted {{.TimeAgo}}</p> | ||
</div> | ||
</div> | ||
|
||
<button type="button" hx-patch="/user_job_postings/{{ .JobPostingID }}" | ||
hx-target="#user_job_posting-{{ .JobPostingID }}" hx-swap="outerHTML">Hide</button> | ||
</div> | ||
{{end}} | ||
{{end}} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package handlers | ||
|
||
import ( | ||
"database/sql" | ||
"net/http" | ||
|
||
"github.com/m1yon/jobsummoner/internal/database" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
) | ||
|
||
type handlersConfig struct { | ||
DB *database.Queries | ||
} | ||
|
||
func NewHandlerMux(db *sql.DB) (*http.ServeMux, error) { | ||
mux := http.NewServeMux() | ||
dbQueries := database.New(db) | ||
|
||
cfg := handlersConfig{ | ||
DB: dbQueries, | ||
} | ||
|
||
mux.HandleFunc("/", cfg.rootHandler) | ||
mux.HandleFunc("PATCH /user_job_postings/{jobPostingID}", cfg.putUserJobPostingsHandler) | ||
|
||
mux.Handle("/metrics/", promhttp.Handler()) | ||
|
||
return mux, nil | ||
} |
Oops, something went wrong.