Skip to content

Commit

Permalink
feat(models): add meta schema + tenants + update user models (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
harrytran998 authored May 10, 2024
1 parent 4f78461 commit ecffeb0
Show file tree
Hide file tree
Showing 97 changed files with 5,199 additions and 153 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- ".github/workflows/ci.mobile.yml"
branches: ["dev", "release/*"]
pull_request:
paths:
- "apps/mobile/**"
- ".github/workflows/ci.mobile.yml"
branches: ["dev", "release/*"]

jobs:
Expand Down
3 changes: 1 addition & 2 deletions .moon/hooks/commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

scripts/git/commit-msg.sh

scripts/git/commit-msg.sh
3 changes: 1 addition & 2 deletions .moon/hooks/post-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

scripts/git/post-checkout.sh

scripts/git/post-checkout.sh
3 changes: 1 addition & 2 deletions .moon/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

scripts/git/pre-commit.sh

scripts/git/pre-commit.sh
3 changes: 1 addition & 2 deletions .moon/hooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

scripts/git/pre-push.sh

scripts/git/pre-push.sh
3 changes: 1 addition & 2 deletions .moon/hooks/prepare-commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ set -eo pipefail
# Automatically generated by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vcs-hooks

scripts/git/commit-msg.sh

scripts/git/commit-msg.sh
Binary file modified bun.lockb
Binary file not shown.
4 changes: 3 additions & 1 deletion packages/db/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ tasks:
build:
options:
mergeArgs: "replace"
args: "src/**/*.ts --clean --dts --format esm --tsconfig tsconfig.build.json"
args: "src/index.ts --clean --dts --format esm --tsconfig tsconfig.build.json"
gen.model:
command: "kysely-codegen"
1 change: 1 addition & 0 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"kysely": "0.27.3"
},
"devDependencies": {
"pg": "^8.11.5",
"tsup": "8.0.2"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Kysely } from "kysely";
import { withTimestamps } from "../utils";
import { sql } from "kysely";
import type { DB } from "kysely-codegen";

export async function up(db: Kysely<any>) {
export async function up(db: Kysely<DB>) {
await db.schema
.createType("user_status")
.asEnum(["NEWBIE", "VERIFIED", "BLACKLIST", "INACTIVE", "ACTIVE", "CLOSED"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function up(db: Kysely<any>) {
.addColumn("name", "varchar(255)", (col) => col.notNull())
.addColumn("slug", "varchar(255)", (col) => col.unique().notNull())
.addColumn("description", "text", (col) => col.notNull().defaultTo(""))
.addColumn("verified", "boolean", (col) => col.notNull().defaultTo(false))
.addColumn("is_verified", "boolean", (col) => col.notNull().defaultTo(false))
.addColumn("owner_id", "text", (col) => col.references("users.id").onDelete("set null"))
.addColumn("metadata", "jsonb")
.$call(withTimestamps)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Kysely } from "kysely";

export async function up(db: Kysely<any>) {
await db.insertInto("meta_schemas").values({});
}

export async function down(db: Kysely<any>) {}
Empty file removed packages/db/src/seeds/index.ts
Empty file.
Empty file.
118 changes: 118 additions & 0 deletions packages/models/gen/dart/meta_schema/v1/meta_schema.event.pb.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// Generated code. Do not modify.
// source: meta_schema/v1/meta_schema.event.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

class GetMetaSchemaRequest extends $pb.GeneratedMessage {
factory GetMetaSchemaRequest({
$core.String? id,
}) {
final $result = create();
if (id != null) {
$result.id = id;
}
return $result;
}
GetMetaSchemaRequest._() : super();
factory GetMetaSchemaRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GetMetaSchemaRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetMetaSchemaRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'gen.go.meta_schema.v1'), createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'id')
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GetMetaSchemaRequest clone() => GetMetaSchemaRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GetMetaSchemaRequest copyWith(void Function(GetMetaSchemaRequest) updates) => super.copyWith((message) => updates(message as GetMetaSchemaRequest)) as GetMetaSchemaRequest;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static GetMetaSchemaRequest create() => GetMetaSchemaRequest._();
GetMetaSchemaRequest createEmptyInstance() => create();
static $pb.PbList<GetMetaSchemaRequest> createRepeated() => $pb.PbList<GetMetaSchemaRequest>();
@$core.pragma('dart2js:noInline')
static GetMetaSchemaRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetMetaSchemaRequest>(create);
static GetMetaSchemaRequest? _defaultInstance;

@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
}

class GetMetaSchemaResponse extends $pb.GeneratedMessage {
factory GetMetaSchemaResponse({
$core.String? id,
}) {
final $result = create();
if (id != null) {
$result.id = id;
}
return $result;
}
GetMetaSchemaResponse._() : super();
factory GetMetaSchemaResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GetMetaSchemaResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetMetaSchemaResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'gen.go.meta_schema.v1'), createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'id')
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GetMetaSchemaResponse clone() => GetMetaSchemaResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GetMetaSchemaResponse copyWith(void Function(GetMetaSchemaResponse) updates) => super.copyWith((message) => updates(message as GetMetaSchemaResponse)) as GetMetaSchemaResponse;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static GetMetaSchemaResponse create() => GetMetaSchemaResponse._();
GetMetaSchemaResponse createEmptyInstance() => create();
static $pb.PbList<GetMetaSchemaResponse> createRepeated() => $pb.PbList<GetMetaSchemaResponse>();
@$core.pragma('dart2js:noInline')
static GetMetaSchemaResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetMetaSchemaResponse>(create);
static GetMetaSchemaResponse? _defaultInstance;

@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
}


const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Generated code. Do not modify.
// source: meta_schema/v1/meta_schema.event.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Generated code. Do not modify.
// source: meta_schema/v1/meta_schema.event.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;

@$core.Deprecated('Use getMetaSchemaRequestDescriptor instead')
const GetMetaSchemaRequest$json = {
'1': 'GetMetaSchemaRequest',
'2': [
{'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
],
};

/// Descriptor for `GetMetaSchemaRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getMetaSchemaRequestDescriptor = $convert.base64Decode(
'ChRHZXRNZXRhU2NoZW1hUmVxdWVzdBIOCgJpZBgBIAEoCVICaWQ=');

@$core.Deprecated('Use getMetaSchemaResponseDescriptor instead')
const GetMetaSchemaResponse$json = {
'1': 'GetMetaSchemaResponse',
'2': [
{'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
],
};

/// Descriptor for `GetMetaSchemaResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getMetaSchemaResponseDescriptor = $convert.base64Decode(
'ChVHZXRNZXRhU2NoZW1hUmVzcG9uc2USDgoCaWQYASABKAlSAmlk');

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Generated code. Do not modify.
// source: meta_schema/v1/meta_schema.event.proto
//
// @dart = 2.12

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import

export 'meta_schema.event.pb.dart';

Loading

0 comments on commit ecffeb0

Please sign in to comment.