Version 3 #67

Merged
danieljsummers merged 53 commits from version-3 into master 2021-10-26 23:39:59 +00:00
11 changed files with 39 additions and 41 deletions
Showing only changes of commit 72cb07ab4d - Show all commits

4
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -1,4 +1,7 @@
{ {
"ConnectionStrings": {
"db": "Filename=./mpj.db"
},
"Kestrel": { "Kestrel": {
"EndPoints": { "EndPoints": {
"Http": { "Http": {

View File

@ -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",

View File

@ -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

View File

@ -1,33 +1,32 @@
<template lang="pug"> <template lang="pug">
.md-toolbar-row nav.navbar
md-tabs(md-sync-route).md-primary .container-fluid
router-link.navbar-brand(to="/") myPrayerJournal
ul.navbar-nav.me-auto.d-flex.flex-row
template(v-if="isAuthenticated") template(v-if="isAuthenticated")
md-tab(md-label="Journal" to="/journal") li.nav-item: router-link(to="/journal") Journal
md-tab(md-label="Active" to="/requests/active") li.nav-item: router-link(to="/requests/active") Active
md-tab(v-if="hasSnoozed" md-label="Snoozed" to="/requests/snoozed") li.nav-item(v-if="hasSnoozed"): router-link(to="/requests/snoozed") Snoozed
md-tab(md-label="Answered" to="/requests/answered") li.nav-item: router-link(to="/requests/answered") Answered
md-tab(md-label="Log Off" href="/user/log-off" @click.prevent="logOff()") li.nav-item: a(href="/user/log-off" @click.prevent="logOff()") Log Off
template(v-else) template(v-else)
md-tab(md-label="Log On" href="/user/log-on" @click.prevent="logOn()") li.nav-item: a(href="/user/log-on" @click.prevent="logOn()") Log On
md-tab(md-label="Docs" href="https://docs.prayerjournal.me" @click.prevent="showHelp()") 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>

View File

@ -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"
@ -59,11 +59,14 @@ const sortValue = (it : JournalRequest) => it.showAfter === 0 ? it.asOf : it.sho
*/ */
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
}), }),

View File

@ -1,5 +1,6 @@
module.exports = { module.exports = {
lintOnSave: false, lintOnSave: false,
outputDir: "../Api/wwwroot",
configureWebpack: { configureWebpack: {
module: { module: {
rules: [{ rules: [{

View File

@ -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 ()