empiezo migracion svelte 5
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
20
Aspnet/Controllers/AccionesController.cs
Normal file
20
Aspnet/Controllers/AccionesController.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class AccionesController: ControllerBase {
|
||||
|
||||
[HttpPost("api/acciones")]
|
||||
public IActionResult ListarAccionesPorUsuario([FromBody] string email) {
|
||||
Request.Cookies.TryGetValue("token", out var token);
|
||||
if (token == null) return Unauthorized(new { esValido = false});
|
||||
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(email, token);
|
||||
if (!esValido) return Unauthorized();
|
||||
|
||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(email);
|
||||
return Ok(Permisos);
|
||||
}
|
||||
}
|
||||
8
Aspnet/Controllers/PropiedadesController.cs
Normal file
8
Aspnet/Controllers/PropiedadesController.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class PropiedadesController: ControllerBase {
|
||||
|
||||
}
|
||||
257
Front/.svelte-kit/ambient.d.ts
vendored
Normal file
257
Front/.svelte-kit/ambient.d.ts
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
|
||||
// this file is generated — do not edit it
|
||||
|
||||
|
||||
/// <reference types="@sveltejs/kit" />
|
||||
|
||||
/**
|
||||
* Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured).
|
||||
*
|
||||
* _Unlike_ [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination.
|
||||
*
|
||||
* ```ts
|
||||
* import { API_KEY } from '$env/static/private';
|
||||
* ```
|
||||
*
|
||||
* Note that all environment variables referenced in your code should be declared (for example in an `.env` file), even if they don't have a value until the app is deployed:
|
||||
*
|
||||
* ```
|
||||
* MY_FEATURE_FLAG=""
|
||||
* ```
|
||||
*
|
||||
* You can override `.env` values from the command line like so:
|
||||
*
|
||||
* ```bash
|
||||
* MY_FEATURE_FLAG="enabled" npm run dev
|
||||
* ```
|
||||
*/
|
||||
declare module '$env/static/private' {
|
||||
export const SHELL: string;
|
||||
export const LSCOLORS: string;
|
||||
export const SESSION_MANAGER: string;
|
||||
export const WINDOWID: string;
|
||||
export const COLORTERM: string;
|
||||
export const XDG_CONFIG_DIRS: string;
|
||||
export const LESS: string;
|
||||
export const XDG_SESSION_PATH: string;
|
||||
export const XDG_MENU_PREFIX: string;
|
||||
export const ICEAUTHORITY: string;
|
||||
export const LANGUAGE: string;
|
||||
export const NODE: string;
|
||||
export const LC_ADDRESS: string;
|
||||
export const LC_NAME: string;
|
||||
export const GRADLE_HOME: string;
|
||||
export const SHELL_SESSION_ID: string;
|
||||
export const MEMORY_PRESSURE_WRITE: string;
|
||||
export const npm_config_local_prefix: string;
|
||||
export const DESKTOP_SESSION: string;
|
||||
export const LC_MONETARY: string;
|
||||
export const GTK_RC_FILES: string;
|
||||
export const EDITOR: string;
|
||||
export const XDG_SEAT: string;
|
||||
export const PWD: string;
|
||||
export const XDG_SESSION_DESKTOP: string;
|
||||
export const LOGNAME: string;
|
||||
export const XDG_SESSION_TYPE: string;
|
||||
export const BUN_WHICH_IGNORE_CWD: string;
|
||||
export const SYSTEMD_EXEC_PID: string;
|
||||
export const _: string;
|
||||
export const XAUTHORITY: string;
|
||||
export const MOTD_SHOWN: string;
|
||||
export const GTK2_RC_FILES: string;
|
||||
export const HOME: string;
|
||||
export const LC_PAPER: string;
|
||||
export const LANG: string;
|
||||
export const LS_COLORS: string;
|
||||
export const XDG_CURRENT_DESKTOP: string;
|
||||
export const KONSOLE_DBUS_SERVICE: string;
|
||||
export const npm_package_version: string;
|
||||
export const MEMORY_PRESSURE_WATCH: string;
|
||||
export const WAYLAND_DISPLAY: string;
|
||||
export const KONSOLE_DBUS_SESSION: string;
|
||||
export const PROFILEHOME: string;
|
||||
export const XDG_SEAT_PATH: string;
|
||||
export const INVOCATION_ID: string;
|
||||
export const KONSOLE_VERSION: string;
|
||||
export const MANAGERPID: string;
|
||||
export const INIT_CWD: string;
|
||||
export const KDE_SESSION_UID: string;
|
||||
export const XKB_DEFAULT_LAYOUT: string;
|
||||
export const XDG_SESSION_CLASS: string;
|
||||
export const TERM: string;
|
||||
export const LC_IDENTIFICATION: string;
|
||||
export const npm_package_name: string;
|
||||
export const ZSH: string;
|
||||
export const USER: string;
|
||||
export const COLORFGBG: string;
|
||||
export const QT_WAYLAND_RECONNECT: string;
|
||||
export const KDE_SESSION_VERSION: string;
|
||||
export const PAM_KWALLET5_LOGIN: string;
|
||||
export const DISPLAY: string;
|
||||
export const SHLVL: string;
|
||||
export const PAGER: string;
|
||||
export const LC_TELEPHONE: string;
|
||||
export const LC_MEASUREMENT: string;
|
||||
export const XDG_VTNR: string;
|
||||
export const XDG_SESSION_ID: string;
|
||||
export const npm_config_user_agent: string;
|
||||
export const npm_execpath: string;
|
||||
export const XDG_RUNTIME_DIR: string;
|
||||
export const DEBUGINFOD_URLS: string;
|
||||
export const npm_package_json: string;
|
||||
export const LC_TIME: string;
|
||||
export const BUN_INSTALL: string;
|
||||
export const QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
||||
export const JOURNAL_STREAM: string;
|
||||
export const XDG_DATA_DIRS: string;
|
||||
export const KDE_FULL_SESSION: string;
|
||||
export const BROWSER: string;
|
||||
export const PATH: string;
|
||||
export const DBUS_SESSION_BUS_ADDRESS: string;
|
||||
export const KDE_APPLICATIONS_AS_SCOPE: string;
|
||||
export const MAIL: string;
|
||||
export const npm_node_execpath: string;
|
||||
export const LC_NUMERIC: string;
|
||||
export const OLDPWD: string;
|
||||
export const KONSOLE_DBUS_WINDOW: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
|
||||
*
|
||||
* Values are replaced statically at build time.
|
||||
*
|
||||
* ```ts
|
||||
* import { PUBLIC_BASE_URL } from '$env/static/public';
|
||||
* ```
|
||||
*/
|
||||
declare module '$env/static/public' {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://svelte.dev/docs/kit/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured).
|
||||
*
|
||||
* This module cannot be imported into client-side code.
|
||||
*
|
||||
* Dynamic environment variables cannot be used during prerendering.
|
||||
*
|
||||
* ```ts
|
||||
* import { env } from '$env/dynamic/private';
|
||||
* console.log(env.DEPLOYMENT_SPECIFIC_VARIABLE);
|
||||
* ```
|
||||
*
|
||||
* > In `dev`, `$env/dynamic` always includes environment variables from `.env`. In `prod`, this behavior will depend on your adapter.
|
||||
*/
|
||||
declare module '$env/dynamic/private' {
|
||||
export const env: {
|
||||
SHELL: string;
|
||||
LSCOLORS: string;
|
||||
SESSION_MANAGER: string;
|
||||
WINDOWID: string;
|
||||
COLORTERM: string;
|
||||
XDG_CONFIG_DIRS: string;
|
||||
LESS: string;
|
||||
XDG_SESSION_PATH: string;
|
||||
XDG_MENU_PREFIX: string;
|
||||
ICEAUTHORITY: string;
|
||||
LANGUAGE: string;
|
||||
NODE: string;
|
||||
LC_ADDRESS: string;
|
||||
LC_NAME: string;
|
||||
GRADLE_HOME: string;
|
||||
SHELL_SESSION_ID: string;
|
||||
MEMORY_PRESSURE_WRITE: string;
|
||||
npm_config_local_prefix: string;
|
||||
DESKTOP_SESSION: string;
|
||||
LC_MONETARY: string;
|
||||
GTK_RC_FILES: string;
|
||||
EDITOR: string;
|
||||
XDG_SEAT: string;
|
||||
PWD: string;
|
||||
XDG_SESSION_DESKTOP: string;
|
||||
LOGNAME: string;
|
||||
XDG_SESSION_TYPE: string;
|
||||
BUN_WHICH_IGNORE_CWD: string;
|
||||
SYSTEMD_EXEC_PID: string;
|
||||
_: string;
|
||||
XAUTHORITY: string;
|
||||
MOTD_SHOWN: string;
|
||||
GTK2_RC_FILES: string;
|
||||
HOME: string;
|
||||
LC_PAPER: string;
|
||||
LANG: string;
|
||||
LS_COLORS: string;
|
||||
XDG_CURRENT_DESKTOP: string;
|
||||
KONSOLE_DBUS_SERVICE: string;
|
||||
npm_package_version: string;
|
||||
MEMORY_PRESSURE_WATCH: string;
|
||||
WAYLAND_DISPLAY: string;
|
||||
KONSOLE_DBUS_SESSION: string;
|
||||
PROFILEHOME: string;
|
||||
XDG_SEAT_PATH: string;
|
||||
INVOCATION_ID: string;
|
||||
KONSOLE_VERSION: string;
|
||||
MANAGERPID: string;
|
||||
INIT_CWD: string;
|
||||
KDE_SESSION_UID: string;
|
||||
XKB_DEFAULT_LAYOUT: string;
|
||||
XDG_SESSION_CLASS: string;
|
||||
TERM: string;
|
||||
LC_IDENTIFICATION: string;
|
||||
npm_package_name: string;
|
||||
ZSH: string;
|
||||
USER: string;
|
||||
COLORFGBG: string;
|
||||
QT_WAYLAND_RECONNECT: string;
|
||||
KDE_SESSION_VERSION: string;
|
||||
PAM_KWALLET5_LOGIN: string;
|
||||
DISPLAY: string;
|
||||
SHLVL: string;
|
||||
PAGER: string;
|
||||
LC_TELEPHONE: string;
|
||||
LC_MEASUREMENT: string;
|
||||
XDG_VTNR: string;
|
||||
XDG_SESSION_ID: string;
|
||||
npm_config_user_agent: string;
|
||||
npm_execpath: string;
|
||||
XDG_RUNTIME_DIR: string;
|
||||
DEBUGINFOD_URLS: string;
|
||||
npm_package_json: string;
|
||||
LC_TIME: string;
|
||||
BUN_INSTALL: string;
|
||||
QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
||||
JOURNAL_STREAM: string;
|
||||
XDG_DATA_DIRS: string;
|
||||
KDE_FULL_SESSION: string;
|
||||
BROWSER: string;
|
||||
PATH: string;
|
||||
DBUS_SESSION_BUS_ADDRESS: string;
|
||||
KDE_APPLICATIONS_AS_SCOPE: string;
|
||||
MAIL: string;
|
||||
npm_node_execpath: string;
|
||||
LC_NUMERIC: string;
|
||||
OLDPWD: string;
|
||||
KONSOLE_DBUS_WINDOW: string;
|
||||
[key: `PUBLIC_${string}`]: undefined;
|
||||
[key: `${string}`]: string | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
|
||||
*
|
||||
* Note that public dynamic environment variables must all be sent from the server to the client, causing larger network requests — when possible, use `$env/static/public` instead.
|
||||
*
|
||||
* Dynamic environment variables cannot be used during prerendering.
|
||||
*
|
||||
* ```ts
|
||||
* import { env } from '$env/dynamic/public';
|
||||
* console.log(env.PUBLIC_DEPLOYMENT_SPECIFIC_VARIABLE);
|
||||
* ```
|
||||
*/
|
||||
declare module '$env/dynamic/public' {
|
||||
export const env: {
|
||||
[key: `PUBLIC_${string}`]: string | undefined;
|
||||
}
|
||||
}
|
||||
20
Front/.svelte-kit/generated/client/app.js
Normal file
20
Front/.svelte-kit/generated/client/app.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export { matchers } from './matchers.js';
|
||||
|
||||
export const nodes = [
|
||||
() => import('./nodes/0'),
|
||||
() => import('./nodes/1')
|
||||
];
|
||||
|
||||
export const server_loads = [];
|
||||
|
||||
export const dictionary = {
|
||||
|
||||
};
|
||||
|
||||
export const hooks = {
|
||||
handleError: (({ error }) => { console.error(error) }),
|
||||
|
||||
reroute: (() => {})
|
||||
};
|
||||
|
||||
export { default as root } from '../root.svelte';
|
||||
1
Front/.svelte-kit/generated/client/matchers.js
Normal file
1
Front/.svelte-kit/generated/client/matchers.js
Normal file
@@ -0,0 +1 @@
|
||||
export const matchers = {};
|
||||
1
Front/.svelte-kit/generated/client/nodes/0.js
Normal file
1
Front/.svelte-kit/generated/client/nodes/0.js
Normal file
@@ -0,0 +1 @@
|
||||
export { default as component } from "../../../../node_modules/@sveltejs/kit/src/runtime/components/svelte-4/layout.svelte";
|
||||
1
Front/.svelte-kit/generated/client/nodes/1.js
Normal file
1
Front/.svelte-kit/generated/client/nodes/1.js
Normal file
@@ -0,0 +1 @@
|
||||
export { default as component } from "../../../../node_modules/@sveltejs/kit/src/runtime/components/svelte-4/error.svelte";
|
||||
25
Front/.svelte-kit/non-ambient.d.ts
vendored
Normal file
25
Front/.svelte-kit/non-ambient.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
// this file is generated — do not edit it
|
||||
|
||||
|
||||
declare module "svelte/elements" {
|
||||
export interface HTMLAttributes<T> {
|
||||
'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null;
|
||||
'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null;
|
||||
'data-sveltekit-preload-code'?:
|
||||
| true
|
||||
| ''
|
||||
| 'eager'
|
||||
| 'viewport'
|
||||
| 'hover'
|
||||
| 'tap'
|
||||
| 'off'
|
||||
| undefined
|
||||
| null;
|
||||
'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null;
|
||||
'data-sveltekit-reload'?: true | '' | 'off' | undefined | null;
|
||||
'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
49
Front/.svelte-kit/tsconfig.json
Normal file
49
Front/.svelte-kit/tsconfig.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"$lib": [
|
||||
"../src/lib"
|
||||
],
|
||||
"$lib/*": [
|
||||
"../src/lib/*"
|
||||
]
|
||||
},
|
||||
"rootDirs": [
|
||||
"..",
|
||||
"./types"
|
||||
],
|
||||
"verbatimModuleSyntax": true,
|
||||
"isolatedModules": true,
|
||||
"lib": [
|
||||
"esnext",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"noEmit": true,
|
||||
"target": "esnext"
|
||||
},
|
||||
"include": [
|
||||
"ambient.d.ts",
|
||||
"non-ambient.d.ts",
|
||||
"./types/**/$types.d.ts",
|
||||
"../vite.config.js",
|
||||
"../vite.config.ts",
|
||||
"../src/**/*.js",
|
||||
"../src/**/*.ts",
|
||||
"../src/**/*.svelte",
|
||||
"../tests/**/*.js",
|
||||
"../tests/**/*.ts",
|
||||
"../tests/**/*.svelte"
|
||||
],
|
||||
"exclude": [
|
||||
"../node_modules/**",
|
||||
"../src/service-worker.js",
|
||||
"../src/service-worker/**/*.js",
|
||||
"../src/service-worker.ts",
|
||||
"../src/service-worker/**/*.ts",
|
||||
"../src/service-worker.d.ts",
|
||||
"../src/service-worker/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
BIN
Front/bun.lockb
BIN
Front/bun.lockb
Binary file not shown.
@@ -13,13 +13,13 @@
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
||||
"@tsconfig/svelte": "^5.0.4",
|
||||
"svelte": "^4.2.19",
|
||||
"svelte-check": "^4.0.4",
|
||||
"tslib": "^2.7.0",
|
||||
"typescript": "^5.5.3",
|
||||
"vite": "^5.4.8"
|
||||
"svelte-check": "^4.0.5",
|
||||
"tslib": "^2.8.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sveltejs/kit": "^2.7.1",
|
||||
"@sveltejs/kit": "^2.7.3",
|
||||
"@sveltestrap/sveltestrap": "^6.2.7",
|
||||
"svelte-routing": "^2.13.0"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { Navbar, NavbarBrand, NavbarToggler, NavItem, Nav, NavLink, Collapse } from "@sveltestrap/sveltestrap";
|
||||
import { onMount } from "svelte";
|
||||
import { navigate } from "svelte-routing";
|
||||
let isOpen = false;
|
||||
|
||||
function handleUpdate(event) {
|
||||
function handleUpdate(event: any) {
|
||||
isOpen = event.detail.isOpen;
|
||||
}
|
||||
|
||||
let permisos = $state()
|
||||
|
||||
async function obtenerPermisos(){
|
||||
try {
|
||||
const response = await fetch("http://localhost:5007/api/acciones",{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : "application/json"
|
||||
},
|
||||
credentials: 'include'
|
||||
});
|
||||
if (response.ok){
|
||||
permisos = response.json();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
navigate("/");
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<Navbar container="xxl" expand="md" color="dark-subtle">
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
"moduleDetection": "force"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
"references": [{ "path": "./tsconfig.json" }]
|
||||
}
|
||||
|
||||
19
Modelo/RepositorioPermisos.cs
Normal file
19
Modelo/RepositorioPermisos.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Entidades;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
public class RepositorioPermisos: RepositorioBase<RepositorioPermisos> {
|
||||
public IQueryable<Permiso>? ListarPermisos(string email) {
|
||||
var con = Context;
|
||||
Cliente? cli = con.Clientes.Include(x => x.Idgrupos).FirstOrDefault(c => c.Email == email);
|
||||
if (cli == null) return null;
|
||||
|
||||
var list = con.Clientes
|
||||
.Where(c => c.Dni == cli.Dni)
|
||||
.SelectMany(c => c.Idgrupos)
|
||||
.SelectMany(g => g.Idpermisos)
|
||||
.Distinct();
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user