mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
change some names for more clarity
This commit is contained in:
parent
871ecf3c53
commit
96c15b5cbc
@ -12,7 +12,7 @@ import {
|
||||
} from 'typeorm'
|
||||
import { User } from './User'
|
||||
import { Community } from './Community'
|
||||
import { TransactionDraft } from './TransactionDraft'
|
||||
import { TransactionRecipe } from './TransactionRecipe'
|
||||
import { ConfirmedTransaction } from './ConfirmedTransaction'
|
||||
|
||||
@Entity('accounts')
|
||||
@ -28,8 +28,8 @@ export class Account {
|
||||
@Column({ name: 'user_id', type: 'int', unsigned: true, nullable: true })
|
||||
userId?: number
|
||||
|
||||
@Column({ name: 'account_nr', type: 'int', unsigned: true, default: 0 })
|
||||
accountNr: number
|
||||
@Column({ name: 'derivation_index', type: 'int', unsigned: true })
|
||||
derivationIndex: number
|
||||
|
||||
@Column({ type: 'binary', length: 32, unique: true })
|
||||
pubkey: Buffer
|
||||
@ -62,11 +62,11 @@ export class Account {
|
||||
})
|
||||
accountCommunities: Community[]
|
||||
|
||||
@OneToMany(() => TransactionDraft, (draft) => draft.signingAccount)
|
||||
transactionDraftsSigning?: TransactionDraft[]
|
||||
@OneToMany(() => TransactionRecipe, (recipe) => recipe.signingAccount)
|
||||
transactionRecipesSigning?: TransactionRecipe[]
|
||||
|
||||
@OneToMany(() => TransactionDraft, (draft) => draft.recipientAccount)
|
||||
transactionDraftsRecipient?: TransactionDraft[]
|
||||
@OneToMany(() => TransactionRecipe, (recipe) => recipe.recipientAccount)
|
||||
transactionRecipesRecipient?: TransactionRecipe[]
|
||||
|
||||
@OneToMany(() => ConfirmedTransaction, (transaction) => transaction.account)
|
||||
confirmedTransactions?: ConfirmedTransaction[]
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
JoinTable,
|
||||
} from 'typeorm'
|
||||
import { Account } from './Account'
|
||||
import { TransactionDraft } from './TransactionDraft'
|
||||
import { TransactionRecipe } from './TransactionRecipe'
|
||||
|
||||
@Entity('communities')
|
||||
export class Community {
|
||||
@ -60,9 +60,9 @@ export class Community {
|
||||
})
|
||||
communityAccounts: Account[]
|
||||
|
||||
@OneToMany(() => TransactionDraft, (draft) => draft.senderCommunity)
|
||||
transactionDraftsSender?: TransactionDraft[]
|
||||
@OneToMany(() => TransactionRecipe, (recipe) => recipe.senderCommunity)
|
||||
transactionRecipesSender?: TransactionRecipe[]
|
||||
|
||||
@OneToMany(() => TransactionDraft, (draft) => draft.recipientCommunity)
|
||||
transactionDraftsRecipient?: TransactionDraft[]
|
||||
@OneToMany(() => TransactionRecipe, (recipe) => recipe.recipientCommunity)
|
||||
transactionRecipesRecipient?: TransactionRecipe[]
|
||||
}
|
||||
|
||||
@ -11,19 +11,19 @@ import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer'
|
||||
import { Account } from './Account'
|
||||
import { TransactionDraft } from './TransactionDraft'
|
||||
import { TransactionRecipe } from './TransactionRecipe'
|
||||
|
||||
@Entity('confirmed_transactions')
|
||||
export class ConfirmedTransaction {
|
||||
@PrimaryGeneratedColumn('increment', { unsigned: true, type: 'bigint' })
|
||||
id: number
|
||||
|
||||
@OneToOne(() => TransactionDraft, (draft) => draft.confirmedTransaction)
|
||||
@JoinColumn({ name: 'transaction_draft_id' })
|
||||
transactionDraft: TransactionDraft
|
||||
@OneToOne(() => TransactionRecipe, (recipe) => recipe.confirmedTransaction)
|
||||
@JoinColumn({ name: 'transaction_recipe_id' })
|
||||
transactionRecipe: TransactionRecipe
|
||||
|
||||
@Column({ name: 'transaction_draft_id', type: 'int', unsigned: true })
|
||||
transactionDraftId: number
|
||||
@Column({ name: 'transaction_recipe_id', type: 'int', unsigned: true })
|
||||
transactionRecipeId: number
|
||||
|
||||
@Column({ type: 'bigint' })
|
||||
nr: number
|
||||
|
||||
@ -14,36 +14,36 @@ import { Account } from './Account'
|
||||
import { Community } from './Community'
|
||||
import { ConfirmedTransaction } from './ConfirmedTransaction'
|
||||
|
||||
@Entity('transaction_drafts')
|
||||
export class TransactionDraft {
|
||||
@Entity('transaction_recipes')
|
||||
export class TransactionRecipe {
|
||||
@PrimaryGeneratedColumn('increment', { unsigned: true, type: 'bigint' })
|
||||
id: number
|
||||
|
||||
@Column({ name: 'iota_message_id', type: 'binary', length: 32, nullable: true })
|
||||
iotaMessageId?: Buffer
|
||||
|
||||
@ManyToOne(() => Account, (account) => account.transactionDraftsSigning)
|
||||
@ManyToOne(() => Account, (account) => account.transactionRecipesSigning)
|
||||
@JoinColumn({ name: 'signing_account_id' })
|
||||
signingAccount: Account
|
||||
|
||||
@Column({ name: 'signing_account_id', type: 'int', unsigned: true })
|
||||
signingAccountId: number
|
||||
|
||||
@ManyToOne(() => Account, (account) => account.transactionDraftsRecipient)
|
||||
@ManyToOne(() => Account, (account) => account.transactionRecipesRecipient)
|
||||
@JoinColumn({ name: 'recipient_account_id' })
|
||||
recipientAccount?: Account
|
||||
|
||||
@Column({ name: 'recipient_account_id', type: 'int', unsigned: true, nullable: true })
|
||||
recipientAccountId?: number
|
||||
|
||||
@ManyToOne(() => Community, (community) => community.transactionDraftsSender)
|
||||
@ManyToOne(() => Community, (community) => community.transactionRecipesSender)
|
||||
@JoinColumn({ name: 'sender_community_id' })
|
||||
senderCommunity: Community
|
||||
|
||||
@Column({ name: 'sender_community_id', type: 'int', unsigned: true })
|
||||
senderCommunityId: number
|
||||
|
||||
@ManyToOne(() => Community, (community) => community.transactionDraftsRecipient)
|
||||
@ManyToOne(() => Community, (community) => community.transactionRecipesRecipient)
|
||||
@JoinColumn({ name: 'recipient_community_id' })
|
||||
recipientCommunity?: Community
|
||||
|
||||
@ -74,6 +74,6 @@ export class TransactionDraft {
|
||||
@Column({ name: 'protocol_version', type: 'int', default: 1 })
|
||||
protocolVersion: number
|
||||
|
||||
@OneToOne(() => ConfirmedTransaction, (transaction) => transaction.transactionDraft)
|
||||
@OneToOne(() => ConfirmedTransaction, (transaction) => transaction.transactionRecipe)
|
||||
confirmedTransaction?: ConfirmedTransaction
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
export { TransactionDraft } from './0001-init_db/TransactionDraft'
|
||||
1
dlt-database/entity/TransactionRecipe.ts
Normal file
1
dlt-database/entity/TransactionRecipe.ts
Normal file
@ -0,0 +1 @@
|
||||
export { TransactionRecipe } from './0001-init_db/TransactionRecipe'
|
||||
@ -30,7 +30,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
CREATE TABLE IF NOT EXISTS \`accounts\` (
|
||||
\`id\` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`user_id\` int(10) unsigned DEFAULT NULL,
|
||||
\`account_nr\` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
\`derivation_index\` int(10) unsigned NOT NULL,
|
||||
\`pubkey\` binary(32) NOT NULL,
|
||||
\`type\` tinyint unsigned NOT NULL,
|
||||
\`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@ -72,7 +72,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`)
|
||||
|
||||
await queryFn(`
|
||||
CREATE TABLE IF NOT EXISTS \`transaction_drafts\` (
|
||||
CREATE TABLE IF NOT EXISTS \`transaction_recipes\` (
|
||||
\`id\` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`iota_message_id\` binary(32) DEFAULT NULL,
|
||||
\`signing_account_id\` int(10) unsigned NOT NULL,
|
||||
@ -95,7 +95,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
await queryFn(`
|
||||
CREATE TABLE IF NOT EXISTS \`confirmed_transactions\` (
|
||||
\`id\` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`transaction_draft_id\` bigint unsigned NOT NULL,
|
||||
\`transaction_recipe_id\` bigint unsigned NOT NULL,
|
||||
\`nr\` bigint unsigned NOT NULL,
|
||||
\`running_hash\` binary(48) NOT NULL,
|
||||
\`account_id\` int(10) unsigned NOT NULL,
|
||||
@ -103,7 +103,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
||||
\`iota_milestone\` bigint NOT NULL,
|
||||
\`confirmed_at\` datetime NOT NULL,
|
||||
PRIMARY KEY (\`id\`),
|
||||
FOREIGN KEY (\`transaction_draft_id\`) REFERENCES transaction_drafts(id),
|
||||
FOREIGN KEY (\`transaction_recipe_id\`) REFERENCES transaction_recipes(id),
|
||||
FOREIGN KEY (\`account_id\`) REFERENCES accounts(id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;`)
|
||||
}
|
||||
@ -113,7 +113,7 @@ export async function downgrade(queryFn: (query: string, values?: any[]) => Prom
|
||||
await queryFn(`DROP TABLE IF EXISTS \`users\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`accounts\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`account_community\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`transaction_drafts\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`transaction_recipes\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`confirmed_transactions\`;`)
|
||||
await queryFn(`DROP TABLE IF EXISTS \`community\`;`)
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"build": "mkdir -p build/src/config/ && tsc --build",
|
||||
"build": "tsc --build",
|
||||
"clean": "tsc --build --clean",
|
||||
"up": "cross-env TZ=UTC node build/src/index.js up",
|
||||
"down": "cross-env TZ=UTC node build/src/index.js down",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user