diff options
author | 2021-09-01 11:45:01 +0200 | |
---|---|---|
committer | 2021-09-01 11:45:01 +0200 | |
commit | 684bd56528c5ffa37af8340b8b141fe390dd05a4 (patch) | |
tree | 4a78d70c2ca7f15e47f8a2e6bc51d62c99b0f52d /internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go | |
parent | Merge branch 'struct_validation' of github.com:superseriousbusiness/gotosocia... (diff) | |
download | gotosocial-684bd56528c5ffa37af8340b8b141fe390dd05a4.tar.xz |
move oauth models into gtsmodel
Diffstat (limited to 'internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go')
-rw-r--r-- | internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go b/internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go new file mode 100644 index 000000000..6647e941a --- /dev/null +++ b/internal/db/bundb/migrations/20210816411877_struct_validation/statusfave.go @@ -0,0 +1,34 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package gtsmodel + +import "time" + +// StatusFave refers to a 'fave' or 'like' in the database, from one account, targeting the status of another account +type StatusFave struct { + ID string `validate:"required,ulid" bun:"type:CHAR(26),pk,nullzero,notnull,unique"` // id of this item in the database + CreatedAt time.Time `validate:"-" bun:",nullzero,notnull,default:current_timestamp"` // when was item created + AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id of the account that created ('did') the fave + Account *Account `validate:"-" bun:"rel:belongs-to"` // account that created the fave + TargetAccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // id the account owning the faved status + TargetAccount *Account `validate:"-" bun:"rel:belongs-to"` // account owning the faved status + StatusID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // database id of the status that has been 'faved' + Status *Status `validate:"-" bun:"rel:belongs-to"` // the faved status + URI string `validate:"required,url" bun:",nullzero,notnull"` // ActivityPub URI of this fave +} |