This file contains hidden or 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
using FluentMigrator; | |
namespace ThingPlatform.Migrations; | |
[Migration(20230912)] | |
public class DataSourceMigration : Migration | |
{ | |
public override void Down() | |
{ | |
Delete.Table("books"); |
This file contains hidden or 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
namespace ThingPlatform.Services; | |
public class TenantService | |
{ | |
private readonly IHttpContextAccessor _httpContext; | |
public TenantService(IHttpContextAccessor httpContext) => | |
_httpContext = httpContext; | |
public Guid GetTenant() |
This file contains hidden or 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
using System.Text.Json.Serialization; | |
namespace ThingPlatform.Models; | |
public abstract class Entity | |
{ | |
public virtual Guid Id { get; set; } | |
[JsonIgnore] | |
public virtual Guid TenantId { get; set; } | |
} |
This file contains hidden or 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
import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query"; | |
import axios from "axios"; | |
export const useEntities = <T extends { id: string }>( | |
key: string, | |
url: string | |
) => { | |
const entities = useQuery<T[], Error>( | |
[key], | |
async ({ signal }): Promise<T[]> => { |
This file contains hidden or 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
import * as React from 'react'; | |
import { Redirect, Route, Switch } from 'react-router'; | |
import Layout from './Layout'; | |
import Home from './Home'; | |
import Admin from './Admin'; | |
class App extends React.Component { | |
public render() { | |
return ( | |
<Layout> |