home, vault, and profile pages are framed out
This commit is contained in:
@@ -8,5 +8,7 @@ export const AppState = reactive({
|
|||||||
activeKeep: {},
|
activeKeep: {},
|
||||||
activeProfile: {},
|
activeProfile: {},
|
||||||
profileKeeps: [],
|
profileKeeps: [],
|
||||||
profileVaults: []
|
profileVaults: [],
|
||||||
|
vaultKeeps: [],
|
||||||
|
activeVault: {}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default {
|
|||||||
account: computed(() => {AppState.account}),
|
account: computed(() => {AppState.account}),
|
||||||
viewProfile() {
|
viewProfile() {
|
||||||
// console.log(user.name)
|
// console.log(user.name)
|
||||||
// AppState.activeProfile = user
|
// AppState.activeProfile = props.keep.creator
|
||||||
Modal.getOrCreateInstance(document.getElementById('keepModal')).hide()
|
Modal.getOrCreateInstance(document.getElementById('keepModal')).hide()
|
||||||
// logger.log(props.keep.creator.id)
|
// logger.log(props.keep.creator.id)
|
||||||
router.push({name: 'Profile', params: {id: props.keep.creator.id}})
|
router.push({name: 'Profile', params: {id: props.keep.creator.id}})
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
<img :src="keep.img" class="card-img" :alt="keep.name">
|
<img :src="keep.img" class="card-img" :alt="keep.name">
|
||||||
<div class="card-img-overlay d-flex justify-content-between align-items-end">
|
<div class="card-img-overlay d-flex justify-content-between align-items-end">
|
||||||
<h5 class="card-title">{{ keep.name }}</h5>
|
<h5 class="card-title">{{ keep.name }}</h5>
|
||||||
<a href="#">
|
<img :src="keep.creator.picture" :alt="keep.creator.name" class="rounded-pill img-fluid profile-pic">
|
||||||
<img :src="keep.creator.picture" :alt="keep.creator.name" class="rounded-pill img-fluid">
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,9 +52,10 @@ export default {
|
|||||||
.card-img {
|
.card-img {
|
||||||
min-height: 160px;
|
min-height: 160px;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-img-overlay img {
|
.profile-pic {
|
||||||
max-height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="component">
|
|
||||||
Profile
|
|
||||||
{{ profile?.name }}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
profile: {
|
|
||||||
id: String,
|
|
||||||
name: String,
|
|
||||||
picture: String
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setup(props){
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<template>
|
||||||
|
<div @click="viewKeep()" class="component">
|
||||||
|
<div class="card bg-dark text-white">
|
||||||
|
<!-- TODO check if keep.img is a valid image -->
|
||||||
|
<img :src="keep.img" class="card-img" :alt="keep.name">
|
||||||
|
<div class="card-img-overlay d-flex justify-content-between align-items-end">
|
||||||
|
<h5 class="card-title">{{ keep.name }}</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
import { router } from '../router.js'
|
||||||
|
import { AppState } from '../AppState.js'
|
||||||
|
import { logger } from '../utils/Logger.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
keep: {
|
||||||
|
id: Number,
|
||||||
|
creatorId: String,
|
||||||
|
name: String,
|
||||||
|
description: String,
|
||||||
|
img: String,
|
||||||
|
views: Number,
|
||||||
|
kept: Number,
|
||||||
|
creator: {
|
||||||
|
id: String,
|
||||||
|
name: String,
|
||||||
|
picture: String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
return {
|
||||||
|
viewKeep() {
|
||||||
|
AppState.activeKeep = props.keep;
|
||||||
|
// console.log(props.keep.id)
|
||||||
|
// router.push({name: 'Keep'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card-img {
|
||||||
|
min-height: 160px;
|
||||||
|
max-height: 80vh;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-pic {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<div class="component">
|
||||||
|
<div class="card text-white">
|
||||||
|
<img :src="vault.img" :alt="vault.name" class="vault-img">
|
||||||
|
<div class="card-img-overlay d-flex align-items-end">
|
||||||
|
<h5 class="card-title">{{vault.name}}</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
vault: {
|
||||||
|
id: Number,
|
||||||
|
creatorId: String,
|
||||||
|
name: String,
|
||||||
|
description: String,
|
||||||
|
img: String,
|
||||||
|
isPrivate: Boolean,
|
||||||
|
creator: {
|
||||||
|
id: String,
|
||||||
|
name: String,
|
||||||
|
picture: String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props){
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
.vault-img {
|
||||||
|
height: 160px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="component">
|
|
||||||
vaults list
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
setup(){
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- TODO add masonry later -->
|
<!-- TODO add masonry later -->
|
||||||
<div class="container-fluid px-md-5 pt-4">
|
<div class="container-fluid px-md-5 pt-4">
|
||||||
<div class="row">
|
<div class="masonry-frame">
|
||||||
<div v-for="k in keeps" :key="k.id" @click="viewKeep(k)" class="col-6 col-md-4 col-lg-3 p-2">
|
<div v-for="k in keeps" :key="k.id" @click="viewKeep(k)" class="p-2">
|
||||||
<!-- <img src="../assets/img/404.svg" alt=""> TODO use this as default img in DB-->
|
<!-- <img src="../assets/img/404.svg" alt=""> TODO use this as default img in DB-->
|
||||||
<KeepTile :keep="k" />
|
<KeepTile :keep="k" />
|
||||||
</div>
|
</div>
|
||||||
@@ -22,7 +22,7 @@ export default {
|
|||||||
setup() {
|
setup() {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
await keepsService.GetAll()
|
await keepsService.getAll()
|
||||||
// document.getElementById('keepModal').
|
// document.getElementById('keepModal').
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -37,8 +37,6 @@ export default {
|
|||||||
viewKeep(keep) {
|
viewKeep(keep) {
|
||||||
AppState.activeKeep = keep
|
AppState.activeKeep = keep
|
||||||
Modal.getOrCreateInstance(document.getElementById('keepModal')).show()
|
Modal.getOrCreateInstance(document.getElementById('keepModal')).show()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,4 +61,24 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 6;
|
||||||
|
|
||||||
|
div {
|
||||||
|
break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,45 +1,118 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="component">
|
<div class="component">
|
||||||
<!-- none of this is loading... dafuq? -->
|
<div class="container">
|
||||||
{{ profile?.name }}
|
<div class="row">
|
||||||
{{ keeps[0]?.name }}
|
<div class="d-flex">
|
||||||
{{ vaults[0]?.name }}
|
<img :src="profile?.picture" :alt="profile?.name" class="profile-pic">
|
||||||
|
<div class="d-flex flex-column">
|
||||||
|
<h3>{{profile?.name}}</h3>
|
||||||
|
<h5>Vaults: {{vaults?.length}}</h5>
|
||||||
|
<h5>Keeps: {{keeps?.length}}</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h4>
|
||||||
|
Vaults
|
||||||
|
<i class="mdi mdi-plus"></i>
|
||||||
|
</h4>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row">
|
||||||
|
<div v-for="v in vaults" :key="v.id" @click="viewVault(v)" class="col-6 col-md-3 col-lg-2 p-2">
|
||||||
|
<VaultTile :vault="v" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h4>
|
||||||
|
Keeps
|
||||||
|
<i class="mdi mdi-plus"></i>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<!-- masonry goes here -->
|
||||||
|
<div class="masonry-frame">
|
||||||
|
<ProfileKeepTile v-for="k in keeps" :key="k.id" :keep="k" @click="viewKeep(k)" class="py-2" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<KeepModal :keep="activeKeep" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VaultsList from '../components/VaultsList.vue'
|
|
||||||
import KeepsList from '../components/KeepsList.vue';
|
|
||||||
import { profilesService } from '../services/ProfilesService'
|
import { profilesService } from '../services/ProfilesService'
|
||||||
import { computed, onMounted } from 'vue'
|
import { computed, onMounted } from 'vue'
|
||||||
import { AppState } from '../AppState';
|
import { AppState } from '../AppState';
|
||||||
import { logger } from '../utils/Logger.js'
|
import { logger } from '../utils/Logger.js'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import { Modal } from 'bootstrap'
|
||||||
|
import { keepsService } from '../services/KeepsService';
|
||||||
|
import VaultTile from '../components/VaultTile.vue';
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute()
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
await profilesService.getProfile(route.params.id)
|
await profilesService.getProfile(route.params.id);
|
||||||
await profilesService.getKeeps(route.params.id)
|
await profilesService.getVaults(AppState.activeProfile.id);
|
||||||
await profilesService.getVaults(route.params.id)
|
await profilesService.getKeeps(AppState.activeProfile.id);
|
||||||
} catch (error) {
|
|
||||||
logger.error(error)
|
|
||||||
}
|
}
|
||||||
})
|
catch (error) {
|
||||||
|
logger.error(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
components: { VaultsList, KeepsList },
|
// no curly gorls
|
||||||
profile: computed(() => {AppState.activeProfile}),
|
profile: computed(() => AppState.activeProfile),
|
||||||
keeps: computed(() => {AppState.profileKeeps}),
|
keeps: computed(() => AppState.profileKeeps),
|
||||||
vaults: computed(() => {AppState.profileVaults})
|
vaults: computed(() => AppState.profileVaults),
|
||||||
};
|
activeKeep: computed(() => AppState.activeKeep),
|
||||||
|
|
||||||
|
async viewKeep(keep) {
|
||||||
|
keep.creator = AppState.activeProfile;
|
||||||
|
AppState.activeKeep = keep;
|
||||||
|
Modal.getOrCreateInstance(document.getElementById("keepModal")).show();
|
||||||
|
},
|
||||||
|
|
||||||
|
async viewVault(vault) {
|
||||||
|
router.push({name: 'Vault', params: {id: vault.id}})
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: { VaultTile }
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.profile-pic {
|
||||||
|
height: 200px;
|
||||||
|
width: 200px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 6;
|
||||||
|
|
||||||
|
div {
|
||||||
|
break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="component">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 d-flex justify-content-between">
|
||||||
|
<div>
|
||||||
|
<h4>{{ vault.name }}</h4>
|
||||||
|
<h6>Keeps: vaultKeep stoufe</h6>
|
||||||
|
</div>
|
||||||
|
<i @click="" class="mdi mdi-delete"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="masonry-frame">
|
||||||
|
<div v-for="k in keeps" :key="k.id" @click="viewKeep(k)" class="p-2">
|
||||||
|
<KeepTile :keep="k" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<KeepModal :keep="activeKeep" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { profilesService } from '../services/ProfilesService'
|
||||||
|
import { computed, onMounted } from 'vue'
|
||||||
|
import { AppState } from '../AppState';
|
||||||
|
import { logger } from '../utils/Logger.js'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import { Modal } from 'bootstrap'
|
||||||
|
import { keepsService } from '../services/KeepsService';
|
||||||
|
import { vaultsService } from '../services/VaultsService'
|
||||||
|
import KeepTile from '../components/KeepTile.vue';
|
||||||
|
import KeepModal from '../components/KeepModal.vue';
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
const route = useRoute();
|
||||||
|
onMounted(async () => {
|
||||||
|
await vaultsService.getVault(route.params.id);
|
||||||
|
await vaultsService.getVaultKeeps(route.params.id);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
vault: computed(() => AppState.activeVault),
|
||||||
|
keeps: computed(() => AppState.vaultKeeps),
|
||||||
|
activeKeep: computed(() => AppState.activeKeep),
|
||||||
|
|
||||||
|
viewKeep(keep) {
|
||||||
|
AppState.activeKeep = keep
|
||||||
|
Modal.getOrCreateInstance(document.getElementById('keepModal')).show()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: { KeepTile, KeepModal }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 6;
|
||||||
|
|
||||||
|
div {
|
||||||
|
break-inside: avoid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.masonry-frame {
|
||||||
|
columns: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -18,9 +18,14 @@ const routes = [
|
|||||||
beforeEnter: authGuard
|
beforeEnter: authGuard
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/profile',
|
path: '/profile/:id',
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
component: loadPage('ProfilePage')
|
component: loadPage('ProfilePage')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/vault/:id',
|
||||||
|
name: 'Vault',
|
||||||
|
component: loadPage('VaultPage')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { logger } from '../utils/Logger'
|
|||||||
import { api } from './AxiosService'
|
import { api } from './AxiosService'
|
||||||
|
|
||||||
class KeepsService {
|
class KeepsService {
|
||||||
async GetAll() {
|
async getAll() {
|
||||||
try {
|
try {
|
||||||
const res = await api.get('api/keeps')
|
const res = await api.get('api/keeps')
|
||||||
AppState.keeps = res.data
|
AppState.keeps = res.data
|
||||||
@@ -11,6 +11,15 @@ class KeepsService {
|
|||||||
logger.error(error)
|
logger.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getById(id) {
|
||||||
|
try {
|
||||||
|
const res = await api.get('api/keeps/' + id)
|
||||||
|
AppState.keeps = res.data
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const keepsService = new KeepsService()
|
export const keepsService = new KeepsService()
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { AppState } from '../AppState'
|
||||||
|
import { logger } from '../utils/Logger'
|
||||||
|
import { api } from './AxiosService'
|
||||||
|
|
||||||
|
class VaultsService {
|
||||||
|
async getVault(vaultId) {
|
||||||
|
try {
|
||||||
|
const res = await api.get('api/vaults/' + vaultId)
|
||||||
|
AppState.activeVault = res.data
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getVaultKeeps(vaultId) {
|
||||||
|
try {
|
||||||
|
const res = await api.get('api/vaults/' + vaultId + '/keeps')
|
||||||
|
AppState.vaultKeeps = res.data
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const vaultsService = new VaultsService()
|
||||||
@@ -9,6 +9,7 @@ namespace keepr.Models
|
|||||||
public string CreatorId { get; set; }
|
public string CreatorId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
public string Img { get; set; }
|
||||||
public bool? IsPrivate { get; set; }
|
public bool? IsPrivate { get; set; }
|
||||||
|
|
||||||
public Profile Creator { get; set; }
|
public Profile Creator { get; set; }
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
using keepr.Controllers;
|
|
||||||
using keepr.Models;
|
using keepr.Models;
|
||||||
using keepr.Repositories;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using keepr.Services;
|
|
||||||
using CodeWorks.Auth0Provider;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -45,9 +37,9 @@ namespace keepr.Repositories
|
|||||||
{
|
{
|
||||||
string sql = @"
|
string sql = @"
|
||||||
INSERT INTO vaults
|
INSERT INTO vaults
|
||||||
(creatorId, name, description, isPrivate)
|
(creatorId, name, description, img, isPrivate)
|
||||||
VALUES
|
VALUES
|
||||||
(@CreatorId, @Name, @Description, @IsPrivate);
|
(@CreatorId, @Name, @Description, @Img, @IsPrivate);
|
||||||
SELECT LAST_INSERT_ID();
|
SELECT LAST_INSERT_ID();
|
||||||
";
|
";
|
||||||
int vaultId = _db.ExecuteScalar<int>(sql, vaultData);
|
int vaultId = _db.ExecuteScalar<int>(sql, vaultData);
|
||||||
@@ -83,6 +75,7 @@ namespace keepr.Repositories
|
|||||||
SET
|
SET
|
||||||
name = @Name,
|
name = @Name,
|
||||||
description = @Description,
|
description = @Description,
|
||||||
|
img = @Img,
|
||||||
isPrivate = @IsPrivate
|
isPrivate = @IsPrivate
|
||||||
WHERE id = @Id;
|
WHERE id = @Id;
|
||||||
";
|
";
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
using keepr.Controllers;
|
|
||||||
using keepr.Models;
|
using keepr.Models;
|
||||||
using keepr.Repositories;
|
using keepr.Repositories;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using keepr.Services;
|
|
||||||
using CodeWorks.Auth0Provider;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace keepr.Services
|
namespace keepr.Services
|
||||||
{
|
{
|
||||||
@@ -75,6 +69,7 @@ namespace keepr.Services
|
|||||||
}
|
}
|
||||||
original.Name = update.Name ?? original.Name;
|
original.Name = update.Name ?? original.Name;
|
||||||
original.Description = update.Description ?? original.Description;
|
original.Description = update.Description ?? original.Description;
|
||||||
|
original.Img = update.Img ?? original.Img;
|
||||||
original.IsPrivate = update.IsPrivate != null ? update.IsPrivate : original.IsPrivate;
|
original.IsPrivate = update.IsPrivate != null ? update.IsPrivate : original.IsPrivate;
|
||||||
update = _repo.Update(original);
|
update = _repo.Update(original);
|
||||||
return update;
|
return update;
|
||||||
|
|||||||
Reference in New Issue
Block a user