debug done.
This commit is contained in:
parent
47335ca5e9
commit
af9d966376
2
TODO
2
TODO
@ -2,7 +2,7 @@
|
||||
- [x] Web UI
|
||||
- [x] i18n
|
||||
- [x] modals
|
||||
- [] debug
|
||||
- [x] debug
|
||||
- [x] swagger
|
||||
- [] comments
|
||||
- [] Nix Module
|
||||
|
@ -138,7 +138,7 @@ func DeleteDomain(id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := (recordsDAO{}).Delete(tx, &models.Record[models.RecordContentDefault]{Zone: domain.WithDotEnd()}); err != nil {
|
||||
if err := (recordsDAO{}).Delete(tx, &models.Record[models.RecordContentDefault]{}, &models.Record[models.RecordContentDefault]{Zone: domain.WithDotEnd()}); err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
@ -90,8 +90,13 @@ func (b BaseDAO[T]) UpdateOrCreate(db *gorm.DB, e T, cond ...T) (T, error) {
|
||||
return e, err
|
||||
}
|
||||
|
||||
func (BaseDAO[T]) Delete(db *gorm.DB, e T) error {
|
||||
if err := db.Delete(e).Error; err != nil {
|
||||
func (BaseDAO[T]) Delete(db *gorm.DB, e T, cond ...T) error {
|
||||
tx := db
|
||||
for _, c := range cond {
|
||||
tx = tx.Where(c)
|
||||
}
|
||||
|
||||
if err := tx.Delete(e).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -59,7 +59,7 @@ type CNAMERecord struct {
|
||||
}
|
||||
|
||||
func (r CNAMERecord) Validate() error {
|
||||
if strings.HasSuffix(r.Host, ".") {
|
||||
if !strings.HasSuffix(r.Host, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
return nil
|
||||
@ -70,7 +70,7 @@ type NSRecord struct {
|
||||
}
|
||||
|
||||
func (r NSRecord) Validate() error {
|
||||
if strings.HasSuffix(r.Host, ".") {
|
||||
if !strings.HasSuffix(r.Host, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
return nil
|
||||
@ -81,7 +81,7 @@ type MXRecord struct {
|
||||
}
|
||||
|
||||
func (r MXRecord) Validate() error {
|
||||
if strings.HasSuffix(r.Host, ".") {
|
||||
if !strings.HasSuffix(r.Host, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
return nil
|
||||
@ -92,7 +92,7 @@ type SRVRecord struct {
|
||||
}
|
||||
|
||||
func (r SRVRecord) Validate() error {
|
||||
if strings.HasPrefix(r.Target, ".") {
|
||||
if !strings.HasPrefix(r.Target, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
|
||||
@ -104,11 +104,7 @@ type SOARecord struct {
|
||||
}
|
||||
|
||||
func (r SOARecord) Validate() error {
|
||||
if strings.HasPrefix(r.MBox, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
|
||||
if strings.HasSuffix(r.Ns, ".") {
|
||||
if !strings.HasSuffix(r.Ns, ".") {
|
||||
return ErrNoDotSuffix
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ func updateRecord(c *gin.Context) {
|
||||
}
|
||||
|
||||
domain := c.Param("domain")
|
||||
if domain != record.Zone {
|
||||
if domain != record.WithOutDotTail() {
|
||||
c.JSON(http.StatusBadRequest, Response{
|
||||
Succeed: false,
|
||||
Message: "request body doesn't match URI",
|
||||
|
@ -227,6 +227,7 @@ export default function RecordEditModal({ open, record, onOk, onCancel, editReco
|
||||
validateTrigger='onBlur'
|
||||
>
|
||||
<Form.Item<Record> hidden name='id' />
|
||||
<Form.Item<Record> hidden name='zone' />
|
||||
<Form.Item<Record> label={t('records.recordType')} required name='record_type'>
|
||||
<Select allowClear={false} options={recordTypeOptions} />
|
||||
</Form.Item>
|
||||
|
Loading…
Reference in New Issue
Block a user