Version 3 #67
4
.gitignore
vendored
4
.gitignore
vendored
@ -256,7 +256,7 @@ paket-files/
|
|||||||
.ionide
|
.ionide
|
||||||
|
|
||||||
# Compiled files / application
|
# Compiled files / application
|
||||||
src/build
|
src/MyPrayerJournal/Api/*.db
|
||||||
src/MyPrayerJournal/Api/wwwroot/favicon.ico
|
src/MyPrayerJournal/Api/wwwroot/favicon.ico
|
||||||
src/MyPrayerJournal/Api/wwwroot/index.html
|
src/MyPrayerJournal/Api/wwwroot/index.html
|
||||||
src/MyPrayerJournal/Api/wwwroot/*.js
|
src/MyPrayerJournal/Api/wwwroot/*.js
|
||||||
@ -264,5 +264,3 @@ src/MyPrayerJournal/Api/wwwroot/*.js.map
|
|||||||
src/MyPrayerJournal/Api/wwwroot/css
|
src/MyPrayerJournal/Api/wwwroot/css
|
||||||
src/MyPrayerJournal/Api/wwwroot/js
|
src/MyPrayerJournal/Api/wwwroot/js
|
||||||
src/MyPrayerJournal/Api/appsettings.Development.json
|
src/MyPrayerJournal/Api/appsettings.Development.json
|
||||||
/build
|
|
||||||
src/*.exe
|
|
||||||
|
@ -65,7 +65,7 @@ module Mapping =
|
|||||||
doc.["recurType"] <- BsonValue (Recurrence.toString req.recurType)
|
doc.["recurType"] <- BsonValue (Recurrence.toString req.recurType)
|
||||||
doc.["recurCount"] <- BsonValue req.recurCount
|
doc.["recurCount"] <- BsonValue req.recurCount
|
||||||
doc.["history"] <- BsonArray (req.history |> List.map historyToBson |> Seq.ofList)
|
doc.["history"] <- BsonArray (req.history |> List.map historyToBson |> Seq.ofList)
|
||||||
doc.["notes"] <- BsonArray (req.notes |> List.map noteToBson |> Seq.ofList)
|
doc.["notes"] <- BsonArray (req.notes |> List.map noteToBson |> Seq.ofList)
|
||||||
upcast doc
|
upcast doc
|
||||||
|
|
||||||
/// Map a BSON document to a request
|
/// Map a BSON document to a request
|
||||||
@ -78,7 +78,7 @@ module Mapping =
|
|||||||
recurType = Recurrence.fromString doc.["recurType"].AsString
|
recurType = Recurrence.fromString doc.["recurType"].AsString
|
||||||
recurCount = int16 doc.["recurCount"].AsInt32
|
recurCount = int16 doc.["recurCount"].AsInt32
|
||||||
history = doc.["history"].AsArray |> Seq.map historyFromBson |> List.ofSeq
|
history = doc.["history"].AsArray |> Seq.map historyFromBson |> List.ofSeq
|
||||||
notes = doc.["notes"].AsArray |> Seq.map noteFromBson |> List.ofSeq
|
notes = doc.["notes"].AsArray |> Seq.map noteFromBson |> List.ofSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set up the mapping
|
/// Set up the mapping
|
||||||
|
@ -18,8 +18,8 @@ module Configure =
|
|||||||
let appConfiguration (bldr : WebApplicationBuilder) =
|
let appConfiguration (bldr : WebApplicationBuilder) =
|
||||||
bldr.Configuration
|
bldr.Configuration
|
||||||
.SetBasePath(bldr.Environment.ContentRootPath)
|
.SetBasePath(bldr.Environment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", optional = true, reloadOnChange = true)
|
.AddJsonFile("appsettings.json", optional = false, reloadOnChange = true)
|
||||||
.AddJsonFile($"appsettings.{bldr.Environment.EnvironmentName}.json")
|
.AddJsonFile($"appsettings.{bldr.Environment.EnvironmentName}.json", optional = true, reloadOnChange = true)
|
||||||
.AddEnvironmentVariables ()
|
.AddEnvironmentVariables ()
|
||||||
|> ignore
|
|> ignore
|
||||||
bldr
|
bldr
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"db": "Filename=./mpj.db"
|
||||||
|
},
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"EndPoints": {
|
"EndPoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"lint": "vue-cli-service lint",
|
"lint": "vue-cli-service lint",
|
||||||
"apistart": "cd ../Api && dotnet run",
|
"apistart": "cd ../Api && dotnet run",
|
||||||
"publish": "vue-cli-service build --modern && cd ../Api && dotnet publish -c Release -r linux-x64 --self-contained false",
|
"publish": "vue-cli-service build --modern && cd ../Api && dotnet publish -c Release -r linux-x64 --self-contained false",
|
||||||
"vue": "vue-cli-service build --modern && cd ../Api && dotnet run"
|
"vue": "vue-cli-service build --development && cd ../Api && dotnet run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vueuse/core": "^6.4.1",
|
"@vueuse/core": "^6.4.1",
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.mpj-app
|
.mpj-app
|
||||||
#nav
|
navigation-bar
|
||||||
router-link(to="/") Home
|
|
||||||
| |
|
|
||||||
router-link(to="/about") About
|
|
||||||
router-view
|
router-view
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import "bootstrap/dist/css/bootstrap.min.css"
|
import "bootstrap/dist/css/bootstrap.min.css"
|
||||||
|
|
||||||
|
import NavigationBar from "@/components/NavigationBar.vue"
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="sass">
|
<style lang="sass">
|
||||||
@ -16,7 +16,6 @@ import "bootstrap/dist/css/bootstrap.min.css"
|
|||||||
font-family: Avenir, Helvetica, Arial, sans-serif
|
font-family: Avenir, Helvetica, Arial, sans-serif
|
||||||
-webkit-font-smoothing: antialiased
|
-webkit-font-smoothing: antialiased
|
||||||
-moz-osx-font-smoothing: grayscale
|
-moz-osx-font-smoothing: grayscale
|
||||||
text-align: center
|
|
||||||
color: #2c3e50
|
color: #2c3e50
|
||||||
#nav
|
#nav
|
||||||
padding: 30px
|
padding: 30px
|
||||||
|
@ -1,33 +1,32 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.md-toolbar-row
|
nav.navbar
|
||||||
md-tabs(md-sync-route).md-primary
|
.container-fluid
|
||||||
template(v-if="isAuthenticated")
|
router-link.navbar-brand(to="/") myPrayerJournal
|
||||||
md-tab(md-label="Journal" to="/journal")
|
ul.navbar-nav.me-auto.d-flex.flex-row
|
||||||
md-tab(md-label="Active" to="/requests/active")
|
template(v-if="isAuthenticated")
|
||||||
md-tab(v-if="hasSnoozed" md-label="Snoozed" to="/requests/snoozed")
|
li.nav-item: router-link(to="/journal") Journal
|
||||||
md-tab(md-label="Answered" to="/requests/answered")
|
li.nav-item: router-link(to="/requests/active") Active
|
||||||
md-tab(md-label="Log Off" href="/user/log-off" @click.prevent="logOff()")
|
li.nav-item(v-if="hasSnoozed"): router-link(to="/requests/snoozed") Snoozed
|
||||||
template(v-else)
|
li.nav-item: router-link(to="/requests/answered") Answered
|
||||||
md-tab(md-label="Log On" href="/user/log-on" @click.prevent="logOn()")
|
li.nav-item: a(href="/user/log-off" @click.prevent="logOff()") Log Off
|
||||||
md-tab(md-label="Docs" href="https://docs.prayerjournal.me" @click.prevent="showHelp()")
|
template(v-else)
|
||||||
|
li.nav-item: a(href="/user/log-on" @click.prevent="logOn()") Log On
|
||||||
|
li.nav-item: a(href="https://docs.prayerjournal.me" target="_blank") Docs
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, inject } from "vue"
|
import { computed } from "vue"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
|
|
||||||
|
import { useAuth } from "@/plugins/auth"
|
||||||
import { useStore } from "@/store"
|
import { useStore } from "@/store"
|
||||||
import { AuthService } from "@/auth"
|
|
||||||
import { AuthSymbol } from "@/App.vue"
|
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const auth = useAuth()
|
||||||
/** The auth service */
|
|
||||||
const auth = inject(AuthSymbol) as AuthService
|
|
||||||
|
|
||||||
/** Whether a user is authenticated */
|
/** Whether a user is authenticated */
|
||||||
const isAuthenticated = computed(() => store.state.isAuthenticated)
|
const isAuthenticated = computed(() => store?.state.isAuthenticated ?? false)
|
||||||
|
|
||||||
/** Whether the user has any snoozed requests */
|
/** Whether the user has any snoozed requests */
|
||||||
const hasSnoozed = computed(() =>
|
const hasSnoozed = computed(() =>
|
||||||
@ -43,7 +42,4 @@ const logOff = () => {
|
|||||||
auth.logout(store)
|
auth.logout(store)
|
||||||
router.push("/")
|
router.push("/")
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Open a new window/tab with help */
|
|
||||||
const showHelp = () => { window.open("https://docs.prayerjournal.me", "_blank") }
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,7 +3,7 @@ import { createStore, Store, useStore as baseUseStore } from "vuex"
|
|||||||
import { useTitle } from "@vueuse/core"
|
import { useTitle } from "@vueuse/core"
|
||||||
|
|
||||||
import api, { JournalRequest } from "@/api"
|
import api, { JournalRequest } from "@/api"
|
||||||
import auth from "@/auth"
|
import { useAuth } from "@/plugins/auth"
|
||||||
|
|
||||||
import * as Actions from "./actions"
|
import * as Actions from "./actions"
|
||||||
import * as Mutations from "./mutations"
|
import * as Mutations from "./mutations"
|
||||||
@ -58,12 +58,15 @@ const sortValue = (it : JournalRequest) => it.showAfter === 0 ? it.asOf : it.sho
|
|||||||
* Sort journal requests either by asOf or showAfter
|
* Sort journal requests either by asOf or showAfter
|
||||||
*/
|
*/
|
||||||
const journalSort = (a : JournalRequest, b : JournalRequest) => sortValue(a) - sortValue(b)
|
const journalSort = (a : JournalRequest, b : JournalRequest) => sortValue(a) - sortValue(b)
|
||||||
|
|
||||||
|
/** The authentication service */
|
||||||
|
const auth = useAuth()
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
state: () : State => ({
|
state: () : State => ({
|
||||||
pageTitle: appName,
|
pageTitle: appName,
|
||||||
user: auth.session.profile,
|
user: auth?.session.profile ?? {},
|
||||||
isAuthenticated: auth.isAuthenticated(),
|
isAuthenticated: auth?.isAuthenticated() ?? false,
|
||||||
journal: [],
|
journal: [],
|
||||||
isLoadingJournal: false
|
isLoadingJournal: false
|
||||||
}),
|
}),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
lintOnSave: false,
|
lintOnSave: false,
|
||||||
|
outputDir: "../Api/wwwroot",
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [{
|
||||||
|
@ -49,9 +49,7 @@ let migrated =
|
|||||||
history = Subdocs.history r?history
|
history = Subdocs.history r?history
|
||||||
notes = Subdocs.notes r?notes
|
notes = Subdocs.notes r?notes
|
||||||
})
|
})
|
||||||
|> Seq.iter (fun req ->
|
|> db.GetCollection<Request>("request").Insert
|
||||||
printfn "%A" req
|
|
||||||
db.GetCollection<Request>("request").Insert req |> ignore)
|
|
||||||
|
|
||||||
db.Checkpoint ()
|
db.Checkpoint ()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user